Issue
How to convert the Matlab code
v = [1: n]
to pytorch?
Writing a whole loop for that seems inefficient.
Solution
You can directly use the arange
method from Pytorch.
torch_v = torch.arange(1,n)
Reference: https://pytorch.org/docs/master/torch.html?highlight=arange#torch.arange
Answered By - Avijit Dasgupta
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.