I'm trying to update a segment in the matrix in Torch, but I have not got a simple function to do it.
For example: $ x = torch.Tensor(5, 6):zero() -- create a matrix
and I tried to update a segment in the matrix like:
$ x[{ 2,{2,4} }]= {1, 2, 3}
and
$ x[{ 2,{2,4} }]:fill({1,2,3})
Neither of them works.
Should I just do it with a loop or does there exist a simple function?
Simply create a tensor instead of trying to directly assign a table:
x[{2, {2,4}}] = torch.Tensor({1, 2, 3})