class maze.perception.blocks.general.repeat_to_match.RepeatToMatchBlock(*args: Any, **kwargs: Any)

A repeat-to-match block. This blocks takes two tensors and a dimension index as an input. Then when it’s forward method is called, it matches the specified the dimension (with :param repeat_at_idx) of the first tensor with the specified dimension (:param repeat_at_idx) of the second tensor. This is done by repeating the first tensor n times in dimension in dimension :param repeat_at_idx. Here n = tensor_1.shape[repeat_at_idx] - tensor_0.shape[repeat_at_idx]. As a constraint the first tensor has to satisfy the following condition: tensor_0[repeat_at_idx] == 1

  • in_keys – The keys identifying the input tensors.

  • out_keys – One key identifying the output tensors.

  • in_shapes – List of input shapes.

  • repeat_at_idx – Specify the dimension that should be matched between the tensors.

forward(block_input: Dict[str, torch.Tensor]) → Dict[str, torch.Tensor]

(overrides PerceptionBlock)

Forward pass, repeat the first tensor to match the second one in the given dimension

param block_input

The block’s input dictionary.


The block’s output dictionary.