时间:2022-02-21 10:57:01 | 栏目:Python代码 | 点击:次
实例如下所示:
from functools import reduce from operator import mul def get_num_params(): num_params = 0 for variable in tf.trainable_variables(): shape = variable.get_shape() num_params += reduce(mul, [dim.value for dim in shape], 1) return num_params