File size: 260 Bytes
e9fe176
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'nn'
require 'Crop'

a = nn.Crop(8, 6, 4, 3)
x = torch.rand(1, 1, 6, 8)
y = torch.Tensor(1, 2, 2)
y[1][1][1] = 2
y[1][1][2] = 3
y[1][2][1] = 5
y[1][2][2] = 2

t = {}
t[1] = x
t[2] = y

z = a:forward(t)
w = a:backward(t, z)

print(x)
print(z)
print(w)