Tensor broadcasting

0
easy

In this exercise you would need to fill a given tensor with a specific value using broadcasting and basic arithmetic operations.

Similar to numpy, PyTorch supports broadcasting elementwise operations. In short, if a PyTorch operation supports broadcast, then its Tensor arguments can be automatically expanded to be of equal sizes (without making copies of the data). Please refer to this discussion for broadcasting examples : https://stackoverflow.com/a/51371509 . Or check official torch docs bellow.

Examples:

1
2
3
4
5
6
10
10
10
10
10
10
10
0
-1
-2
-3
5
5
5
5
5

Loading...
2024 © TensorGym
Contrinbute | Contact | Copyright | 𝕏