Torch.jl icon indicating copy to clipboard operation
Torch.jl copied to clipboard

How to implement the `torch.gather` function?

Open findmyway opened this issue 5 years ago • 1 comments

With Array in Julia, I can use m[[CartesianIndex(1,1), CartesianIndex(2,1)]] to get the required elements. But with the Tensor in Torch.jl I only get ERROR: getindex not defined for Tensor{Float32,2}

findmyway avatar Aug 17 '20 04:08 findmyway

Currently getindex has been commented out in favour of keeping the implementation from going to slow fallbacks. This can be done fairly easily via views on the tensor. So a getindex operation can create a copy of a view.

DhairyaLGandhi avatar Sep 04 '20 00:09 DhairyaLGandhi