burn
burn copied to clipboard
Implement multi-dimensional repeat operation and rename existing repeat method
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:
- Implement a new
repeat
method that accepts multiple dimensions and repeats the tensor along those dimensions simultaneously. - Rename the existing
repeat
method torepeat_dim
for consistency with other*_dim
methods. - Update the documentation and examples to reflect the new
repeat
method and the renamedrepeat_dim
method. - Add unit tests to verify the correctness of the multi-dimensional repeat operation.
- 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.
CC: @louisfd, @nathanielsimard, @laggui
It should be easy to make a default implementation that calls repeat_dim once for each dimension