Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2D tensors should be reversed? #36

Open
bjosv79 opened this issue Aug 25, 2020 · 1 comment
Open

2D tensors should be reversed? #36

bjosv79 opened this issue Aug 25, 2020 · 1 comment

Comments

@bjosv79
Copy link

bjosv79 commented Aug 25, 2020

Hi,
When implementing a linear layer, the following code does not produce the expected output:

import Torch: tensor
W = collect(reshape(1.f0:6.f0, (3,2)))
x = reshape([1.f0; 1.f0], (2, 1))
expected = W * x
output = tensor(W, dev = 0) * tensor(x, dev = 0)

I noted that 2d and nd tensors are treated differently and to me this looks like the root cause:
https://github.com/FluxML/Torch.jl/blob/master/src/tensor.jl#L143-L149

Is there a good reason to treat them differently?

@ToucheSir
Copy link
Member

See #21 and

# TODO: using `rank` here causes compiler to emit error
. This should hopefully be easier to do now that the native library build instructions have been cleaned up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants