I want to add a module in the network, the module is used to resize the size of 4-D tensor in the network, Do you know how to achieve it?
It seems like you haven’t finish the 60 min tutorials
def forward(self, x):
x = x.view(....) # I think you mean reshape instead of resize
I’m sorry that I don’t describe the problem clearly. I want to crop or resize the size of variable.data in the forward function.
resize op can not backpropagate.
do you mean index like variable[:100, :10]
Yes,I just want to crop the Variable.data (such as 258258 -> 256256), is it feasible?
You can not do it directly in variable.data
, It will raise error of size-dismatch when backward.
Try variable[1:257,1:257]
if you know what you are doing.
Thank you very much! I have solved the problem in this way.
By the way, I want to know that whether the tensor’s ops can be used for Variable, such as torch.add(), torch.sigmoid() and so on .
torch.add
is overwrite in variable which made it an op on variable. So it is ok to use torch.func
on variable in most cases.