def Skew(inputs):
"""
input.shape: (batch size, HEIGHT, WIDTH, dim)
"""
buffer = T.zeros(
(inputs.shape[0], inputs.shape[1], 2*inputs.shape[2] - 1, inputs.shape[3]),
theano.config.floatX
)
for i in xrange(HEIGHT):
buffer = T.inc_subtensor(buffer[:, i, i:i+WIDTH, :], inputs[:,i,:,:])
return buffer
评论列表
文章目录