burn icon indicating copy to clipboard operation
burn copied to clipboard

Implement multi-dimensional repeat operation and rename existing repeat method

Open antimora opened this issue 9 months ago • 2 comments

Currently, Burn's repeat method only supports repeating along one dimension at a time. To enhance functionality and align with common deep learning frameworks like PyTorch, we need to implement a new repeat operation that accepts multiple dimensions simultaneously. This will provide the same behavior as PyTorch's repeat.

To avoid confusion and maintain consistency with other Burn methods, we should rename the existing repeat method to repeat_dim, similar to other *_dim methods in the library.

Implementing this multi-dimensional repeat operation is crucial for supporting the Tile ONNX operator, which is commonly used in many user-submitted models. The lack of this functionality has been reported by users, as highlighted in issue #1714.

Tasks:

  1. Implement a new repeat method that accepts multiple dimensions and repeats the tensor along those dimensions simultaneously.
  2. Rename the existing repeat method to repeat_dim for consistency with other *_dim methods.
  3. Update the documentation and examples to reflect the new repeat method and the renamed repeat_dim method.
  4. Add unit tests to verify the correctness of the multi-dimensional repeat operation.
  5. Ensure compatibility with the Tile ONNX operator and test with user-submitted models that require this functionality.

By completing these tasks, we will provide a more comprehensive and user-friendly repeat operation in Burn, enabling users to easily repeat tensors along multiple dimensions and improving compatibility with ONNX models.

antimora avatar Apr 30 '24 21:04 antimora

CC: @louisfd, @nathanielsimard, @laggui

antimora avatar Apr 30 '24 22:04 antimora

It should be easy to make a default implementation that calls repeat_dim once for each dimension

louisfd avatar Apr 30 '24 22:04 louisfd