Created
October 5, 2016 15:51
-
-
Save adityaramesh/e31f9bafee2a85243f1d4714fd3cb1ff to your computer and use it in GitHub Desktop.
bilinear_bug.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('nn') | |
require('nngraph') | |
local m | |
do | |
local x1, x2 = nn.Identity()(), nn.Identity()() | |
local y = nn.Bilinear(2, 2, 2){x1, x2} | |
m = nn.gModule({x1, x2}, {y}) | |
end | |
local x1 = torch.Tensor(1, 2):fill(1) | |
local x2 = x1:clone() | |
local z = x1:clone() | |
print(m:forward{x1, x2}) | |
print(m:backward({x1, x2}, z)) | |
m:clearState() | |
print(m:forward{x1, x2}) | |
print(m:backward({x1, x2}, z)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment