Created
September 7, 2020 14:33
-
-
Save MLWhiz/68b77e357a97733189f1c5d0d51536b0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A = torch.randn(3,4) | |
W = torch.randn(4,2) | |
# Multiply Matrix A and W | |
t = A.mm(W) | |
print(f"Created Tensor t by Multiplying A and W:\n{t}") | |
# Transpose Tensor t | |
t = t.t() | |
print(f"Transpose of Tensor t:\n{t}") | |
# Square each element of t | |
t = t**2 | |
print(f"Square each element of Tensor t:\n{t}") | |
# return the size of a tensor | |
print(f"Size of Tensor t using .size():\n{t.size()}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment