MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / count_params

Function count_params

tensorflow/python/keras/utils/layer_utils.py:70–82  ·  view source on GitHub ↗

Count the total number of scalars composing the weights. Arguments: weights: An iterable containing the weights on which to compute params Returns: The total number of scalars composing the weights

(weights)

Source from the content-addressed store, hash-verified

68
69
70def count_params(weights):
71 """Count the total number of scalars composing the weights.
72
73 Arguments:
74 weights: An iterable containing the weights on which to compute params
75
76 Returns:
77 The total number of scalars composing the weights
78 """
79 return int(
80 sum(
81 np.prod(p.shape.as_list())
82 for p in object_identity.ObjectIdentitySet(weights)))
83
84
85def print_summary(model, line_length=None, positions=None, print_fn=None):

Callers 1

print_summaryFunction · 0.70

Calls 2

sumFunction · 0.85
as_listMethod · 0.45

Tested by

no test coverage detected