Hi,
I have a pytorch model that is converted from onnx model.
net = copy.deepcopy(model_ori)
print(net)
And print(net) returns as follows:
ConvertModel(
(Constant_9): Constant(constant=tensor([[[[0.13070001]]]], device='cuda:0'))
(Sub_10): sub()
(Constant_11): Constant(constant=tensor([[[[0.30810001]]]], device='cuda:0'))
(Div_12): Div()
(Conv_13): Conv2d(1, 16, kernel_size=(4, 4), stride=(2, 2), padding=(1, 1))
(Relu_14): ReLU(inplace=True)
(Conv_15): Conv2d(16, 32, kernel_size=(4, 4), stride=(2, 2), padding=(1, 1))
(Relu_16): ReLU(inplace=True)
(Flatten_17): Flatten()
(Gemm_18): Linear(in_features=1568, out_features=1000, bias=True)
(Relu_19): ReLU(inplace=True)
(Gemm_output): Linear(in_features=1000, out_features=10, bias=True)
)
I wonder how I can directly replace one layer with another layer (eg: Conv_13 to another self-defined layer) and net
is updated as well?
I appreciate any suggestions. Thank you!