Reputation: 14096
How to slice tensor's rows in Torch
like we do in Numpy
with m[begin:end, :]
?
Example of code that I want to run:
require 'torch'
m = torch.Tensor(10, 2):zero()
a = torch.Tensor(5, 2):fill(1)
m({{1,5}, {}}) = a -- Error at this line
Expected value for m
1 1
1 1
1 1
1 1
1 1
0 0
0 0
0 0
0 0
0 0
[torch.DoubleTensor of size 10x2]
Upvotes: 2
Views: 812
Reputation: 14096
I had to use brackets m[]
instead of parenthesis
Rest of the code is fine.
Upvotes: 1