You’re using the Module incorrectly. You should never call a function directly to apply it. You should only define the forward function and simply call a module like a function - module(input). This will run the __call__ method, that we’ve implementented and that will call into your forward function with the inputs. It’s necessary for some additional bookkeeping like hooks, etc.
So the problem was 1 vs 0-based GPU indexing right? We need to fix that, it should never give you an invalid memory access.