{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Converting PyTorch to ONNX" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "True\n" ] } ], "source": [ "import torch\n", "from torch import nn\n", "from torch.nn import functional as F\n", "\n", "print(torch.cuda.is_available())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Defining the model" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "class BasicBlock(nn.Module):\n", "\n", " def __init__(self, in_channels, out_channels, stride= 1):\n", " super().__init__()\n", " self.conv1 = nn.Conv2d(in_channels, out_channels, 3, stride= stride, padding= 1)\n", " self.conv2 = nn.Conv2d(out_channels, out_channels, 3, stride= 1, padding= 1)\n", " self.bn1 = nn.BatchNorm2d(out_channels)\n", " self.bn2 = nn.BatchNorm2d(out_channels)\n", " self.relu = nn.ReLU(inplace= True)\n", "\n", " self.downsample = nn.Sequential()\n", " \n", " if stride != 1:\n", " self.downsample = nn.Sequential(\n", " nn.Conv2d(in_channels, out_channels, 1, stride),\n", " nn.BatchNorm2d(out_channels))\n", "\n", " def forward(self, x):\n", " out = self.conv1(x)\n", " out = self.bn1(out)\n", " out = self.relu(out)\n", "\n", " out = self.conv2(out)\n", " out = self.bn2(out)\n", "\n", " out += self.downsample(x)\n", "\n", " out = self.relu(out)\n", "\n", " return out\n", "\n", "class ResNet34(nn.Module):\n", " def __init__(self, num_classes) -> None:\n", " super().__init__()\n", "\n", " self.conv1 = nn.Sequential(nn.Conv2d(3, 64, 7, stride= 2, padding= 3),\n", " nn.BatchNorm2d(64), nn.MaxPool2d(3, stride= 2, padding= 1), nn.ReLU(inplace= True))\n", "\n", " self.layer0 = self._make_layer(64, 64, 3, 1)\n", " self.layer1 = self._make_layer(64, 128, 4, 2)\n", " self.layer2 = self._make_layer(128, 256, 6, 2)\n", " self.layer3 = self._make_layer(256, 512, 3, 2)\n", "\n", " self.avg_pool = nn.AvgPool2d(7)\n", " self.fc = nn.Linear(512, num_classes)\n", "\n", " def _make_layer(self, in_channels, out_channels, num_blocks, stride):\n", " \n", " layers = []\n", " layers.append(BasicBlock(in_channels, out_channels, stride))\n", "\n", " for i in range(num_blocks - 1):\n", " layers.append(BasicBlock(out_channels, out_channels, 1))\n", "\n", " return nn.Sequential(*layers)\n", "\n", " def forward(self, x):\n", " out = self.conv1(x)\n", " \n", " out = self.layer0(out)\n", " out = self.layer1(out)\n", " out = self.layer2(out)\n", " out = self.layer3(out)\n", "\n", " out = self.avg_pool(out)\n", " out = out.view(out.size(0), -1)\n", " out = self.fc(out)\n", "\n", " out = F.log_softmax(out, dim= 1)\n", " return out" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Loading the model" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "model = ResNet34(450)\n", "model.load_state_dict(torch.load('../model/birds_resnet34_model.pth'))\n", "\n", "dummy_input = torch.randn(1, 3, 224, 224)\n", "\n", "model.eval()\n", "torch_out = model(dummy_input)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Converting to ONNX" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Exported graph: graph(%input : Float(*, 3, 224, 224, strides=[150528, 50176, 224, 1], requires_grad=0, device=cpu),\n", " %fc.weight : Float(450, 512, strides=[512, 1], requires_grad=1, device=cpu),\n", " %fc.bias : Float(450, strides=[1], requires_grad=1, device=cpu),\n", " %onnx::Conv_393 : Float(64, 3, 7, 7, strides=[147, 49, 7, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_394 : Float(64, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_396 : Float(64, 64, 3, 3, strides=[576, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_397 : Float(64, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_399 : Float(64, 64, 3, 3, strides=[576, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_400 : Float(64, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_402 : Float(64, 64, 3, 3, strides=[576, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_403 : Float(64, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_405 : Float(64, 64, 3, 3, strides=[576, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_406 : Float(64, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_408 : Float(64, 64, 3, 3, strides=[576, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_409 : Float(64, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_411 : Float(64, 64, 3, 3, strides=[576, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_412 : Float(64, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_414 : Float(128, 64, 3, 3, strides=[576, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_415 : Float(128, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_417 : Float(128, 128, 3, 3, strides=[1152, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_418 : Float(128, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_420 : Float(128, 64, 1, 1, strides=[64, 1, 1, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_421 : Float(128, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_423 : Float(128, 128, 3, 3, strides=[1152, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_424 : Float(128, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_426 : Float(128, 128, 3, 3, strides=[1152, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_427 : Float(128, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_429 : Float(128, 128, 3, 3, strides=[1152, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_430 : Float(128, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_432 : Float(128, 128, 3, 3, strides=[1152, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_433 : Float(128, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_435 : Float(128, 128, 3, 3, strides=[1152, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_436 : Float(128, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_438 : Float(128, 128, 3, 3, strides=[1152, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_439 : Float(128, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_441 : Float(256, 128, 3, 3, strides=[1152, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_442 : Float(256, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_444 : Float(256, 256, 3, 3, strides=[2304, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_445 : Float(256, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_447 : Float(256, 128, 1, 1, strides=[128, 1, 1, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_448 : Float(256, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_450 : Float(256, 256, 3, 3, strides=[2304, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_451 : Float(256, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_453 : Float(256, 256, 3, 3, strides=[2304, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_454 : Float(256, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_456 : Float(256, 256, 3, 3, strides=[2304, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_457 : Float(256, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_459 : Float(256, 256, 3, 3, strides=[2304, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_460 : Float(256, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_462 : Float(256, 256, 3, 3, strides=[2304, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_463 : Float(256, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_465 : Float(256, 256, 3, 3, strides=[2304, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_466 : Float(256, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_468 : Float(256, 256, 3, 3, strides=[2304, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_469 : Float(256, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_471 : Float(256, 256, 3, 3, strides=[2304, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_472 : Float(256, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_474 : Float(256, 256, 3, 3, strides=[2304, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_475 : Float(256, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_477 : Float(256, 256, 3, 3, strides=[2304, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_478 : Float(256, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_480 : Float(512, 256, 3, 3, strides=[2304, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_481 : Float(512, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_483 : Float(512, 512, 3, 3, strides=[4608, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_484 : Float(512, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_486 : Float(512, 256, 1, 1, strides=[256, 1, 1, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_487 : Float(512, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_489 : Float(512, 512, 3, 3, strides=[4608, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_490 : Float(512, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_492 : Float(512, 512, 3, 3, strides=[4608, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_493 : Float(512, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_495 : Float(512, 512, 3, 3, strides=[4608, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_496 : Float(512, strides=[1], requires_grad=0, device=cpu),\n", " %onnx::Conv_498 : Float(512, 512, 3, 3, strides=[4608, 9, 3, 1], requires_grad=0, device=cpu),\n", " %onnx::Conv_499 : Float(512, strides=[1], requires_grad=0, device=cpu)):\n", " %/conv1/conv1.0/Conv_output_0 : Float(*, 64, 112, 112, strides=[802816, 12544, 112, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[7, 7], pads=[3, 3, 3, 3], strides=[2, 2], onnx_name=\"/conv1/conv1.0/Conv\"](%input, %onnx::Conv_393, %onnx::Conv_394), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::conv1/torch.nn.modules.conv.Conv2d::conv1.0 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/conv1/conv1.2/MaxPool_output_0 : Float(*, 64, 56, 56, strides=[200704, 3136, 56, 1], requires_grad=1, device=cpu) = onnx::MaxPool[ceil_mode=0, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[2, 2], onnx_name=\"/conv1/conv1.2/MaxPool\"](%/conv1/conv1.0/Conv_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::conv1/torch.nn.modules.pooling.MaxPool2d::conv1.2 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:780:0\n", " %/conv1/conv1.3/Relu_output_0 : Float(*, 64, 56, 56, strides=[200704, 3136, 56, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/conv1/conv1.3/Relu\"](%/conv1/conv1.2/MaxPool_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::conv1/torch.nn.modules.activation.ReLU::conv1.3 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer0/layer0.0/conv1/Conv_output_0 : Float(*, 64, 56, 56, strides=[200704, 3136, 56, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer0/layer0.0/conv1/Conv\"](%/conv1/conv1.3/Relu_output_0, %onnx::Conv_396, %onnx::Conv_397), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer0/__main__.BasicBlock::layer0.0/torch.nn.modules.conv.Conv2d::conv1 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer0/layer0.0/relu/Relu_output_0 : Float(*, 64, 56, 56, strides=[200704, 3136, 56, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer0/layer0.0/relu/Relu\"](%/layer0/layer0.0/conv1/Conv_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer0/__main__.BasicBlock::layer0.0/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer0/layer0.0/conv2/Conv_output_0 : Float(*, 64, 56, 56, strides=[200704, 3136, 56, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer0/layer0.0/conv2/Conv\"](%/layer0/layer0.0/relu/Relu_output_0, %onnx::Conv_399, %onnx::Conv_400), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer0/__main__.BasicBlock::layer0.0/torch.nn.modules.conv.Conv2d::conv2 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer0/layer0.0/Add_output_0 : Float(*, 64, 56, 56, strides=[200704, 3136, 56, 1], requires_grad=1, device=cpu) = onnx::Add[onnx_name=\"/layer0/layer0.0/Add\"](%/layer0/layer0.0/conv2/Conv_output_0, %/conv1/conv1.3/Relu_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer0/__main__.BasicBlock::layer0.0 # /tmp/ipykernel_34870/1263192908.py:23:0\n", " %/layer0/layer0.0/relu_1/Relu_output_0 : Float(*, 64, 56, 56, strides=[200704, 3136, 56, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer0/layer0.0/relu_1/Relu\"](%/layer0/layer0.0/Add_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer0/__main__.BasicBlock::layer0.0/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer0/layer0.1/conv1/Conv_output_0 : Float(*, 64, 56, 56, strides=[200704, 3136, 56, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer0/layer0.1/conv1/Conv\"](%/layer0/layer0.0/relu_1/Relu_output_0, %onnx::Conv_402, %onnx::Conv_403), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer0/__main__.BasicBlock::layer0.1/torch.nn.modules.conv.Conv2d::conv1 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer0/layer0.1/relu/Relu_output_0 : Float(*, 64, 56, 56, strides=[200704, 3136, 56, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer0/layer0.1/relu/Relu\"](%/layer0/layer0.1/conv1/Conv_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer0/__main__.BasicBlock::layer0.1/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer0/layer0.1/conv2/Conv_output_0 : Float(*, 64, 56, 56, strides=[200704, 3136, 56, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer0/layer0.1/conv2/Conv\"](%/layer0/layer0.1/relu/Relu_output_0, %onnx::Conv_405, %onnx::Conv_406), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer0/__main__.BasicBlock::layer0.1/torch.nn.modules.conv.Conv2d::conv2 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer0/layer0.1/Add_output_0 : Float(*, 64, 56, 56, strides=[200704, 3136, 56, 1], requires_grad=1, device=cpu) = onnx::Add[onnx_name=\"/layer0/layer0.1/Add\"](%/layer0/layer0.1/conv2/Conv_output_0, %/layer0/layer0.0/relu_1/Relu_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer0/__main__.BasicBlock::layer0.1 # /tmp/ipykernel_34870/1263192908.py:23:0\n", " %/layer0/layer0.1/relu_1/Relu_output_0 : Float(*, 64, 56, 56, strides=[200704, 3136, 56, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer0/layer0.1/relu_1/Relu\"](%/layer0/layer0.1/Add_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer0/__main__.BasicBlock::layer0.1/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer0/layer0.2/conv1/Conv_output_0 : Float(*, 64, 56, 56, strides=[200704, 3136, 56, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer0/layer0.2/conv1/Conv\"](%/layer0/layer0.1/relu_1/Relu_output_0, %onnx::Conv_408, %onnx::Conv_409), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer0/__main__.BasicBlock::layer0.2/torch.nn.modules.conv.Conv2d::conv1 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer0/layer0.2/relu/Relu_output_0 : Float(*, 64, 56, 56, strides=[200704, 3136, 56, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer0/layer0.2/relu/Relu\"](%/layer0/layer0.2/conv1/Conv_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer0/__main__.BasicBlock::layer0.2/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer0/layer0.2/conv2/Conv_output_0 : Float(*, 64, 56, 56, strides=[200704, 3136, 56, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer0/layer0.2/conv2/Conv\"](%/layer0/layer0.2/relu/Relu_output_0, %onnx::Conv_411, %onnx::Conv_412), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer0/__main__.BasicBlock::layer0.2/torch.nn.modules.conv.Conv2d::conv2 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer0/layer0.2/Add_output_0 : Float(*, 64, 56, 56, strides=[200704, 3136, 56, 1], requires_grad=1, device=cpu) = onnx::Add[onnx_name=\"/layer0/layer0.2/Add\"](%/layer0/layer0.2/conv2/Conv_output_0, %/layer0/layer0.1/relu_1/Relu_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer0/__main__.BasicBlock::layer0.2 # /tmp/ipykernel_34870/1263192908.py:23:0\n", " %/layer0/layer0.2/relu_1/Relu_output_0 : Float(*, 64, 56, 56, strides=[200704, 3136, 56, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer0/layer0.2/relu_1/Relu\"](%/layer0/layer0.2/Add_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer0/__main__.BasicBlock::layer0.2/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer1/layer1.0/conv1/Conv_output_0 : Float(*, 128, 28, 28, strides=[100352, 784, 28, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[2, 2], onnx_name=\"/layer1/layer1.0/conv1/Conv\"](%/layer0/layer0.2/relu_1/Relu_output_0, %onnx::Conv_414, %onnx::Conv_415), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer1/__main__.BasicBlock::layer1.0/torch.nn.modules.conv.Conv2d::conv1 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer1/layer1.0/relu/Relu_output_0 : Float(*, 128, 28, 28, strides=[100352, 784, 28, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer1/layer1.0/relu/Relu\"](%/layer1/layer1.0/conv1/Conv_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer1/__main__.BasicBlock::layer1.0/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer1/layer1.0/conv2/Conv_output_0 : Float(*, 128, 28, 28, strides=[100352, 784, 28, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer1/layer1.0/conv2/Conv\"](%/layer1/layer1.0/relu/Relu_output_0, %onnx::Conv_417, %onnx::Conv_418), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer1/__main__.BasicBlock::layer1.0/torch.nn.modules.conv.Conv2d::conv2 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer1/layer1.0/downsample/downsample.0/Conv_output_0 : Float(*, 128, 28, 28, strides=[100352, 784, 28, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[1, 1], pads=[0, 0, 0, 0], strides=[2, 2], onnx_name=\"/layer1/layer1.0/downsample/downsample.0/Conv\"](%/layer0/layer0.2/relu_1/Relu_output_0, %onnx::Conv_420, %onnx::Conv_421), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer1/__main__.BasicBlock::layer1.0/torch.nn.modules.container.Sequential::downsample/torch.nn.modules.conv.Conv2d::downsample.0 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer1/layer1.0/Add_output_0 : Float(*, 128, 28, 28, strides=[100352, 784, 28, 1], requires_grad=1, device=cpu) = onnx::Add[onnx_name=\"/layer1/layer1.0/Add\"](%/layer1/layer1.0/conv2/Conv_output_0, %/layer1/layer1.0/downsample/downsample.0/Conv_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer1/__main__.BasicBlock::layer1.0 # /tmp/ipykernel_34870/1263192908.py:23:0\n", " %/layer1/layer1.0/relu_1/Relu_output_0 : Float(*, 128, 28, 28, strides=[100352, 784, 28, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer1/layer1.0/relu_1/Relu\"](%/layer1/layer1.0/Add_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer1/__main__.BasicBlock::layer1.0/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer1/layer1.1/conv1/Conv_output_0 : Float(*, 128, 28, 28, strides=[100352, 784, 28, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer1/layer1.1/conv1/Conv\"](%/layer1/layer1.0/relu_1/Relu_output_0, %onnx::Conv_423, %onnx::Conv_424), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer1/__main__.BasicBlock::layer1.1/torch.nn.modules.conv.Conv2d::conv1 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer1/layer1.1/relu/Relu_output_0 : Float(*, 128, 28, 28, strides=[100352, 784, 28, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer1/layer1.1/relu/Relu\"](%/layer1/layer1.1/conv1/Conv_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer1/__main__.BasicBlock::layer1.1/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer1/layer1.1/conv2/Conv_output_0 : Float(*, 128, 28, 28, strides=[100352, 784, 28, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer1/layer1.1/conv2/Conv\"](%/layer1/layer1.1/relu/Relu_output_0, %onnx::Conv_426, %onnx::Conv_427), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer1/__main__.BasicBlock::layer1.1/torch.nn.modules.conv.Conv2d::conv2 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer1/layer1.1/Add_output_0 : Float(*, 128, 28, 28, strides=[100352, 784, 28, 1], requires_grad=1, device=cpu) = onnx::Add[onnx_name=\"/layer1/layer1.1/Add\"](%/layer1/layer1.1/conv2/Conv_output_0, %/layer1/layer1.0/relu_1/Relu_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer1/__main__.BasicBlock::layer1.1 # /tmp/ipykernel_34870/1263192908.py:23:0\n", " %/layer1/layer1.1/relu_1/Relu_output_0 : Float(*, 128, 28, 28, strides=[100352, 784, 28, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer1/layer1.1/relu_1/Relu\"](%/layer1/layer1.1/Add_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer1/__main__.BasicBlock::layer1.1/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer1/layer1.2/conv1/Conv_output_0 : Float(*, 128, 28, 28, strides=[100352, 784, 28, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer1/layer1.2/conv1/Conv\"](%/layer1/layer1.1/relu_1/Relu_output_0, %onnx::Conv_429, %onnx::Conv_430), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer1/__main__.BasicBlock::layer1.2/torch.nn.modules.conv.Conv2d::conv1 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer1/layer1.2/relu/Relu_output_0 : Float(*, 128, 28, 28, strides=[100352, 784, 28, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer1/layer1.2/relu/Relu\"](%/layer1/layer1.2/conv1/Conv_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer1/__main__.BasicBlock::layer1.2/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer1/layer1.2/conv2/Conv_output_0 : Float(*, 128, 28, 28, strides=[100352, 784, 28, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer1/layer1.2/conv2/Conv\"](%/layer1/layer1.2/relu/Relu_output_0, %onnx::Conv_432, %onnx::Conv_433), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer1/__main__.BasicBlock::layer1.2/torch.nn.modules.conv.Conv2d::conv2 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer1/layer1.2/Add_output_0 : Float(*, 128, 28, 28, strides=[100352, 784, 28, 1], requires_grad=1, device=cpu) = onnx::Add[onnx_name=\"/layer1/layer1.2/Add\"](%/layer1/layer1.2/conv2/Conv_output_0, %/layer1/layer1.1/relu_1/Relu_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer1/__main__.BasicBlock::layer1.2 # /tmp/ipykernel_34870/1263192908.py:23:0\n", " %/layer1/layer1.2/relu_1/Relu_output_0 : Float(*, 128, 28, 28, strides=[100352, 784, 28, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer1/layer1.2/relu_1/Relu\"](%/layer1/layer1.2/Add_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer1/__main__.BasicBlock::layer1.2/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer1/layer1.3/conv1/Conv_output_0 : Float(*, 128, 28, 28, strides=[100352, 784, 28, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer1/layer1.3/conv1/Conv\"](%/layer1/layer1.2/relu_1/Relu_output_0, %onnx::Conv_435, %onnx::Conv_436), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer1/__main__.BasicBlock::layer1.3/torch.nn.modules.conv.Conv2d::conv1 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer1/layer1.3/relu/Relu_output_0 : Float(*, 128, 28, 28, strides=[100352, 784, 28, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer1/layer1.3/relu/Relu\"](%/layer1/layer1.3/conv1/Conv_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer1/__main__.BasicBlock::layer1.3/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer1/layer1.3/conv2/Conv_output_0 : Float(*, 128, 28, 28, strides=[100352, 784, 28, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer1/layer1.3/conv2/Conv\"](%/layer1/layer1.3/relu/Relu_output_0, %onnx::Conv_438, %onnx::Conv_439), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer1/__main__.BasicBlock::layer1.3/torch.nn.modules.conv.Conv2d::conv2 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer1/layer1.3/Add_output_0 : Float(*, 128, 28, 28, strides=[100352, 784, 28, 1], requires_grad=1, device=cpu) = onnx::Add[onnx_name=\"/layer1/layer1.3/Add\"](%/layer1/layer1.3/conv2/Conv_output_0, %/layer1/layer1.2/relu_1/Relu_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer1/__main__.BasicBlock::layer1.3 # /tmp/ipykernel_34870/1263192908.py:23:0\n", " %/layer1/layer1.3/relu_1/Relu_output_0 : Float(*, 128, 28, 28, strides=[100352, 784, 28, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer1/layer1.3/relu_1/Relu\"](%/layer1/layer1.3/Add_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer1/__main__.BasicBlock::layer1.3/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer2/layer2.0/conv1/Conv_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[2, 2], onnx_name=\"/layer2/layer2.0/conv1/Conv\"](%/layer1/layer1.3/relu_1/Relu_output_0, %onnx::Conv_441, %onnx::Conv_442), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.0/torch.nn.modules.conv.Conv2d::conv1 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer2/layer2.0/relu/Relu_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer2/layer2.0/relu/Relu\"](%/layer2/layer2.0/conv1/Conv_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.0/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer2/layer2.0/conv2/Conv_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer2/layer2.0/conv2/Conv\"](%/layer2/layer2.0/relu/Relu_output_0, %onnx::Conv_444, %onnx::Conv_445), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.0/torch.nn.modules.conv.Conv2d::conv2 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer2/layer2.0/downsample/downsample.0/Conv_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[1, 1], pads=[0, 0, 0, 0], strides=[2, 2], onnx_name=\"/layer2/layer2.0/downsample/downsample.0/Conv\"](%/layer1/layer1.3/relu_1/Relu_output_0, %onnx::Conv_447, %onnx::Conv_448), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.0/torch.nn.modules.container.Sequential::downsample/torch.nn.modules.conv.Conv2d::downsample.0 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer2/layer2.0/Add_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Add[onnx_name=\"/layer2/layer2.0/Add\"](%/layer2/layer2.0/conv2/Conv_output_0, %/layer2/layer2.0/downsample/downsample.0/Conv_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.0 # /tmp/ipykernel_34870/1263192908.py:23:0\n", " %/layer2/layer2.0/relu_1/Relu_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer2/layer2.0/relu_1/Relu\"](%/layer2/layer2.0/Add_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.0/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer2/layer2.1/conv1/Conv_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer2/layer2.1/conv1/Conv\"](%/layer2/layer2.0/relu_1/Relu_output_0, %onnx::Conv_450, %onnx::Conv_451), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.1/torch.nn.modules.conv.Conv2d::conv1 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer2/layer2.1/relu/Relu_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer2/layer2.1/relu/Relu\"](%/layer2/layer2.1/conv1/Conv_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.1/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer2/layer2.1/conv2/Conv_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer2/layer2.1/conv2/Conv\"](%/layer2/layer2.1/relu/Relu_output_0, %onnx::Conv_453, %onnx::Conv_454), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.1/torch.nn.modules.conv.Conv2d::conv2 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer2/layer2.1/Add_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Add[onnx_name=\"/layer2/layer2.1/Add\"](%/layer2/layer2.1/conv2/Conv_output_0, %/layer2/layer2.0/relu_1/Relu_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.1 # /tmp/ipykernel_34870/1263192908.py:23:0\n", " %/layer2/layer2.1/relu_1/Relu_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer2/layer2.1/relu_1/Relu\"](%/layer2/layer2.1/Add_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.1/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer2/layer2.2/conv1/Conv_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer2/layer2.2/conv1/Conv\"](%/layer2/layer2.1/relu_1/Relu_output_0, %onnx::Conv_456, %onnx::Conv_457), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.2/torch.nn.modules.conv.Conv2d::conv1 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer2/layer2.2/relu/Relu_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer2/layer2.2/relu/Relu\"](%/layer2/layer2.2/conv1/Conv_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.2/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer2/layer2.2/conv2/Conv_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer2/layer2.2/conv2/Conv\"](%/layer2/layer2.2/relu/Relu_output_0, %onnx::Conv_459, %onnx::Conv_460), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.2/torch.nn.modules.conv.Conv2d::conv2 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer2/layer2.2/Add_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Add[onnx_name=\"/layer2/layer2.2/Add\"](%/layer2/layer2.2/conv2/Conv_output_0, %/layer2/layer2.1/relu_1/Relu_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.2 # /tmp/ipykernel_34870/1263192908.py:23:0\n", " %/layer2/layer2.2/relu_1/Relu_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer2/layer2.2/relu_1/Relu\"](%/layer2/layer2.2/Add_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.2/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer2/layer2.3/conv1/Conv_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer2/layer2.3/conv1/Conv\"](%/layer2/layer2.2/relu_1/Relu_output_0, %onnx::Conv_462, %onnx::Conv_463), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.3/torch.nn.modules.conv.Conv2d::conv1 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer2/layer2.3/relu/Relu_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer2/layer2.3/relu/Relu\"](%/layer2/layer2.3/conv1/Conv_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.3/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer2/layer2.3/conv2/Conv_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer2/layer2.3/conv2/Conv\"](%/layer2/layer2.3/relu/Relu_output_0, %onnx::Conv_465, %onnx::Conv_466), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.3/torch.nn.modules.conv.Conv2d::conv2 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer2/layer2.3/Add_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Add[onnx_name=\"/layer2/layer2.3/Add\"](%/layer2/layer2.3/conv2/Conv_output_0, %/layer2/layer2.2/relu_1/Relu_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.3 # /tmp/ipykernel_34870/1263192908.py:23:0\n", " %/layer2/layer2.3/relu_1/Relu_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer2/layer2.3/relu_1/Relu\"](%/layer2/layer2.3/Add_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.3/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer2/layer2.4/conv1/Conv_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer2/layer2.4/conv1/Conv\"](%/layer2/layer2.3/relu_1/Relu_output_0, %onnx::Conv_468, %onnx::Conv_469), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.4/torch.nn.modules.conv.Conv2d::conv1 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer2/layer2.4/relu/Relu_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer2/layer2.4/relu/Relu\"](%/layer2/layer2.4/conv1/Conv_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.4/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer2/layer2.4/conv2/Conv_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer2/layer2.4/conv2/Conv\"](%/layer2/layer2.4/relu/Relu_output_0, %onnx::Conv_471, %onnx::Conv_472), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.4/torch.nn.modules.conv.Conv2d::conv2 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer2/layer2.4/Add_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Add[onnx_name=\"/layer2/layer2.4/Add\"](%/layer2/layer2.4/conv2/Conv_output_0, %/layer2/layer2.3/relu_1/Relu_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.4 # /tmp/ipykernel_34870/1263192908.py:23:0\n", " %/layer2/layer2.4/relu_1/Relu_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer2/layer2.4/relu_1/Relu\"](%/layer2/layer2.4/Add_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.4/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer2/layer2.5/conv1/Conv_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer2/layer2.5/conv1/Conv\"](%/layer2/layer2.4/relu_1/Relu_output_0, %onnx::Conv_474, %onnx::Conv_475), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.5/torch.nn.modules.conv.Conv2d::conv1 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer2/layer2.5/relu/Relu_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer2/layer2.5/relu/Relu\"](%/layer2/layer2.5/conv1/Conv_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.5/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer2/layer2.5/conv2/Conv_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer2/layer2.5/conv2/Conv\"](%/layer2/layer2.5/relu/Relu_output_0, %onnx::Conv_477, %onnx::Conv_478), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.5/torch.nn.modules.conv.Conv2d::conv2 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer2/layer2.5/Add_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Add[onnx_name=\"/layer2/layer2.5/Add\"](%/layer2/layer2.5/conv2/Conv_output_0, %/layer2/layer2.4/relu_1/Relu_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.5 # /tmp/ipykernel_34870/1263192908.py:23:0\n", " %/layer2/layer2.5/relu_1/Relu_output_0 : Float(*, 256, 14, 14, strides=[50176, 196, 14, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer2/layer2.5/relu_1/Relu\"](%/layer2/layer2.5/Add_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer2/__main__.BasicBlock::layer2.5/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer3/layer3.0/conv1/Conv_output_0 : Float(*, 512, 7, 7, strides=[25088, 49, 7, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[2, 2], onnx_name=\"/layer3/layer3.0/conv1/Conv\"](%/layer2/layer2.5/relu_1/Relu_output_0, %onnx::Conv_480, %onnx::Conv_481), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer3/__main__.BasicBlock::layer3.0/torch.nn.modules.conv.Conv2d::conv1 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer3/layer3.0/relu/Relu_output_0 : Float(*, 512, 7, 7, strides=[25088, 49, 7, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer3/layer3.0/relu/Relu\"](%/layer3/layer3.0/conv1/Conv_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer3/__main__.BasicBlock::layer3.0/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer3/layer3.0/conv2/Conv_output_0 : Float(*, 512, 7, 7, strides=[25088, 49, 7, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer3/layer3.0/conv2/Conv\"](%/layer3/layer3.0/relu/Relu_output_0, %onnx::Conv_483, %onnx::Conv_484), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer3/__main__.BasicBlock::layer3.0/torch.nn.modules.conv.Conv2d::conv2 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer3/layer3.0/downsample/downsample.0/Conv_output_0 : Float(*, 512, 7, 7, strides=[25088, 49, 7, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[1, 1], pads=[0, 0, 0, 0], strides=[2, 2], onnx_name=\"/layer3/layer3.0/downsample/downsample.0/Conv\"](%/layer2/layer2.5/relu_1/Relu_output_0, %onnx::Conv_486, %onnx::Conv_487), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer3/__main__.BasicBlock::layer3.0/torch.nn.modules.container.Sequential::downsample/torch.nn.modules.conv.Conv2d::downsample.0 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer3/layer3.0/Add_output_0 : Float(*, 512, 7, 7, strides=[25088, 49, 7, 1], requires_grad=1, device=cpu) = onnx::Add[onnx_name=\"/layer3/layer3.0/Add\"](%/layer3/layer3.0/conv2/Conv_output_0, %/layer3/layer3.0/downsample/downsample.0/Conv_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer3/__main__.BasicBlock::layer3.0 # /tmp/ipykernel_34870/1263192908.py:23:0\n", " %/layer3/layer3.0/relu_1/Relu_output_0 : Float(*, 512, 7, 7, strides=[25088, 49, 7, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer3/layer3.0/relu_1/Relu\"](%/layer3/layer3.0/Add_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer3/__main__.BasicBlock::layer3.0/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer3/layer3.1/conv1/Conv_output_0 : Float(*, 512, 7, 7, strides=[25088, 49, 7, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer3/layer3.1/conv1/Conv\"](%/layer3/layer3.0/relu_1/Relu_output_0, %onnx::Conv_489, %onnx::Conv_490), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer3/__main__.BasicBlock::layer3.1/torch.nn.modules.conv.Conv2d::conv1 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer3/layer3.1/relu/Relu_output_0 : Float(*, 512, 7, 7, strides=[25088, 49, 7, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer3/layer3.1/relu/Relu\"](%/layer3/layer3.1/conv1/Conv_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer3/__main__.BasicBlock::layer3.1/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer3/layer3.1/conv2/Conv_output_0 : Float(*, 512, 7, 7, strides=[25088, 49, 7, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer3/layer3.1/conv2/Conv\"](%/layer3/layer3.1/relu/Relu_output_0, %onnx::Conv_492, %onnx::Conv_493), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer3/__main__.BasicBlock::layer3.1/torch.nn.modules.conv.Conv2d::conv2 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer3/layer3.1/Add_output_0 : Float(*, 512, 7, 7, strides=[25088, 49, 7, 1], requires_grad=1, device=cpu) = onnx::Add[onnx_name=\"/layer3/layer3.1/Add\"](%/layer3/layer3.1/conv2/Conv_output_0, %/layer3/layer3.0/relu_1/Relu_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer3/__main__.BasicBlock::layer3.1 # /tmp/ipykernel_34870/1263192908.py:23:0\n", " %/layer3/layer3.1/relu_1/Relu_output_0 : Float(*, 512, 7, 7, strides=[25088, 49, 7, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer3/layer3.1/relu_1/Relu\"](%/layer3/layer3.1/Add_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer3/__main__.BasicBlock::layer3.1/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer3/layer3.2/conv1/Conv_output_0 : Float(*, 512, 7, 7, strides=[25088, 49, 7, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer3/layer3.2/conv1/Conv\"](%/layer3/layer3.1/relu_1/Relu_output_0, %onnx::Conv_495, %onnx::Conv_496), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer3/__main__.BasicBlock::layer3.2/torch.nn.modules.conv.Conv2d::conv1 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer3/layer3.2/relu/Relu_output_0 : Float(*, 512, 7, 7, strides=[25088, 49, 7, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer3/layer3.2/relu/Relu\"](%/layer3/layer3.2/conv1/Conv_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer3/__main__.BasicBlock::layer3.2/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/layer3/layer3.2/conv2/Conv_output_0 : Float(*, 512, 7, 7, strides=[25088, 49, 7, 1], requires_grad=1, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[3, 3], pads=[1, 1, 1, 1], strides=[1, 1], onnx_name=\"/layer3/layer3.2/conv2/Conv\"](%/layer3/layer3.2/relu/Relu_output_0, %onnx::Conv_498, %onnx::Conv_499), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer3/__main__.BasicBlock::layer3.2/torch.nn.modules.conv.Conv2d::conv2 # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py:458:0\n", " %/layer3/layer3.2/Add_output_0 : Float(*, 512, 7, 7, strides=[25088, 49, 7, 1], requires_grad=1, device=cpu) = onnx::Add[onnx_name=\"/layer3/layer3.2/Add\"](%/layer3/layer3.2/conv2/Conv_output_0, %/layer3/layer3.1/relu_1/Relu_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer3/__main__.BasicBlock::layer3.2 # /tmp/ipykernel_34870/1263192908.py:23:0\n", " %/layer3/layer3.2/relu_1/Relu_output_0 : Float(*, 512, 7, 7, strides=[25088, 49, 7, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name=\"/layer3/layer3.2/relu_1/Relu\"](%/layer3/layer3.2/Add_output_0), scope: __main__.ResNet34::/torch.nn.modules.container.Sequential::layer3/__main__.BasicBlock::layer3.2/torch.nn.modules.activation.ReLU::relu # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1453:0\n", " %/avg_pool/Constant_output_0 : Long(8, strides=[1], device=cpu) = onnx::Constant[value= 0 0 0 0 0 0 0 0 [ CPULongType{8} ], onnx_name=\"/avg_pool/Constant\"](), scope: __main__.ResNet34::/torch.nn.modules.pooling.AvgPool2d::avg_pool # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/pooling.py:628:0\n", " %/avg_pool/Pad_output_0 : Float(*, 512, 7, 7, device=cpu) = onnx::Pad[mode=\"constant\", onnx_name=\"/avg_pool/Pad\"](%/layer3/layer3.2/relu_1/Relu_output_0, %/avg_pool/Constant_output_0), scope: __main__.ResNet34::/torch.nn.modules.pooling.AvgPool2d::avg_pool # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/pooling.py:628:0\n", " %/avg_pool/AveragePool_output_0 : Float(*, 512, 1, 1, strides=[512, 1, 1, 1], requires_grad=1, device=cpu) = onnx::AveragePool[ceil_mode=0, kernel_shape=[7, 7], pads=[0, 0, 0, 0], strides=[7, 7], onnx_name=\"/avg_pool/AveragePool\"](%/avg_pool/Pad_output_0), scope: __main__.ResNet34::/torch.nn.modules.pooling.AvgPool2d::avg_pool # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/pooling.py:628:0\n", " %/Shape_output_0 : Long(4, strides=[1], device=cpu) = onnx::Shape[onnx_name=\"/Shape\"](%/avg_pool/AveragePool_output_0), scope: __main__.ResNet34:: # /tmp/ipykernel_34870/1263192908.py:62:0\n", " %/Constant_output_0 : Long(device=cpu) = onnx::Constant[value={0}, onnx_name=\"/Constant\"](), scope: __main__.ResNet34:: # /tmp/ipykernel_34870/1263192908.py:62:0\n", " %/Gather_output_0 : Long(device=cpu) = onnx::Gather[axis=0, onnx_name=\"/Gather\"](%/Shape_output_0, %/Constant_output_0), scope: __main__.ResNet34:: # /tmp/ipykernel_34870/1263192908.py:62:0\n", " %onnx::Unsqueeze_384 : Long(1, strides=[1], device=cpu) = onnx::Constant[value={0}]()\n", " %/Unsqueeze_output_0 : Long(1, strides=[1], device=cpu) = onnx::Unsqueeze[onnx_name=\"/Unsqueeze\"](%/Gather_output_0, %onnx::Unsqueeze_384), scope: __main__.ResNet34::\n", " %/Constant_1_output_0 : Long(1, strides=[1], requires_grad=0, device=cpu) = onnx::Constant[value={-1}, onnx_name=\"/Constant_1\"](), scope: __main__.ResNet34::\n", " %/Concat_output_0 : Long(2, strides=[1], device=cpu) = onnx::Concat[axis=0, onnx_name=\"/Concat\"](%/Unsqueeze_output_0, %/Constant_1_output_0), scope: __main__.ResNet34:: # /tmp/ipykernel_34870/1263192908.py:62:0\n", " %/Reshape_output_0 : Float(*, 512, strides=[512, 1], requires_grad=1, device=cpu) = onnx::Reshape[allowzero=0, onnx_name=\"/Reshape\"](%/avg_pool/AveragePool_output_0, %/Concat_output_0), scope: __main__.ResNet34:: # /tmp/ipykernel_34870/1263192908.py:62:0\n", " %/fc/Gemm_output_0 : Float(*, 450, strides=[450, 1], requires_grad=1, device=cpu) = onnx::Gemm[alpha=1., beta=1., transB=1, onnx_name=\"/fc/Gemm\"](%/Reshape_output_0, %fc.weight, %fc.bias), scope: __main__.ResNet34::/torch.nn.modules.linear.Linear::fc # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/modules/linear.py:114:0\n", " %output : Float(*, 450, strides=[450, 1], requires_grad=1, device=cpu) = onnx::LogSoftmax[axis=1, onnx_name=\"/LogSoftmax\"](%/fc/Gemm_output_0), scope: __main__.ResNet34:: # /home/gautham/.local/lib/python3.10/site-packages/torch/nn/functional.py:1927:0\n", " return (%output)\n", "\n" ] } ], "source": [ "onnx_path = '../model/model.onnx'\n", "\n", "torch.onnx.export(model,\n", " dummy_input,\n", " onnx_path,\n", " verbose=True,\n", " input_names = ['input'], # the model's input names\n", " output_names = ['output'], # the model's output names\n", " dynamic_axes={'input' : {0 : 'batch_size'}, # variable length axes\n", " 'output' : {0 : 'batch_size'}})" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Verifying the ONNX model" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "import onnx\n", "\n", "onnx_model = onnx.load(onnx_path)\n", "onnx.checker.check_model(onnx_model)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Comparing ONNX Runtime and PyTorch results" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Exported model has been tested with ONNXRuntime, and the result looks good!\n" ] } ], "source": [ "import onnxruntime\n", "import numpy as np\n", "\n", "ort_session = onnxruntime.InferenceSession(onnx_path)\n", "\n", "def to_numpy(tensor):\n", " return tensor.detach().cpu().numpy() if tensor.requires_grad else tensor.cpu().numpy()\n", "\n", "ort_inputs = {ort_session.get_inputs()[0].name: to_numpy(dummy_input)}\n", "ort_outs = ort_session.run(None, ort_inputs)\n", "\n", "np.testing.assert_allclose(to_numpy(torch_out), ort_outs[0], rtol=1e-03, atol=1e-05)\n", "\n", "print(\"Exported model has been tested with ONNXRuntime, and the result looks good!\")\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3.10.6 64-bit", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.6" }, "orig_nbformat": 4, "vscode": { "interpreter": { "hash": "916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1" } } }, "nbformat": 4, "nbformat_minor": 2 }