Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test_JustElement.lua « test - github.com/torch/nngraph.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d6c49a85a7202c515bc0349a0784780e9a24b853 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

require 'totem'
require 'nngraph'
local test = {}
local tester = totem.Tester()

function test.test_output()
   local input = {torch.randn(7, 11)}
   local module = nngraph.JustElement()
   tester:eq(module:forward(input), input[1], "output")
end

function test.test_grad()
   local input = {torch.randn(7, 11)}
   local module = nngraph.JustElement()
   totem.nn.checkGradients(tester, module, input)
end

function test.test_split()
   local in1 = nn.Identity()()
   local output = in1:split(1)
   local net = nn.gModule({in1}, {output})

   local input = {torch.randn(7, 11)}
   tester:eq(net:forward(input), input[1], "output of split(1)")
end

tester:add(test):run()