Expanding Variable with zero-padding (for DepthConcat)
For example, <SCODE># a: 1x2x2, b: 1x4x4
a = Variable(torch.FloatTensor([[[1,2],[3,4]]]))
b = Variable(torch.FloatTensor([[[1,1,1,1],[2,2,2,2],[3,3,3,3],[4,4,4,4]]]))
<ECODE> What I want to get from cat([a, b], 0) is <SCODE>(0 ,.,.) =
0 0 0 0
0 1 2 0
0 3 4 0
0 0 0 0

(1 ,.,.) =
1 1 1 1
2 2 2 2
3 3 3 3
4 4 4 4
<ECODE> I may try to use narrow() and copy_(), but I’m not sure copying to Variable in forward() is ok.
thnkim
thnkim
apaszke
thnkim