I really think you want to register a buffer…
When you call cuda(), you’ll have your buffer turned into a torch.cuda.FloatTensor (cuda() ref. 4 and buffer’s apply() ref. 5).
Then, in your forward() method you can generate a Variable with the buffer content.