
# !wget https://github.com/dream80/roop_colab/releases/download/v0.0.1/inswapper_128.onnx
# !pip3 install onnx onnx2pytorch

# import onnx
# from onnx2pytorch import ConvertModel
# onnx_model = onnx.load('inswapper_128.onnx')
# pytorch_model = ConvertModel(onnx_model)
# print(pytorch_model)

'''
INSwapper(
  (Pad_input): Pad(mode=reflect, padding=None)
  (Conv_input.7): Conv2d(3, 128, kernel_size=(7, 7), stride=(1, 1))
  (LeakyRelu_onnx::Conv_126): LeakyReLU(negative_slope=0.20000000298023224, inplace=True)
  (Conv_input.15): Conv2d(128, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
  (LeakyRelu_onnx::Conv_129): LeakyReLU(negative_slope=0.20000000298023224, inplace=True)
  (Conv_input.23): Conv2d(256, 512, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))
  (LeakyRelu_onnx::Conv_132): LeakyReLU(negative_slope=0.20000000298023224, inplace=True)
  (Conv_input.31): Conv2d(512, 1024, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))
  (LeakyRelu_onnx::Pad_135): LeakyReLU(negative_slope=0.20000000298023224, inplace=True)
  (Pad_input.35): Pad(mode=reflect, padding=None)
  (Conv_onnx::ReduceMean_159): Conv2d(1024, 1024, kernel_size=(3, 3), stride=(1, 1))
  (Sub_onnx::Mul_161): tanh()
  (Mul_onnx::ReduceMean_162): tanh()
  (Add_onnx::Sqrt_165): Add()
  (Sqrt_onnx::Div_166): tanh()
  (Div_onnx::Mul_168): Div()
  (Mul_onnx::Mul_169): tanh()
  (Gemm_onnx::Unsqueeze_170): Linear(in_features=512, out_features=2048, bias=True)
  (Unsqueeze_onnx::Unsqueeze_171): Unsqueeze()
  (Unsqueeze_onnx::Shape_172): Unsqueeze()
  (Slice_onnx::Mul_183): Slice()
  (Slice_onnx::Add_186): Slice()
  (Mul_onnx::Add_187): tanh()
  (Add_input.39): Add()
  (Relu_onnx::Pad_189): ReLU(inplace=True)
  (Pad_input.43): Pad(mode=reflect, padding=None)
  (Conv_onnx::ReduceMean_213): Conv2d(1024, 1024, kernel_size=(3, 3), stride=(1, 1))
  (Sub_onnx::Mul_215): tanh()
  (Mul_onnx::ReduceMean_216): tanh()
  (Add_onnx::Sqrt_219): Add()
  (Sqrt_onnx::Div_220): tanh()
  (Div_onnx::Mul_222): Div()
  (Mul_onnx::Mul_223): tanh()
  (Gemm_onnx::Unsqueeze_224): Linear(in_features=512, out_features=2048, bias=True)
  (Unsqueeze_onnx::Unsqueeze_225): Unsqueeze()
  (Unsqueeze_onnx::Shape_226): Unsqueeze()
  (Slice_onnx::Mul_237): Slice()
  (Slice_onnx::Add_240): Slice()
  (Mul_onnx::Add_241): tanh()
  (Add_onnx::Add_242): Add()
  (Add_onnx::Pad_243): Add()
  (Pad_input.47): Pad(mode=reflect, padding=None)
  (Conv_onnx::ReduceMean_267): Conv2d(1024, 1024, kernel_size=(3, 3), stride=(1, 1))
  (Sub_onnx::Mul_269): tanh()
  (Mul_onnx::ReduceMean_270): tanh()
  (Add_onnx::Sqrt_273): Add()
  (Sqrt_onnx::Div_274): tanh()
  (Div_onnx::Mul_276): Div()
  (Mul_onnx::Mul_277): tanh()
  (Gemm_onnx::Unsqueeze_278): Linear(in_features=512, out_features=2048, bias=True)
  (Unsqueeze_onnx::Unsqueeze_279): Unsqueeze()
  (Unsqueeze_onnx::Shape_280): Unsqueeze()
  (Slice_onnx::Mul_291): Slice()
  (Slice_onnx::Add_294): Slice()
  (Mul_onnx::Add_295): tanh()
  (Add_input.51): Add()
  (Relu_onnx::Pad_297): ReLU(inplace=True)
  (Pad_input.55): Pad(mode=reflect, padding=None)
  (Conv_onnx::ReduceMean_321): Conv2d(1024, 1024, kernel_size=(3, 3), stride=(1, 1))
  (Sub_onnx::Mul_323): tanh()
  (Mul_onnx::ReduceMean_324): tanh()
  (Add_onnx::Sqrt_327): Add()
  (Sqrt_onnx::Div_328): tanh()
  (Div_onnx::Mul_330): Div()
  (Mul_onnx::Mul_331): tanh()
  (Gemm_onnx::Unsqueeze_332): Linear(in_features=512, out_features=2048, bias=True)
  (Unsqueeze_onnx::Unsqueeze_333): Unsqueeze()
  (Unsqueeze_onnx::Shape_334): Unsqueeze()
  (Slice_onnx::Mul_345): Slice()
  (Slice_onnx::Add_348): Slice()
  (Mul_onnx::Add_349): tanh()
  (Add_onnx::Add_350): Add()
  (Add_onnx::Pad_351): Add()
  (Pad_input.59): Pad(mode=reflect, padding=None)
  (Conv_onnx::ReduceMean_375): Conv2d(1024, 1024, kernel_size=(3, 3), stride=(1, 1))
  (Sub_onnx::Mul_377): tanh()
  (Mul_onnx::ReduceMean_378): tanh()
  (Add_onnx::Sqrt_381): Add()
  (Sqrt_onnx::Div_382): tanh()
  (Div_onnx::Mul_384): Div()
  (Mul_onnx::Mul_385): tanh()
  (Gemm_onnx::Unsqueeze_386): Linear(in_features=512, out_features=2048, bias=True)
  (Unsqueeze_onnx::Unsqueeze_387): Unsqueeze()
  (Unsqueeze_onnx::Shape_388): Unsqueeze()
  (Slice_onnx::Mul_399): Slice()
  (Slice_onnx::Add_402): Slice()
  (Mul_onnx::Add_403): tanh()
  (Add_input.63): Add()
  (Relu_onnx::Pad_405): ReLU(inplace=True)
  (Pad_input.67): Pad(mode=reflect, padding=None)
  (Conv_onnx::ReduceMean_429): Conv2d(1024, 1024, kernel_size=(3, 3), stride=(1, 1))
  (Sub_onnx::Mul_431): tanh()
  (Mul_onnx::ReduceMean_432): tanh()
  (Add_onnx::Sqrt_435): Add()
  (Sqrt_onnx::Div_436): tanh()
  (Div_onnx::Mul_438): Div()
  (Mul_onnx::Mul_439): tanh()
  (Gemm_onnx::Unsqueeze_440): Linear(in_features=512, out_features=2048, bias=True)
  (Unsqueeze_onnx::Unsqueeze_441): Unsqueeze()
  (Unsqueeze_onnx::Shape_442): Unsqueeze()
  (Slice_onnx::Mul_453): Slice()
  (Slice_onnx::Add_456): Slice()
  (Mul_onnx::Add_457): tanh()
  (Add_onnx::Add_458): Add()
  (Add_onnx::Pad_459): Add()
  (Pad_input.71): Pad(mode=reflect, padding=None)
  (Conv_onnx::ReduceMean_483): Conv2d(1024, 1024, kernel_size=(3, 3), stride=(1, 1))
  (Sub_onnx::Mul_485): tanh()
  (Mul_onnx::ReduceMean_486): tanh()
  (Add_onnx::Sqrt_489): Add()
  (Sqrt_onnx::Div_490): tanh()
  (Div_onnx::Mul_492): Div()
  (Mul_onnx::Mul_493): tanh()
  (Gemm_onnx::Unsqueeze_494): Linear(in_features=512, out_features=2048, bias=True)
  (Unsqueeze_onnx::Unsqueeze_495): Unsqueeze()
  (Unsqueeze_onnx::Shape_496): Unsqueeze()
  (Slice_onnx::Mul_507): Slice()
  (Slice_onnx::Add_510): Slice()
  (Mul_onnx::Add_511): tanh()
  (Add_input.75): Add()
  (Relu_onnx::Pad_513): ReLU(inplace=True)
  (Pad_input.79): Pad(mode=reflect, padding=None)
  (Conv_onnx::ReduceMean_537): Conv2d(1024, 1024, kernel_size=(3, 3), stride=(1, 1))
  (Sub_onnx::Mul_539): tanh()
  (Mul_onnx::ReduceMean_540): tanh()
  (Add_onnx::Sqrt_543): Add()
  (Sqrt_onnx::Div_544): tanh()
  (Div_onnx::Mul_546): Div()
  (Mul_onnx::Mul_547): tanh()
  (Gemm_onnx::Unsqueeze_548): Linear(in_features=512, out_features=2048, bias=True)
  (Unsqueeze_onnx::Unsqueeze_549): Unsqueeze()
  (Unsqueeze_onnx::Shape_550): Unsqueeze()
  (Slice_onnx::Mul_561): Slice()
  (Slice_onnx::Add_564): Slice()
  (Mul_onnx::Add_565): tanh()
  (Add_onnx::Add_566): Add()
  (Add_onnx::Pad_567): Add()
  (Pad_input.83): Pad(mode=reflect, padding=None)
  (Conv_onnx::ReduceMean_591): Conv2d(1024, 1024, kernel_size=(3, 3), stride=(1, 1))
  (Sub_onnx::Mul_593): tanh()
  (Mul_onnx::ReduceMean_594): tanh()
  (Add_onnx::Sqrt_597): Add()
  (Sqrt_onnx::Div_598): tanh()
  (Div_onnx::Mul_600): Div()
  (Mul_onnx::Mul_601): tanh()
  (Gemm_onnx::Unsqueeze_602): Linear(in_features=512, out_features=2048, bias=True)
  (Unsqueeze_onnx::Unsqueeze_603): Unsqueeze()
  (Unsqueeze_onnx::Shape_604): Unsqueeze()
  (Slice_onnx::Mul_615): Slice()
  (Slice_onnx::Add_618): Slice()
  (Mul_onnx::Add_619): tanh()
  (Add_input.87): Add()
  (Relu_onnx::Pad_621): ReLU(inplace=True)
  (Pad_input.91): Pad(mode=reflect, padding=None)
  (Conv_onnx::ReduceMean_645): Conv2d(1024, 1024, kernel_size=(3, 3), stride=(1, 1))
  (Sub_onnx::Mul_647): tanh()
  (Mul_onnx::ReduceMean_648): tanh()
  (Add_onnx::Sqrt_651): Add()
  (Sqrt_onnx::Div_652): tanh()
  (Div_onnx::Mul_654): Div()
  (Mul_onnx::Mul_655): tanh()
  (Gemm_onnx::Unsqueeze_656): Linear(in_features=512, out_features=2048, bias=True)
  (Unsqueeze_onnx::Unsqueeze_657): Unsqueeze()
  (Unsqueeze_onnx::Shape_658): Unsqueeze()
  (Slice_onnx::Mul_669): Slice()
  (Slice_onnx::Add_672): Slice()
  (Mul_onnx::Add_673): tanh()
  (Add_onnx::Add_674): Add()
  (Add_onnx::Pad_675): Add()
  (Pad_input.95): Pad(mode=reflect, padding=None)
  (Conv_onnx::ReduceMean_699): Conv2d(1024, 1024, kernel_size=(3, 3), stride=(1, 1))
  (Sub_onnx::Mul_701): tanh()
  (Mul_onnx::ReduceMean_702): tanh()
  (Add_onnx::Sqrt_705): Add()
  (Sqrt_onnx::Div_706): tanh()
  (Div_onnx::Mul_708): Div()
  (Mul_onnx::Mul_709): tanh()
  (Gemm_onnx::Unsqueeze_710): Linear(in_features=512, out_features=2048, bias=True)
  (Unsqueeze_onnx::Unsqueeze_711): Unsqueeze()
  (Unsqueeze_onnx::Shape_712): Unsqueeze()
  (Slice_onnx::Mul_723): Slice()
  (Slice_onnx::Add_726): Slice()
  (Mul_onnx::Add_727): tanh()
  (Add_input.99): Add()
  (Relu_onnx::Pad_729): ReLU(inplace=True)
  (Pad_input.103): Pad(mode=reflect, padding=None)
  (Conv_onnx::ReduceMean_753): Conv2d(1024, 1024, kernel_size=(3, 3), stride=(1, 1))
  (Sub_onnx::Mul_755): tanh()
  (Mul_onnx::ReduceMean_756): tanh()
  (Add_onnx::Sqrt_759): Add()
  (Sqrt_onnx::Div_760): tanh()
  (Div_onnx::Mul_762): Div()
  (Mul_onnx::Mul_763): tanh()
  (Gemm_onnx::Unsqueeze_764): Linear(in_features=512, out_features=2048, bias=True)
  (Unsqueeze_onnx::Unsqueeze_765): Unsqueeze()
  (Unsqueeze_onnx::Shape_766): Unsqueeze()
  (Slice_onnx::Mul_777): Slice()
  (Slice_onnx::Add_780): Slice()
  (Mul_onnx::Add_781): tanh()
  (Add_onnx::Add_782): Add()
  (Add_input.107): Add()
  (Resize_input.111): Resize()
  (Conv_input.119): Conv2d(1024, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
  (LeakyRelu_onnx::Resize_791): LeakyReLU(negative_slope=0.20000000298023224, inplace=True)
  (Resize_input.123): Resize()
  (Conv_input.131): Conv2d(512, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
  (LeakyRelu_onnx::Conv_799): LeakyReLU(negative_slope=0.20000000298023224, inplace=True)
  (Conv_input.139): Conv2d(256, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
  (LeakyRelu_onnx::Pad_802): LeakyReLU(negative_slope=0.20000000298023224, inplace=True)
  (Pad_input.143): Pad(mode=reflect, padding=None)
  (Conv_onnx::Tanh_826): Conv2d(128, 3, kernel_size=(7, 7), stride=(1, 1))
  (Tanh_onnx::Add_827): tanh()
  (Add_onnx::Div_829): Add()
  (Div_output): Div()
)
'''


