gromo.tools.compute_mask_tensor_t#

gromo.tools.compute_mask_tensor_t(input_shape: tuple[int, int], conv: Conv2d) Tensor[source]#

Compute the tensor T For: - input tensor: B[-1] in (S[-1], H[-1]W[-1]) and (S[-1], H’[-1]W’[-1]) after the pooling - output tensor: B in (S, HW) - conv kernel tensor: W in (S, S[-1], Hd, Wd) T is the tensor in (HW, HdWd, H’[-1]W’[-1]) such that: B = W T B[-1]

Parameters:
  • input_shape (tuple) – shape of the input tensor B[-1] of size (H[-1], W[-1])

  • conv (torch.nn.Conv2d) – convolutional layer applied to the input tensor B[-1]

Returns:

tensor_t – tensor T in (HW, HdWd, H[-1]W[-1])

Return type:

torch.Tensor