How can I do the same thing with pytorch?
local right = nn.Sequential()
right:add(nn.Narrow(2, 1, output_size))
How can I do the same thing with pytorch?
local right = nn.Sequential()
right:add(nn.Narrow(2, 1, output_size))
You could write a custom module and pass add it to nn.Sequential
.
Something like this might work:
class Narrow(nn.Module):
def __init__(self, dim, start, length):
super(Narrow, self).__init__()
self.dim = dim
self.start = start
self.length = length
def forward(self, x):
x = torch.narrow(x, self.dim, self.start, self.length)
return x
Are there any ways to hold this tensor input empty?
I don’t quite understand the use case. Could you explain it a bit more?
So I could later create concattable and assign same tensor input to this module and others.
I still don’t understand the use case. You are not assigning a tensor input to the module, but create the module and pass the input during the forward pass to it.