MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / feature_map_size

Method feature_map_size

monai/visualize/class_activation_maps.py:181–192  ·  view source on GitHub ↗

Computes the actual feature map size given `nn_module` and the target_layer name. Args: input_size: shape of the input tensor device: the device used to initialise the input tensor layer_idx: index of the target layer if there are multiple target

(self, input_size, device="cpu", layer_idx=-1, **kwargs)

Source from the content-addressed store, hash-verified

179 self.postprocessing = postprocessing
180
181 def feature_map_size(self, input_size, device="cpu", layer_idx=-1, **kwargs):
182 """
183 Computes the actual feature map size given `nn_module` and the target_layer name.
184 Args:
185 input_size: shape of the input tensor
186 device: the device used to initialise the input tensor
187 layer_idx: index of the target layer if there are multiple target layers. Defaults to -1.
188 kwargs: any extra arguments to be passed on to the module as part of its `__call__`.
189 Returns:
190 shape of the actual feature map.
191 """
192 return self.compute_map(torch.zeros(*input_size, device=device), layer_idx=layer_idx, **kwargs).shape
193
194 def compute_map(self, x, class_idx=None, layer_idx=-1):
195 """

Callers 2

test_shapeMethod · 0.80
test_shapeMethod · 0.80

Calls 1

compute_mapMethod · 0.95

Tested by 2

test_shapeMethod · 0.64
test_shapeMethod · 0.64