MCPcopy Create free account
hub / github.com/pytorch/pytorch / calculate_fc_output_dims

Method calculate_fc_output_dims

caffe2/python/layers/fc.py:120–136  ·  view source on GitHub ↗
(max_fc_size, input_dim, output_dim)

Source from the content-addressed store, hash-verified

118
119 @staticmethod
120 def calculate_fc_output_dims(max_fc_size, input_dim, output_dim):
121
122 if not max_fc_size or max_fc_size < 0:
123 return None
124
125 assert max_fc_size >= input_dim, "Currently we split along the output " \
126 "dimension. So we need max_fc_size >= input_dim. But, max_fc_size: " \
127 "{}, input_dim: {}".format(max_fc_size, input_dim)
128
129 output_dim_allowed = int(np.floor(max_fc_size / input_dim))
130 num_fc = int(np.floor((output_dim - 1) / output_dim_allowed) + 1)
131
132 output_dim_vec = [output_dim_allowed] * (num_fc - 1)
133
134 output_dim_vec.append(output_dim - sum(output_dim_vec))
135
136 return output_dim_vec
137
138 def _insert_fc_ops(self, net, params, outputs, version):
139 """

Callers 1

__init__Method · 0.80

Calls 4

sumFunction · 0.50
formatMethod · 0.45
floorMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected