Код: Выделить всё
t = torch.tensor(
[[1.0, 1.5, 0.5, 2.0],
[5.0, 3.0, 4.5, 5.5],
[0.5, 1.0, 3.0, 2.0]]
)
Код: Выделить всё
t[:, [-1]]
Код: Выделить всё
tensor([[2.0000],
[5.5000],
[2.0000]])
Код: Выделить всё
tensor([[0.5],
[5.5],
[0.5]])
Подробнее здесь: https://stackoverflow.com/questions/729 ... -in-tensor