MCPcopy Create free account
hub / github.com/OpenGVLab/UniFormerV2 / get_weights

Method get_weights

slowfast/visualization/utils.py:236–252  ·  view source on GitHub ↗

Returns weights from registered layers. Returns: weights (Python dictionary): a dictionary of the pair {layer_name: weight}, where weight is the weight tensor.

(self)

Source from the content-addressed store, hash-verified

234 return activation_dict, preds
235
236 def get_weights(self):
237 """
238 Returns weights from registered layers.
239 Returns:
240 weights (Python dictionary): a dictionary of the pair
241 {layer_name: weight}, where weight is the weight tensor.
242 """
243 weights = {}
244 for layer in self.layers_names:
245 cur_layer = get_layer(self.model, layer)
246 if hasattr(cur_layer, "weight"):
247 weights[layer] = cur_layer.weight.clone().detach()
248 else:
249 logger.error(
250 "Layer {} does not have weight attribute.".format(layer)
251 )
252 return weights
253
254
255def get_indexing(string):

Callers 1

run_visualizationFunction · 0.95

Calls 1

get_layerFunction · 0.85

Tested by

no test coverage detected