Hello,
Please can someone explain the two arguements in torch.randn(). Refer to the example is below:
a = torch.randn(1, 3)
a
tensor([[0.0146, 0.4258, 0.2211]])
Hello,
Please can someone explain the two arguements in torch.randn(). Refer to the example is below:
a = torch.randn(1, 3)
a
tensor([[0.0146, 0.4258, 0.2211]])
Hey,
The arguments your randn function specify the shape of the Tensor you want to populate with random values.
So, (1,3) would be Tensor shaped as such -
[
[a, b, c ]
]
Similarly, a tensor with shape (2,3) would be -
[
[a, b, c],
[x, y, z]
]
And a tensor with a shape (1,2) -
[
[a, b]
]
They are the dimensions of the tensor. rows x columns
a = torch.randn(Rows, Columns)
The first argument defines the number of rows and the second defines the number of columns in your tensor.
Row, Column. torch.randn() generate random numbers