Backend CUDA example#

This tutorial provides a step-by-step guide on performing inference with the LeNet model using Aidge Backend CUDA. Using randomly generated data as input, we will demonstrate how to pass data through the model and observe its predictions. For the sake of simplicity, we will not train the model. Feel free to replace the onnx model with one already trained.

  • Besides Aidge modules, the required libraries for this tutorial are Numpy and PyTorch (optional if you want to load your own model):

Note: This notebook is not intended to be executed on Binder, as it requires a GPU-enabled environment with compatible CUDA drivers.

[1]:
%pip install aidge-core \
    aidge-backend-cpu \
    aidge-onnx \
    aidge-backend-cuda

%pip install numpy
%pip install torch
Requirement already satisfied: aidge-core in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (0.7.0)
Requirement already satisfied: aidge-backend-cpu in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (0.7.0)
Requirement already satisfied: aidge-onnx in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (0.6.0)
Requirement already satisfied: aidge-backend-cuda in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (0.7.0)
Requirement already satisfied: numpy>=1.21.6 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from aidge-core) (2.0.2)
Requirement already satisfied: Jinja2>=3.1.2 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from aidge-core) (3.1.4)
Requirement already satisfied: matplotlib in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from aidge-core) (3.9.2)
Requirement already satisfied: tqdm in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from aidge-core) (4.67.1)
Requirement already satisfied: requests in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from aidge-core) (2.32.3)
Requirement already satisfied: rich in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from aidge-core) (13.9.4)
Requirement already satisfied: onnx>=1.16.0 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from aidge-onnx) (1.17.0)
Requirement already satisfied: colorama in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from aidge-onnx) (0.4.6)
Requirement already satisfied: typing_extensions in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from aidge-onnx) (4.12.2)
Requirement already satisfied: MarkupSafe>=2.0 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from Jinja2>=3.1.2->aidge-core) (2.1.5)
Requirement already satisfied: protobuf>=3.20.2 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from onnx>=1.16.0->aidge-onnx) (3.20.3)
Requirement already satisfied: contourpy>=1.0.1 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from matplotlib->aidge-core) (1.3.0)
Requirement already satisfied: cycler>=0.10 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from matplotlib->aidge-core) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from matplotlib->aidge-core) (4.54.1)
Requirement already satisfied: kiwisolver>=1.3.1 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from matplotlib->aidge-core) (1.4.7)
Requirement already satisfied: packaging>=20.0 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from matplotlib->aidge-core) (24.1)
Requirement already satisfied: pillow>=8 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from matplotlib->aidge-core) (10.4.0)
Requirement already satisfied: pyparsing>=2.3.1 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from matplotlib->aidge-core) (3.1.4)
Requirement already satisfied: python-dateutil>=2.7 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from matplotlib->aidge-core) (2.9.0.post0)
Requirement already satisfied: six>=1.5 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from python-dateutil>=2.7->matplotlib->aidge-core) (1.16.0)
Requirement already satisfied: charset-normalizer<4,>=2 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from requests->aidge-core) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from requests->aidge-core) (3.10)
Requirement already satisfied: urllib3<3,>=1.21.1 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from requests->aidge-core) (2.2.3)
Requirement already satisfied: certifi>=2017.4.17 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from requests->aidge-core) (2024.8.30)
Requirement already satisfied: markdown-it-py>=2.2.0 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from rich->aidge-core) (3.0.0)
Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from rich->aidge-core) (2.18.0)
Requirement already satisfied: mdurl~=0.1 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from markdown-it-py>=2.2.0->rich->aidge-core) (0.1.2)
Note: you may need to restart the kernel to use updated packages.
Requirement already satisfied: numpy in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (2.0.2)
Note: you may need to restart the kernel to use updated packages.
Requirement already satisfied: torch in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (2.5.1)
Requirement already satisfied: filelock in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from torch) (3.16.1)
Requirement already satisfied: typing-extensions>=4.8.0 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from torch) (4.12.2)
Requirement already satisfied: networkx in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from torch) (3.4.2)
Requirement already satisfied: jinja2 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from torch) (3.1.4)
Requirement already satisfied: fsspec in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from torch) (2024.10.0)
Requirement already satisfied: nvidia-cuda-nvrtc-cu12==12.4.127 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from torch) (12.4.127)
Requirement already satisfied: nvidia-cuda-runtime-cu12==12.4.127 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from torch) (12.4.127)
Requirement already satisfied: nvidia-cuda-cupti-cu12==12.4.127 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from torch) (12.4.127)
Requirement already satisfied: nvidia-cudnn-cu12==9.1.0.70 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from torch) (9.1.0.70)
Requirement already satisfied: nvidia-cublas-cu12==12.4.5.8 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from torch) (12.4.5.8)
Requirement already satisfied: nvidia-cufft-cu12==11.2.1.3 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from torch) (11.2.1.3)
Requirement already satisfied: nvidia-curand-cu12==10.3.5.147 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from torch) (10.3.5.147)
Requirement already satisfied: nvidia-cusolver-cu12==11.6.1.9 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from torch) (11.6.1.9)
Requirement already satisfied: nvidia-cusparse-cu12==12.3.1.170 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from torch) (12.3.1.170)
Requirement already satisfied: nvidia-nccl-cu12==2.21.5 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from torch) (2.21.5)
Requirement already satisfied: nvidia-nvtx-cu12==12.4.127 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from torch) (12.4.127)
Requirement already satisfied: nvidia-nvjitlink-cu12==12.4.127 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from torch) (12.4.127)
Requirement already satisfied: triton==3.1.0 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from torch) (3.1.0)
Requirement already satisfied: setuptools in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from torch) (78.1.0)
Requirement already satisfied: sympy==1.13.1 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from torch) (1.13.1)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from sympy==1.13.1->torch) (1.3.0)
Requirement already satisfied: MarkupSafe>=2.0 in /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages (from jinja2->torch) (2.1.5)
Note: you may need to restart the kernel to use updated packages.
  • We start by creating a LeNet model:

[2]:
import torch
import torch.nn as nn
import torch.onnx

class LeNet(nn.Module):
    def __init__(self, num_classes):
        super(LeNet, self).__init__()
        self.conv1 = nn.Conv2d(1, 6, kernel_size=5)
        self.conv2 = nn.Conv2d(6, 16, kernel_size=5)
        self.fc1 = nn.Linear(16 * 4 * 4, 120)
        self.fc2 = nn.Linear(120, 84)
        self.fc3 = nn.Linear(84, num_classes)

    def forward(self, x):
        x = torch.relu(self.conv1(x))
        x = torch.max_pool2d(x, kernel_size=2, stride=2)
        x = torch.relu(self.conv2(x))
        x = torch.max_pool2d(x, kernel_size=2, stride=2)
        x = x.view(-1, 16 * 4 * 4)
        x = torch.relu(self.fc1(x))
        x = torch.relu(self.fc2(x))
        x = self.fc3(x)
        return x

# Instantiate the model
num_classes = 10  # Assuming you're working with MNIST dataset
model = LeNet(num_classes)

# Set the model to evaluation mode
model.eval()

# Example input shape (batch_size, channels, height, width)
dummy_input = torch.randn(1, 1, 28, 28)

# Export the model to ONNX
torch.onnx.export(model, dummy_input, "lenet.onnx", verbose=True)
Exported graph: graph(%input.1 : Float(1, 1, 28, 28, strides=[784, 784, 28, 1], requires_grad=0, device=cpu),
      %conv1.weight : Float(6, 1, 5, 5, strides=[25, 25, 5, 1], requires_grad=1, device=cpu),
      %conv1.bias : Float(6, strides=[1], requires_grad=1, device=cpu),
      %conv2.weight : Float(16, 6, 5, 5, strides=[150, 25, 5, 1], requires_grad=1, device=cpu),
      %conv2.bias : Float(16, strides=[1], requires_grad=1, device=cpu),
      %fc1.weight : Float(120, 256, strides=[256, 1], requires_grad=1, device=cpu),
      %fc1.bias : Float(120, strides=[1], requires_grad=1, device=cpu),
      %fc2.weight : Float(84, 120, strides=[120, 1], requires_grad=1, device=cpu),
      %fc2.bias : Float(84, strides=[1], requires_grad=1, device=cpu),
      %fc3.weight : Float(10, 84, strides=[84, 1], requires_grad=1, device=cpu),
      %fc3.bias : Float(10, strides=[1], requires_grad=1, device=cpu)):
  %/conv1/Conv_output_0 : Float(1, 6, 24, 24, strides=[3456, 576, 24, 1], requires_grad=0, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[5, 5], pads=[0, 0, 0, 0], strides=[1, 1], onnx_name="/conv1/Conv"](%input.1, %conv1.weight, %conv1.bias), scope: __main__.LeNet::/torch.nn.modules.conv.Conv2d::conv1 # /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages/torch/nn/modules/conv.py:549:0
  %/Relu_output_0 : Float(1, 6, 24, 24, strides=[3456, 576, 24, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name="/Relu"](%/conv1/Conv_output_0), scope: __main__.LeNet:: # /tmp/ipykernel_1633197/3325474537.py:15:0
  %/MaxPool_output_0 : Float(1, 6, 12, 12, strides=[864, 144, 12, 1], requires_grad=1, device=cpu) = onnx::MaxPool[ceil_mode=0, dilations=[1, 1], kernel_shape=[2, 2], pads=[0, 0, 0, 0], strides=[2, 2], onnx_name="/MaxPool"](%/Relu_output_0), scope: __main__.LeNet:: # /tmp/ipykernel_1633197/3325474537.py:16:0
  %/conv2/Conv_output_0 : Float(1, 16, 8, 8, strides=[1024, 64, 8, 1], requires_grad=0, device=cpu) = onnx::Conv[dilations=[1, 1], group=1, kernel_shape=[5, 5], pads=[0, 0, 0, 0], strides=[1, 1], onnx_name="/conv2/Conv"](%/MaxPool_output_0, %conv2.weight, %conv2.bias), scope: __main__.LeNet::/torch.nn.modules.conv.Conv2d::conv2 # /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages/torch/nn/modules/conv.py:549:0
  %/Relu_1_output_0 : Float(1, 16, 8, 8, strides=[1024, 64, 8, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name="/Relu_1"](%/conv2/Conv_output_0), scope: __main__.LeNet:: # /tmp/ipykernel_1633197/3325474537.py:17:0
  %/MaxPool_1_output_0 : Float(1, 16, 4, 4, strides=[256, 16, 4, 1], requires_grad=1, device=cpu) = onnx::MaxPool[ceil_mode=0, dilations=[1, 1], kernel_shape=[2, 2], pads=[0, 0, 0, 0], strides=[2, 2], onnx_name="/MaxPool_1"](%/Relu_1_output_0), scope: __main__.LeNet:: # /tmp/ipykernel_1633197/3325474537.py:18:0
  %/Constant_output_0 : Long(2, strides=[1], device=cpu) = onnx::Constant[value=  -1  256 [ CPULongType{2} ], onnx_name="/Constant"](), scope: __main__.LeNet:: # /tmp/ipykernel_1633197/3325474537.py:19:0
  %/Reshape_output_0 : Float(1, 256, strides=[256, 1], requires_grad=1, device=cpu) = onnx::Reshape[allowzero=0, onnx_name="/Reshape"](%/MaxPool_1_output_0, %/Constant_output_0), scope: __main__.LeNet:: # /tmp/ipykernel_1633197/3325474537.py:19:0
  %/fc1/Gemm_output_0 : Float(1, 120, strides=[120, 1], requires_grad=1, device=cpu) = onnx::Gemm[alpha=1., beta=1., transB=1, onnx_name="/fc1/Gemm"](%/Reshape_output_0, %fc1.weight, %fc1.bias), scope: __main__.LeNet::/torch.nn.modules.linear.Linear::fc1 # /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages/torch/nn/modules/linear.py:125:0
  %/Relu_2_output_0 : Float(1, 120, strides=[120, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name="/Relu_2"](%/fc1/Gemm_output_0), scope: __main__.LeNet:: # /tmp/ipykernel_1633197/3325474537.py:20:0
  %/fc2/Gemm_output_0 : Float(1, 84, strides=[84, 1], requires_grad=1, device=cpu) = onnx::Gemm[alpha=1., beta=1., transB=1, onnx_name="/fc2/Gemm"](%/Relu_2_output_0, %fc2.weight, %fc2.bias), scope: __main__.LeNet::/torch.nn.modules.linear.Linear::fc2 # /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages/torch/nn/modules/linear.py:125:0
  %/Relu_3_output_0 : Float(1, 84, strides=[84, 1], requires_grad=1, device=cpu) = onnx::Relu[onnx_name="/Relu_3"](%/fc2/Gemm_output_0), scope: __main__.LeNet:: # /tmp/ipykernel_1633197/3325474537.py:21:0
  %23 : Float(1, 10, strides=[10, 1], requires_grad=1, device=cpu) = onnx::Gemm[alpha=1., beta=1., transB=1, onnx_name="/fc3/Gemm"](%/Relu_3_output_0, %fc3.weight, %fc3.bias), scope: __main__.LeNet::/torch.nn.modules.linear.Linear::fc3 # /data1/is156025/cm264821/miniforge3/envs/aidge/lib/python3.12/site-packages/torch/nn/modules/linear.py:125:0
  return (%23)

  • import the needed libraries

[3]:
import aidge_core
import aidge_backend_cuda
import aidge_onnx
import numpy as np
  • load onnx model on Aidge

[4]:
model = aidge_onnx.load_onnx("lenet.onnx")
aidge_core.remove_flatten(model)

# Configure the model
model.set_datatype(aidge_core.dtype.float32)
model.set_backend("cuda")
[INFO] - Loading ONNX lenet.onnx
[INFO] - ONNX metadata:
[INFO]        - Producer name: pytorch
[INFO]        - Producer version: 2.5.1
[INFO]        - Opset max version: 17
[INFO] - Constructing DFG...
[INFO] - Processing Initializers...
[INFO] - Processing Nodes...
[INFO] - Loaded node [conv1_Conv] of type [Conv]
[INFO] - Loaded node [Relu] of type [Relu]
[INFO] - Loaded node [MaxPool] of type [MaxPool]
[INFO] - Loaded node [conv2_Conv] of type [Conv]
[INFO] - Loaded node [Relu_1] of type [Relu]
[INFO] - Loaded node [MaxPool_1] of type [MaxPool]
[INFO] - Loaded node [Constant] of type [Constant]
[INFO] - val type: int64
[INFO] - Loaded node [Reshape] of type [Reshape]
[NOTICE] - - fc1_Gemm (Gemm)
[INFO] - Loaded node [Relu_2] of type [Relu]
[NOTICE] - - fc2_Gemm (Gemm)
[INFO] - Loaded node [Relu_3] of type [Relu]
[NOTICE] - - fc3_Gemm (Gemm)
[INFO] - Connecting Nodes...
[DEBUG] - Inserted node "conv1_weight" into registry.
[DEBUG] - node conv1_weight added
[DEBUG] - Inserted node "conv1_bias" into registry.
[DEBUG] - node conv1_bias added
[DEBUG] - Inserted node "conv2_weight" into registry.
[DEBUG] - node conv2_weight added
[DEBUG] - Inserted node "conv2_bias" into registry.
[DEBUG] - node conv2_bias added
[DEBUG] - Inserted node "fc1_weight" into registry.
[DEBUG] - node fc1_weight added
[DEBUG] - Inserted node "fc1_bias" into registry.
[DEBUG] - node fc1_bias added
[DEBUG] - Inserted node "fc2_weight" into registry.
[DEBUG] - node fc2_weight added
[DEBUG] - Inserted node "fc2_bias" into registry.
[DEBUG] - node fc2_bias added
[DEBUG] - Inserted node "fc3_weight" into registry.
[DEBUG] - node fc3_weight added
[DEBUG] - Inserted node "fc3_bias" into registry.
[DEBUG] - node fc3_bias added
[DEBUG] - edge conv1_weight#0 -> conv1_Conv#1 added
[DEBUG] - Node "conv1_weight" is already registered and is the same instance. Skipping insertion.
[DEBUG] - edge conv1_bias#0 -> conv1_Conv#2 added
[DEBUG] - Node "conv1_bias" is already registered and is the same instance. Skipping insertion.
[DEBUG] - Inserted node "conv1_Conv" into registry.
[DEBUG] - node conv1_Conv added
[DEBUG] - edge conv1_Conv#0 -> Relu#0 added
[DEBUG] - Node "conv1_Conv" is already registered and is the same instance. Skipping insertion.
[DEBUG] - Inserted node "Relu" into registry.
[DEBUG] - node Relu added
[DEBUG] - edge Relu#0 -> MaxPool#0 added
[DEBUG] - Node "Relu" is already registered and is the same instance. Skipping insertion.
[DEBUG] - Inserted node "MaxPool" into registry.
[DEBUG] - node MaxPool added
[DEBUG] - edge MaxPool#0 -> conv2_Conv#0 added
[DEBUG] - Node "MaxPool" is already registered and is the same instance. Skipping insertion.
[DEBUG] - edge conv2_weight#0 -> conv2_Conv#1 added
[DEBUG] - Node "conv2_weight" is already registered and is the same instance. Skipping insertion.
[DEBUG] - edge conv2_bias#0 -> conv2_Conv#2 added
[DEBUG] - Node "conv2_bias" is already registered and is the same instance. Skipping insertion.
[DEBUG] - Inserted node "conv2_Conv" into registry.
[DEBUG] - node conv2_Conv added
[DEBUG] - edge conv2_Conv#0 -> Relu_1#0 added
[DEBUG] - Node "conv2_Conv" is already registered and is the same instance. Skipping insertion.
[DEBUG] - Inserted node "Relu_1" into registry.
[DEBUG] - node Relu_1 added
[DEBUG] - edge Relu_1#0 -> MaxPool_1#0 added
[DEBUG] - Node "Relu_1" is already registered and is the same instance. Skipping insertion.
[DEBUG] - Inserted node "MaxPool_1" into registry.
[DEBUG] - node MaxPool_1 added
[DEBUG] - Inserted node "Constant" into registry.
[DEBUG] - node Constant added
[DEBUG] - edge MaxPool_1#0 -> Reshape#0 added
[DEBUG] - Node "MaxPool_1" is already registered and is the same instance. Skipping insertion.
[DEBUG] - edge Constant#0 -> Reshape#1 added
[DEBUG] - Node "Constant" is already registered and is the same instance. Skipping insertion.
[DEBUG] - Inserted node "Reshape" into registry.
[DEBUG] - node Reshape added
[DEBUG] - edge Reshape#0 -> fc1_Gemm#0 added
[DEBUG] - Node "Reshape" is already registered and is the same instance. Skipping insertion.
[DEBUG] - edge fc1_weight#0 -> fc1_Gemm#1 added
[DEBUG] - Node "fc1_weight" is already registered and is the same instance. Skipping insertion.
[DEBUG] - edge fc1_bias#0 -> fc1_Gemm#2 added
[DEBUG] - Node "fc1_bias" is already registered and is the same instance. Skipping insertion.
[DEBUG] - Inserted node "fc1_Gemm" into registry.
[DEBUG] - node fc1_Gemm added
[DEBUG] - edge fc1_Gemm#0 -> Relu_2#0 added
[DEBUG] - Node "fc1_Gemm" is already registered and is the same instance. Skipping insertion.
[DEBUG] - Inserted node "Relu_2" into registry.
[DEBUG] - node Relu_2 added
[DEBUG] - edge Relu_2#0 -> fc2_Gemm#0 added
[DEBUG] - Node "Relu_2" is already registered and is the same instance. Skipping insertion.
[DEBUG] - edge fc2_weight#0 -> fc2_Gemm#1 added
[DEBUG] - Node "fc2_weight" is already registered and is the same instance. Skipping insertion.
[DEBUG] - edge fc2_bias#0 -> fc2_Gemm#2 added
[DEBUG] - Node "fc2_bias" is already registered and is the same instance. Skipping insertion.
[DEBUG] - Inserted node "fc2_Gemm" into registry.
[DEBUG] - node fc2_Gemm added
[DEBUG] - edge fc2_Gemm#0 -> Relu_3#0 added
[DEBUG] - Node "fc2_Gemm" is already registered and is the same instance. Skipping insertion.
[DEBUG] - Inserted node "Relu_3" into registry.
[DEBUG] - node Relu_3 added
[DEBUG] - edge Relu_3#0 -> fc3_Gemm#0 added
[DEBUG] - Node "Relu_3" is already registered and is the same instance. Skipping insertion.
[DEBUG] - edge fc3_weight#0 -> fc3_Gemm#1 added
[DEBUG] - Node "fc3_weight" is already registered and is the same instance. Skipping insertion.
[DEBUG] - edge fc3_bias#0 -> fc3_Gemm#2 added
[DEBUG] - Node "fc3_bias" is already registered and is the same instance. Skipping insertion.
[DEBUG] - Inserted node "fc3_Gemm" into registry.
[DEBUG] - node fc3_Gemm added
[DEBUG] - Node "fc3_Gemm" is already registered and is the same instance. Skipping insertion.
[INFO] - Cannot set DataFormat NCHW for Tensor with 1 dimensions, ignoring.
[INFO] - Cannot set DataFormat NCHW for Tensor with 2 dimensions, ignoring.
[INFO] - Cannot set DataFormat NCHW for Tensor with 1 dimensions, ignoring.
[INFO] - Cannot set DataFormat NCHW for Tensor with 1 dimensions, ignoring.
[INFO] - Cannot set DataFormat NCHW for Tensor with 2 dimensions, ignoring.
[INFO] - Cannot set DataFormat NCHW for Tensor with 1 dimensions, ignoring.
[INFO] - Cannot set DataFormat NCHW for Tensor with 2 dimensions, ignoring.
[INFO] - Cannot set DataFormat NCHW for Tensor with 1 dimensions, ignoring.
[INFO] - Cannot set DataFormat NCHW for Tensor with 1 dimensions, ignoring.
[INFO] - Cannot set DataFormat NCHW for Tensor with 1 dimensions, ignoring.
[INFO] - Cannot set DataFormat NCHW for Tensor with 1 dimensions, ignoring.
[INFO] - Cannot set DataFormat NCHW for Tensor with 2 dimensions, ignoring.
[INFO] - Cannot set DataFormat NCHW for Tensor with 1 dimensions, ignoring.
[INFO] - Cannot set DataFormat NCHW for Tensor with 2 dimensions, ignoring.
[INFO] - Cannot set DataFormat NCHW for Tensor with 1 dimensions, ignoring.
[INFO] - Cannot set DataFormat NCHW for Tensor with 2 dimensions, ignoring.
[INFO] - Cannot set DataFormat NCHW for Tensor with 1 dimensions, ignoring.
[DEBUG] - sequence
[DEBUG] -   node-or-block
[DEBUG] -     block
[DEBUG] -       sequence
[DEBUG] -         node-or-block
[DEBUG] -           block
[DEBUG] -           ×
[DEBUG] -           node
[DEBUG] - Inserted node "fc1_Gemm" into registry.
[DEBUG] - Inserted node "fc2_Gemm" into registry.
[DEBUG] - Inserted node "fc3_Gemm" into registry.
[DEBUG] -             root node FC, found: 3
[DEBUG] -         edge
[DEBUG] -         ×
[DEBUG] -       ×
[DEBUG] -       parallel
[DEBUG] -         node-or-block
[DEBUG] -           block
[DEBUG] -           ×
[DEBUG] -           node
[DEBUG] - Inserted node "fc1_Gemm" into registry.
[DEBUG] - Inserted node "fc2_Gemm" into registry.
[DEBUG] - Inserted node "fc3_Gemm" into registry.
[DEBUG] -             root node FC, found: 3
[DEBUG] -       ×
[DEBUG] -       alternative
[DEBUG] -         node-or-block
[DEBUG] -           block
[DEBUG] -           ×
[DEBUG] -           node
[DEBUG] - Inserted node "fc1_Gemm" into registry.
[DEBUG] - Inserted node "fc2_Gemm" into registry.
[DEBUG] - Inserted node "fc3_Gemm" into registry.
[DEBUG] -             root node FC, found: 3
[DEBUG] -         node-or-block
[DEBUG] -           block
[DEBUG] -           ×
[DEBUG] -           node
[DEBUG] -             root node MatMul, found: 0
[DEBUG] -   edge
[DEBUG] -     <0-0-
[DEBUG] -   node-or-block
[DEBUG] -     block
[DEBUG] -       sequence
[DEBUG] -         node-or-block
[DEBUG] -           block
[DEBUG] -           ×
[DEBUG] -           node
[DEBUG] -             node Flatten, found: 0
[DEBUG] -         edge
[DEBUG] -         ×
[DEBUG] -       ×
[DEBUG] -       parallel
[DEBUG] -         node-or-block
[DEBUG] -           block
[DEBUG] -           ×
[DEBUG] -           node
[DEBUG] -             node Flatten, found: 0
[DEBUG] -       ×
[DEBUG] -       alternative
[DEBUG] -         node-or-block
[DEBUG] -           block
[DEBUG] -           ×
[DEBUG] -           node
[DEBUG] -             node Flatten, found: 0
[DEBUG] -       ×
[DEBUG] -       block
[DEBUG] -       ×
[DEBUG] -       node
[DEBUG] -         node Flatten, found: 0
[DEBUG] -     block
[DEBUG] -       sequence
[DEBUG] -         node-or-block
[DEBUG] -           block
[DEBUG] -           ×
[DEBUG] -           node
[DEBUG] -             node Flatten, found: 0
[DEBUG] -         edge
[DEBUG] -         ×
[DEBUG] -       ×
[DEBUG] -       parallel
[DEBUG] -         node-or-block
[DEBUG] -           block
[DEBUG] -           ×
[DEBUG] -           node
[DEBUG] -             node Flatten, found: 0
[DEBUG] -       ×
[DEBUG] -       alternative
[DEBUG] -         node-or-block
[DEBUG] -           block
[DEBUG] -           ×
[DEBUG] -           node
[DEBUG] -             node Flatten, found: 0
[DEBUG] -       ×
[DEBUG] -       block
[DEBUG] -       ×
[DEBUG] -       node
[DEBUG] -         node Flatten, found: 0
[DEBUG] -   edge
[DEBUG] -   ×
[INFO] - Graph matching complete.
[INFO]   Found 0 matches for the query
  • create input tensor:

[5]:
# Create an input tensor
input =  np.random.randn(1, 1, 28, 28).astype(np.float32)
input_tensor = aidge_core.Tensor(input)
input_tensor.to_dtype(aidge_core.dtype.float32)
input_tensor.to_backend("cuda")
  • compile the model:

[6]:
model.compile("cuda", aidge_core.dtype.float32, dims=[input_tensor.dims])
[INFO] - Manually setting GraphView input data type with provided parameters:
[INFO]        * input#0 Float32
[DEBUG] - Validating input dtype against existing graph inputs
[DEBUG] - Creating new tensor for input#0 conv1_Conv[Conv2D] with dtype Float32
[DEBUG] - Verifying graph connections and tensor validity
[DEBUG] - List of node to forward data type:
[DEBUG] -    - Node conv1_Conv (of type Conv2D)
[DEBUG] -    - Node conv2_Conv (of type Conv2D)
[DEBUG] -    - Node Reshape (of type Reshape)
[DEBUG] -    - Node fc1_Gemm (of type FC)
[DEBUG] -    - Node fc2_Gemm (of type FC)
[DEBUG] -    - Node fc3_Gemm (of type FC)
[DEBUG] - Data type forwarded for node conv1_Conv (of type Conv2D)
[DEBUG] - Data type not forwarded for parent (node MaxPool (of type MaxPooling2D)) of node
[DEBUG]   conv2_Conv (of type Conv2D)
[DEBUG] - Adding back node conv2_Conv (of type Conv2D) to the list of nodes to forward data type
[DEBUG] - Data type not forwarded for parent (node MaxPool_1 (of type MaxPooling2D)) of node Reshape
[DEBUG]   (of type Reshape)
[DEBUG] - Adding back node Reshape (of type Reshape) to the list of nodes to forward data type
[DEBUG] - Data type not forwarded for parent (node Reshape (of type Reshape)) of node fc1_Gemm (of
[DEBUG]   type FC)
[DEBUG] - Adding back node fc1_Gemm (of type FC) to the list of nodes to forward data type
[DEBUG] - Data type not forwarded for parent (node Relu_2 (of type ReLU)) of node fc2_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc2_Gemm (of type FC) to the list of nodes to forward data type
[DEBUG] - Data type not forwarded for parent (node Relu_3 (of type ReLU)) of node fc3_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc3_Gemm (of type FC) to the list of nodes to forward data type
[DEBUG] - List of node to forward data type:
[DEBUG] -    - Node Relu (of type ReLU)
[DEBUG] -    - Node conv2_Conv (of type Conv2D)
[DEBUG] -    - Node Reshape (of type Reshape)
[DEBUG] -    - Node fc1_Gemm (of type FC)
[DEBUG] -    - Node fc2_Gemm (of type FC)
[DEBUG] -    - Node fc3_Gemm (of type FC)
[DEBUG] - Running default forwardDtype for operator ReLU
[DEBUG] - Setting output#0 dtype to Float32
[DEBUG] - Data type forwarded for node Relu (of type ReLU)
[DEBUG] - Data type not forwarded for parent (node MaxPool (of type MaxPooling2D)) of node
[DEBUG]   conv2_Conv (of type Conv2D)
[DEBUG] - Adding back node conv2_Conv (of type Conv2D) to the list of nodes to forward data type
[DEBUG] - Data type not forwarded for parent (node MaxPool_1 (of type MaxPooling2D)) of node Reshape
[DEBUG]   (of type Reshape)
[DEBUG] - Adding back node Reshape (of type Reshape) to the list of nodes to forward data type
[DEBUG] - Data type not forwarded for parent (node Reshape (of type Reshape)) of node fc1_Gemm (of
[DEBUG]   type FC)
[DEBUG] - Adding back node fc1_Gemm (of type FC) to the list of nodes to forward data type
[DEBUG] - Data type not forwarded for parent (node Relu_2 (of type ReLU)) of node fc2_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc2_Gemm (of type FC) to the list of nodes to forward data type
[DEBUG] - Data type not forwarded for parent (node Relu_3 (of type ReLU)) of node fc3_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc3_Gemm (of type FC) to the list of nodes to forward data type
[DEBUG] - List of node to forward data type:
[DEBUG] -    - Node MaxPool (of type MaxPooling2D)
[DEBUG] -    - Node conv2_Conv (of type Conv2D)
[DEBUG] -    - Node Reshape (of type Reshape)
[DEBUG] -    - Node fc1_Gemm (of type FC)
[DEBUG] -    - Node fc2_Gemm (of type FC)
[DEBUG] -    - Node fc3_Gemm (of type FC)
[DEBUG] - Data type forwarded for node MaxPool (of type MaxPooling2D)
[DEBUG] - Data type forwarded for node conv2_Conv (of type Conv2D)
[DEBUG] - Data type not forwarded for parent (node MaxPool_1 (of type MaxPooling2D)) of node Reshape
[DEBUG]   (of type Reshape)
[DEBUG] - Adding back node Reshape (of type Reshape) to the list of nodes to forward data type
[DEBUG] - Data type not forwarded for parent (node Reshape (of type Reshape)) of node fc1_Gemm (of
[DEBUG]   type FC)
[DEBUG] - Adding back node fc1_Gemm (of type FC) to the list of nodes to forward data type
[DEBUG] - Data type not forwarded for parent (node Relu_2 (of type ReLU)) of node fc2_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc2_Gemm (of type FC) to the list of nodes to forward data type
[DEBUG] - Data type not forwarded for parent (node Relu_3 (of type ReLU)) of node fc3_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc3_Gemm (of type FC) to the list of nodes to forward data type
[DEBUG] - List of node to forward data type:
[DEBUG] -    - Node conv2_Conv (of type Conv2D)
[DEBUG] -    - Node Relu_1 (of type ReLU)
[DEBUG] -    - Node Reshape (of type Reshape)
[DEBUG] -    - Node fc1_Gemm (of type FC)
[DEBUG] -    - Node fc2_Gemm (of type FC)
[DEBUG] -    - Node fc3_Gemm (of type FC)
[DEBUG] - Data type forwarded for node conv2_Conv (of type Conv2D)
[DEBUG] - Running default forwardDtype for operator ReLU
[DEBUG] - Setting output#0 dtype to Float32
[DEBUG] - Data type forwarded for node Relu_1 (of type ReLU)
[DEBUG] - Data type not forwarded for parent (node MaxPool_1 (of type MaxPooling2D)) of node Reshape
[DEBUG]   (of type Reshape)
[DEBUG] - Adding back node Reshape (of type Reshape) to the list of nodes to forward data type
[DEBUG] - Data type not forwarded for parent (node Reshape (of type Reshape)) of node fc1_Gemm (of
[DEBUG]   type FC)
[DEBUG] - Adding back node fc1_Gemm (of type FC) to the list of nodes to forward data type
[DEBUG] - Data type not forwarded for parent (node Relu_2 (of type ReLU)) of node fc2_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc2_Gemm (of type FC) to the list of nodes to forward data type
[DEBUG] - Data type not forwarded for parent (node Relu_3 (of type ReLU)) of node fc3_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc3_Gemm (of type FC) to the list of nodes to forward data type
[DEBUG] - List of node to forward data type:
[DEBUG] -    - Node Relu_1 (of type ReLU)
[DEBUG] -    - Node MaxPool_1 (of type MaxPooling2D)
[DEBUG] -    - Node Reshape (of type Reshape)
[DEBUG] -    - Node fc1_Gemm (of type FC)
[DEBUG] -    - Node fc2_Gemm (of type FC)
[DEBUG] -    - Node fc3_Gemm (of type FC)
[DEBUG] - Running default forwardDtype for operator ReLU
[DEBUG] - Setting output#0 dtype to Float32
[DEBUG] - Data type forwarded for node Relu_1 (of type ReLU)
[DEBUG] - Data type forwarded for node MaxPool_1 (of type MaxPooling2D)
[DEBUG] - Data type forwarded for node Reshape (of type Reshape)
[DEBUG] - Data type forwarded for node fc1_Gemm (of type FC)
[DEBUG] - Data type not forwarded for parent (node Relu_2 (of type ReLU)) of node fc2_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc2_Gemm (of type FC) to the list of nodes to forward data type
[DEBUG] - Data type not forwarded for parent (node Relu_3 (of type ReLU)) of node fc3_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc3_Gemm (of type FC) to the list of nodes to forward data type
[DEBUG] - List of node to forward data type:
[DEBUG] -    - Node MaxPool_1 (of type MaxPooling2D)
[DEBUG] -    - Node Reshape (of type Reshape)
[DEBUG] -    - Node fc1_Gemm (of type FC)
[DEBUG] -    - Node Relu_2 (of type ReLU)
[DEBUG] -    - Node fc2_Gemm (of type FC)
[DEBUG] -    - Node fc3_Gemm (of type FC)
[DEBUG] - Data type forwarded for node MaxPool_1 (of type MaxPooling2D)
[DEBUG] - Data type forwarded for node Reshape (of type Reshape)
[DEBUG] - Data type forwarded for node fc1_Gemm (of type FC)
[DEBUG] - Running default forwardDtype for operator ReLU
[DEBUG] - Setting output#0 dtype to Float32
[DEBUG] - Data type forwarded for node Relu_2 (of type ReLU)
[DEBUG] - Data type forwarded for node fc2_Gemm (of type FC)
[DEBUG] - Data type not forwarded for parent (node Relu_3 (of type ReLU)) of node fc3_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc3_Gemm (of type FC) to the list of nodes to forward data type
[DEBUG] - List of node to forward data type:
[DEBUG] -    - Node Relu_2 (of type ReLU)
[DEBUG] -    - Node fc2_Gemm (of type FC)
[DEBUG] -    - Node Relu_3 (of type ReLU)
[DEBUG] -    - Node fc3_Gemm (of type FC)
[DEBUG] - Running default forwardDtype for operator ReLU
[DEBUG] - Setting output#0 dtype to Float32
[DEBUG] - Data type forwarded for node Relu_2 (of type ReLU)
[DEBUG] - Data type forwarded for node fc2_Gemm (of type FC)
[DEBUG] - Running default forwardDtype for operator ReLU
[DEBUG] - Setting output#0 dtype to Float32
[DEBUG] - Data type forwarded for node Relu_3 (of type ReLU)
[DEBUG] - Data type forwarded for node fc3_Gemm (of type FC)
[DEBUG] - List of node to forward data type:
[DEBUG] -    - Node Relu_3 (of type ReLU)
[DEBUG] -    - Node fc3_Gemm (of type FC)
[DEBUG] - Running default forwardDtype for operator ReLU
[DEBUG] - Setting output#0 dtype to Float32
[DEBUG] - Data type forwarded for node Relu_3 (of type ReLU)
[DEBUG] - Data type forwarded for node fc3_Gemm (of type FC)
[DEBUG] - Starting dimension forward propagation for GraphView
[INFO] - Manually setting GraphView input dims with provided parameters:
[INFO]        * input#0 [1, 1, 28, 28]
[DEBUG] - Validating input dimensions against existing graph inputs
[DEBUG] - Resizing tensor (which was undefined) for input#0 with dims [1, 1, 28, 28]
[DEBUG] - Verifying graph connections and tensor validity
[DEBUG] - Initializing dimension propagation
[DEBUG] - List of node to forward dimensions:
[DEBUG] -    - Node conv1_Conv (of type Conv2D)
[DEBUG] -    - Node conv2_Conv (of type Conv2D)
[DEBUG] -    - Node Reshape (of type Reshape)
[DEBUG] -    - Node fc1_Gemm (of type FC)
[DEBUG] -    - Node fc2_Gemm (of type FC)
[DEBUG] -    - Node fc3_Gemm (of type FC)
[DEBUG] - Trying to forward dims of node conv1_Conv (of type Conv2D)
[DEBUG] - Dimensions forwarded for node conv1_Conv (of type Conv2D): [1, 1, 28, 28] Default -> [1,
[DEBUG]   6, 24, 24] NCHW
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node conv2_Conv (of type Conv2D)
[DEBUG] - Dimensions not forwarded for parent (node MaxPool (of type MaxPooling2D)) of node
[DEBUG]   conv2_Conv (of type Conv2D)
[DEBUG] - Adding back node conv2_Conv (of type Conv2D) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node Reshape (of type Reshape)
[DEBUG] - Dimensions not forwarded for parent (node MaxPool_1 (of type MaxPooling2D)) of node
[DEBUG]   Reshape (of type Reshape)
[DEBUG] - Adding back node Reshape (of type Reshape) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc1_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Reshape (of type Reshape)) of node fc1_Gemm (of
[DEBUG]   type FC)
[DEBUG] - Adding back node fc1_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc2_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_2 (of type ReLU)) of node fc2_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc2_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc3_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_3 (of type ReLU)) of node fc3_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc3_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Finished treating current list of nodes ...
[DEBUG] - List of node to forward dimensions:
[DEBUG] -    - Node Relu (of type ReLU)
[DEBUG] -    - Node conv2_Conv (of type Conv2D)
[DEBUG] -    - Node Reshape (of type Reshape)
[DEBUG] -    - Node fc1_Gemm (of type FC)
[DEBUG] -    - Node fc2_Gemm (of type FC)
[DEBUG] -    - Node fc3_Gemm (of type FC)
[DEBUG] - Trying to forward dims of node Relu (of type ReLU)
[DEBUG] - Dimensions forwarded for node Relu (of type ReLU): [1, 6, 24, 24] NCHW -> [1, 6, 24, 24]
[DEBUG]   NCHW
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node conv2_Conv (of type Conv2D)
[DEBUG] - Dimensions not forwarded for parent (node MaxPool (of type MaxPooling2D)) of node
[DEBUG]   conv2_Conv (of type Conv2D)
[DEBUG] - Adding back node conv2_Conv (of type Conv2D) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node Reshape (of type Reshape)
[DEBUG] - Dimensions not forwarded for parent (node MaxPool_1 (of type MaxPooling2D)) of node
[DEBUG]   Reshape (of type Reshape)
[DEBUG] - Adding back node Reshape (of type Reshape) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc1_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Reshape (of type Reshape)) of node fc1_Gemm (of
[DEBUG]   type FC)
[DEBUG] - Adding back node fc1_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc2_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_2 (of type ReLU)) of node fc2_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc2_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc3_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_3 (of type ReLU)) of node fc3_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc3_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Finished treating current list of nodes ...
[DEBUG] - List of node to forward dimensions:
[DEBUG] -    - Node MaxPool (of type MaxPooling2D)
[DEBUG] -    - Node conv2_Conv (of type Conv2D)
[DEBUG] -    - Node Reshape (of type Reshape)
[DEBUG] -    - Node fc1_Gemm (of type FC)
[DEBUG] -    - Node fc2_Gemm (of type FC)
[DEBUG] -    - Node fc3_Gemm (of type FC)
[DEBUG] - Trying to forward dims of node MaxPool (of type MaxPooling2D)
[DEBUG] - Dimensions forwarded for node MaxPool (of type MaxPooling2D): [1, 6, 24, 24] NCHW -> [1,
[DEBUG]   6, 12, 12] NCHW
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node conv2_Conv (of type Conv2D)
[DEBUG] - Dimensions forwarded for node conv2_Conv (of type Conv2D): [1, 6, 12, 12] NCHW -> [1, 16,
[DEBUG]   8, 8] NCHW
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node Reshape (of type Reshape)
[DEBUG] - Dimensions not forwarded for parent (node MaxPool_1 (of type MaxPooling2D)) of node
[DEBUG]   Reshape (of type Reshape)
[DEBUG] - Adding back node Reshape (of type Reshape) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc1_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Reshape (of type Reshape)) of node fc1_Gemm (of
[DEBUG]   type FC)
[DEBUG] - Adding back node fc1_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc2_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_2 (of type ReLU)) of node fc2_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc2_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc3_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_3 (of type ReLU)) of node fc3_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc3_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Finished treating current list of nodes ...
[DEBUG] - List of node to forward dimensions:
[DEBUG] -    - Node conv2_Conv (of type Conv2D)
[DEBUG] -    - Node Relu_1 (of type ReLU)
[DEBUG] -    - Node Reshape (of type Reshape)
[DEBUG] -    - Node fc1_Gemm (of type FC)
[DEBUG] -    - Node fc2_Gemm (of type FC)
[DEBUG] -    - Node fc3_Gemm (of type FC)
[DEBUG] - Trying to forward dims of node conv2_Conv (of type Conv2D)
[DEBUG] - Dimensions forwarded for node conv2_Conv (of type Conv2D): [1, 6, 12, 12] NCHW -> [1, 16,
[DEBUG]   8, 8] NCHW
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node Relu_1 (of type ReLU)
[DEBUG] - Dimensions forwarded for node Relu_1 (of type ReLU): [1, 16, 8, 8] NCHW -> [1, 16, 8, 8]
[DEBUG]   NCHW
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node Reshape (of type Reshape)
[DEBUG] - Dimensions not forwarded for parent (node MaxPool_1 (of type MaxPooling2D)) of node
[DEBUG]   Reshape (of type Reshape)
[DEBUG] - Adding back node Reshape (of type Reshape) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc1_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Reshape (of type Reshape)) of node fc1_Gemm (of
[DEBUG]   type FC)
[DEBUG] - Adding back node fc1_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc2_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_2 (of type ReLU)) of node fc2_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc2_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc3_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_3 (of type ReLU)) of node fc3_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc3_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Finished treating current list of nodes ...
[DEBUG] - List of node to forward dimensions:
[DEBUG] -    - Node Relu_1 (of type ReLU)
[DEBUG] -    - Node MaxPool_1 (of type MaxPooling2D)
[DEBUG] -    - Node Reshape (of type Reshape)
[DEBUG] -    - Node fc1_Gemm (of type FC)
[DEBUG] -    - Node fc2_Gemm (of type FC)
[DEBUG] -    - Node fc3_Gemm (of type FC)
[DEBUG] - Trying to forward dims of node Relu_1 (of type ReLU)
[DEBUG] - Dimensions forwarded for node Relu_1 (of type ReLU): [1, 16, 8, 8] NCHW -> [1, 16, 8, 8]
[DEBUG]   NCHW
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node MaxPool_1 (of type MaxPooling2D)
[DEBUG] - Dimensions forwarded for node MaxPool_1 (of type MaxPooling2D): [1, 16, 8, 8] NCHW -> [1,
[DEBUG]   16, 4, 4] NCHW
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node Reshape (of type Reshape)
[WARNING] - Reshape_Op: unable to forwardDims() because output dims are data dependent on input#1
[DEBUG] - Unable to forward dimensions for node Reshape (of type Reshape)
[DEBUG] - Adding back node Reshape (of type Reshape) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc1_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Reshape (of type Reshape)) of node fc1_Gemm (of
[DEBUG]   type FC)
[DEBUG] - Adding back node fc1_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc2_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_2 (of type ReLU)) of node fc2_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc2_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc3_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_3 (of type ReLU)) of node fc3_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc3_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Finished treating current list of nodes ...
[DEBUG] - List of node to forward dimensions:
[DEBUG] -    - Node MaxPool_1 (of type MaxPooling2D)
[DEBUG] -    - Node Reshape (of type Reshape)
[DEBUG] -    - Node fc1_Gemm (of type FC)
[DEBUG] -    - Node fc2_Gemm (of type FC)
[DEBUG] -    - Node fc3_Gemm (of type FC)
[DEBUG] - Trying to forward dims of node MaxPool_1 (of type MaxPooling2D)
[DEBUG] - Dimensions forwarded for node MaxPool_1 (of type MaxPooling2D): [1, 16, 8, 8] NCHW -> [1,
[DEBUG]   16, 4, 4] NCHW
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node Reshape (of type Reshape)
[WARNING] - Reshape_Op: unable to forwardDims() because output dims are data dependent on input#1
[DEBUG] - Unable to forward dimensions for node Reshape (of type Reshape)
[DEBUG] - Adding back node Reshape (of type Reshape) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc1_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Reshape (of type Reshape)) of node fc1_Gemm (of
[DEBUG]   type FC)
[DEBUG] - Adding back node fc1_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc2_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_2 (of type ReLU)) of node fc2_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc2_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc3_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_3 (of type ReLU)) of node fc3_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc3_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Finished treating current list of nodes ...
[DEBUG] - List of node to forward dimensions:
[DEBUG] -    - Node Reshape (of type Reshape)
[DEBUG] -    - Node fc1_Gemm (of type FC)
[DEBUG] -    - Node fc2_Gemm (of type FC)
[DEBUG] -    - Node fc3_Gemm (of type FC)
[DEBUG] - Trying to forward dims of node Reshape (of type Reshape)
[WARNING] - Reshape_Op: unable to forwardDims() because output dims are data dependent on input#1
[DEBUG] - Unable to forward dimensions for node Reshape (of type Reshape)
[DEBUG] - Adding back node Reshape (of type Reshape) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc1_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Reshape (of type Reshape)) of node fc1_Gemm (of
[DEBUG]   type FC)
[DEBUG] - Adding back node fc1_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc2_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_2 (of type ReLU)) of node fc2_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc2_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc3_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_3 (of type ReLU)) of node fc3_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc3_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Finished treating current list of nodes ...
[WARNING] - Unable to forward dimensions (circular dependency and/or wrong dimensions and/or data
[WARNING]   dependent dimension?). Unable to compute output dims for nodes ["Reshape (Reshape)",
[WARNING]   "fc1_Gemm (FC)", "fc2_Gemm (FC)", "fc3_Gemm (FC)"].
  • create a scheduler and run inference

[7]:
# Define the scheduler
scheduler = aidge_core.SequentialScheduler(model)
# Run inference !
scheduler.forward(data=[input_tensor])
[DEBUG] - Starting dimension forward propagation for GraphView
[DEBUG] - Verifying graph connections and tensor validity
[DEBUG] - Initializing dimension propagation
[DEBUG] - List of node to forward dimensions:
[DEBUG] -    - Node conv1_Conv (of type Conv2D)
[DEBUG] -    - Node conv2_Conv (of type Conv2D)
[DEBUG] -    - Node Reshape (of type Reshape)
[DEBUG] -    - Node fc1_Gemm (of type FC)
[DEBUG] -    - Node fc2_Gemm (of type FC)
[DEBUG] -    - Node fc3_Gemm (of type FC)
[DEBUG] - Trying to forward dims of node conv1_Conv (of type Conv2D)
[DEBUG] - Dimensions forwarded for node conv1_Conv (of type Conv2D): [1, 1, 28, 28] Default -> [1,
[DEBUG]   6, 24, 24] NCHW
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node conv2_Conv (of type Conv2D)
[DEBUG] - Dimensions not forwarded for parent (node MaxPool (of type MaxPooling2D)) of node
[DEBUG]   conv2_Conv (of type Conv2D)
[DEBUG] - Adding back node conv2_Conv (of type Conv2D) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node Reshape (of type Reshape)
[DEBUG] - Dimensions not forwarded for parent (node MaxPool_1 (of type MaxPooling2D)) of node
[DEBUG]   Reshape (of type Reshape)
[DEBUG] - Adding back node Reshape (of type Reshape) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc1_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Reshape (of type Reshape)) of node fc1_Gemm (of
[DEBUG]   type FC)
[DEBUG] - Adding back node fc1_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc2_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_2 (of type ReLU)) of node fc2_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc2_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc3_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_3 (of type ReLU)) of node fc3_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc3_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Finished treating current list of nodes ...
[DEBUG] - List of node to forward dimensions:
[DEBUG] -    - Node Relu (of type ReLU)
[DEBUG] -    - Node conv2_Conv (of type Conv2D)
[DEBUG] -    - Node Reshape (of type Reshape)
[DEBUG] -    - Node fc1_Gemm (of type FC)
[DEBUG] -    - Node fc2_Gemm (of type FC)
[DEBUG] -    - Node fc3_Gemm (of type FC)
[DEBUG] - Trying to forward dims of node Relu (of type ReLU)
[DEBUG] - Dimensions forwarded for node Relu (of type ReLU): [1, 6, 24, 24] NCHW -> [1, 6, 24, 24]
[DEBUG]   NCHW
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node conv2_Conv (of type Conv2D)
[DEBUG] - Dimensions not forwarded for parent (node MaxPool (of type MaxPooling2D)) of node
[DEBUG]   conv2_Conv (of type Conv2D)
[DEBUG] - Adding back node conv2_Conv (of type Conv2D) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node Reshape (of type Reshape)
[DEBUG] - Dimensions not forwarded for parent (node MaxPool_1 (of type MaxPooling2D)) of node
[DEBUG]   Reshape (of type Reshape)
[DEBUG] - Adding back node Reshape (of type Reshape) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc1_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Reshape (of type Reshape)) of node fc1_Gemm (of
[DEBUG]   type FC)
[DEBUG] - Adding back node fc1_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc2_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_2 (of type ReLU)) of node fc2_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc2_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc3_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_3 (of type ReLU)) of node fc3_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc3_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Finished treating current list of nodes ...
[DEBUG] - List of node to forward dimensions:
[DEBUG] -    - Node MaxPool (of type MaxPooling2D)
[DEBUG] -    - Node conv2_Conv (of type Conv2D)
[DEBUG] -    - Node Reshape (of type Reshape)
[DEBUG] -    - Node fc1_Gemm (of type FC)
[DEBUG] -    - Node fc2_Gemm (of type FC)
[DEBUG] -    - Node fc3_Gemm (of type FC)
[DEBUG] - Trying to forward dims of node MaxPool (of type MaxPooling2D)
[DEBUG] - Dimensions forwarded for node MaxPool (of type MaxPooling2D): [1, 6, 24, 24] NCHW -> [1,
[DEBUG]   6, 12, 12] NCHW
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node conv2_Conv (of type Conv2D)
[DEBUG] - Dimensions forwarded for node conv2_Conv (of type Conv2D): [1, 6, 12, 12] NCHW -> [1, 16,
[DEBUG]   8, 8] NCHW
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node Reshape (of type Reshape)
[DEBUG] - Dimensions not forwarded for parent (node MaxPool_1 (of type MaxPooling2D)) of node
[DEBUG]   Reshape (of type Reshape)
[DEBUG] - Adding back node Reshape (of type Reshape) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc1_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Reshape (of type Reshape)) of node fc1_Gemm (of
[DEBUG]   type FC)
[DEBUG] - Adding back node fc1_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc2_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_2 (of type ReLU)) of node fc2_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc2_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc3_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_3 (of type ReLU)) of node fc3_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc3_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Finished treating current list of nodes ...
[DEBUG] - List of node to forward dimensions:
[DEBUG] -    - Node conv2_Conv (of type Conv2D)
[DEBUG] -    - Node Relu_1 (of type ReLU)
[DEBUG] -    - Node Reshape (of type Reshape)
[DEBUG] -    - Node fc1_Gemm (of type FC)
[DEBUG] -    - Node fc2_Gemm (of type FC)
[DEBUG] -    - Node fc3_Gemm (of type FC)
[DEBUG] - Trying to forward dims of node conv2_Conv (of type Conv2D)
[DEBUG] - Dimensions forwarded for node conv2_Conv (of type Conv2D): [1, 6, 12, 12] NCHW -> [1, 16,
[DEBUG]   8, 8] NCHW
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node Relu_1 (of type ReLU)
[DEBUG] - Dimensions forwarded for node Relu_1 (of type ReLU): [1, 16, 8, 8] NCHW -> [1, 16, 8, 8]
[DEBUG]   NCHW
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node Reshape (of type Reshape)
[DEBUG] - Dimensions not forwarded for parent (node MaxPool_1 (of type MaxPooling2D)) of node
[DEBUG]   Reshape (of type Reshape)
[DEBUG] - Adding back node Reshape (of type Reshape) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc1_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Reshape (of type Reshape)) of node fc1_Gemm (of
[DEBUG]   type FC)
[DEBUG] - Adding back node fc1_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc2_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_2 (of type ReLU)) of node fc2_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc2_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc3_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_3 (of type ReLU)) of node fc3_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc3_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Finished treating current list of nodes ...
[DEBUG] - List of node to forward dimensions:
[DEBUG] -    - Node Relu_1 (of type ReLU)
[DEBUG] -    - Node MaxPool_1 (of type MaxPooling2D)
[DEBUG] -    - Node Reshape (of type Reshape)
[DEBUG] -    - Node fc1_Gemm (of type FC)
[DEBUG] -    - Node fc2_Gemm (of type FC)
[DEBUG] -    - Node fc3_Gemm (of type FC)
[DEBUG] - Trying to forward dims of node Relu_1 (of type ReLU)
[DEBUG] - Dimensions forwarded for node Relu_1 (of type ReLU): [1, 16, 8, 8] NCHW -> [1, 16, 8, 8]
[DEBUG]   NCHW
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node MaxPool_1 (of type MaxPooling2D)
[DEBUG] - Dimensions forwarded for node MaxPool_1 (of type MaxPooling2D): [1, 16, 8, 8] NCHW -> [1,
[DEBUG]   16, 4, 4] NCHW
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node Reshape (of type Reshape)
[WARNING] - Reshape_Op: unable to forwardDims() because output dims are data dependent on input#1
[DEBUG] - Unable to forward dimensions for node Reshape (of type Reshape)
[DEBUG] - Adding back node Reshape (of type Reshape) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc1_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Reshape (of type Reshape)) of node fc1_Gemm (of
[DEBUG]   type FC)
[DEBUG] - Adding back node fc1_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc2_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_2 (of type ReLU)) of node fc2_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc2_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc3_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_3 (of type ReLU)) of node fc3_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc3_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Finished treating current list of nodes ...
[DEBUG] - List of node to forward dimensions:
[DEBUG] -    - Node MaxPool_1 (of type MaxPooling2D)
[DEBUG] -    - Node Reshape (of type Reshape)
[DEBUG] -    - Node fc1_Gemm (of type FC)
[DEBUG] -    - Node fc2_Gemm (of type FC)
[DEBUG] -    - Node fc3_Gemm (of type FC)
[DEBUG] - Trying to forward dims of node MaxPool_1 (of type MaxPooling2D)
[DEBUG] - Dimensions forwarded for node MaxPool_1 (of type MaxPooling2D): [1, 16, 8, 8] NCHW -> [1,
[DEBUG]   16, 4, 4] NCHW
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node Reshape (of type Reshape)
[WARNING] - Reshape_Op: unable to forwardDims() because output dims are data dependent on input#1
[DEBUG] - Unable to forward dimensions for node Reshape (of type Reshape)
[DEBUG] - Adding back node Reshape (of type Reshape) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc1_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Reshape (of type Reshape)) of node fc1_Gemm (of
[DEBUG]   type FC)
[DEBUG] - Adding back node fc1_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc2_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_2 (of type ReLU)) of node fc2_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc2_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc3_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_3 (of type ReLU)) of node fc3_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc3_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Finished treating current list of nodes ...
[DEBUG] - List of node to forward dimensions:
[DEBUG] -    - Node Reshape (of type Reshape)
[DEBUG] -    - Node fc1_Gemm (of type FC)
[DEBUG] -    - Node fc2_Gemm (of type FC)
[DEBUG] -    - Node fc3_Gemm (of type FC)
[DEBUG] - Trying to forward dims of node Reshape (of type Reshape)
[WARNING] - Reshape_Op: unable to forwardDims() because output dims are data dependent on input#1
[DEBUG] - Unable to forward dimensions for node Reshape (of type Reshape)
[DEBUG] - Adding back node Reshape (of type Reshape) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc1_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Reshape (of type Reshape)) of node fc1_Gemm (of
[DEBUG]   type FC)
[DEBUG] - Adding back node fc1_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc2_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_2 (of type ReLU)) of node fc2_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc2_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Trying to forward dims of node fc3_Gemm (of type FC)
[DEBUG] - Dimensions not forwarded for parent (node Relu_3 (of type ReLU)) of node fc3_Gemm (of type
[DEBUG]   FC)
[DEBUG] - Adding back node fc3_Gemm (of type FC) to the list of nodes to forward dimensions
[DEBUG] - - - - - -
[DEBUG] - Finished treating current list of nodes ...
[WARNING] - Unable to forward dimensions (circular dependency and/or wrong dimensions and/or data
[WARNING]   dependent dimension?). Unable to compute output dims for nodes ["Reshape (Reshape)",
[WARNING]   "fc1_Gemm (FC)", "fc2_Gemm (FC)", "fc3_Gemm (FC)"].
[DEBUG] - List of consumers with their priors:
[DEBUG] -    - consumer: fc3_Gemm (FC#2)
[DEBUG] -            required producers: ["conv1_bias (Producer#1)", "fc1_weight (Producer#5)", "conv2_bias
[DEBUG]   (Producer#3)", "conv1_weight (Producer#0)", "conv2_weight (Producer#2)", "fc1_bias
[DEBUG]   (Producer#6)", "fc2_weight (Producer#7)", "fc2_bias (Producer#8)", "fc3_weight
[DEBUG]   (Producer#9)", "fc3_bias (Producer#10)", "Constant (Producer#4)"]
[DEBUG] -            prior consumers: ["conv1_Conv (Conv2D#0)", "conv2_Conv (Conv2D#1)", "Reshape
[DEBUG]   (Reshape#0)", "fc1_Gemm (FC#0)", "fc2_Gemm (FC#1)", "fc3_Gemm (FC#2)"]
[DEBUG] - Updated list of consumers:
[DEBUG] -    - consumer: conv1_Conv (Conv2D#0)
[DEBUG] -            C/R:    0:0/784:1
[DEBUG]                      0:0/150:1
[DEBUG]                      0:0/6:1
[DEBUG] -            P:      0:0
Context: Consumer node conv1_Conv (Conv2D#0) input #0
[INFO] - No producer node attached to input#0 for node conv1_Conv (Conv2D)
[DEBUG] -    - consumer: conv2_Conv (Conv2D#1)
[DEBUG] -            C/R:    0:0/864:1
[DEBUG]                      0:0/2400:1
[DEBUG]                      0:0/16:1
[DEBUG] -            P:      0:0
Context: Consumer node conv2_Conv (Conv2D#1) input #0
[DEBUG] -   not runnable: C0:0 + R864:1 > P0:0 for input #0
[DEBUG] -    - consumer: Reshape (Reshape#0)
[DEBUG] -            C/R:    0:0/256:1
[DEBUG]                      0:0/2:1
[DEBUG] -            P:      0:0
Context: Consumer node Reshape (Reshape#0) input #0
[DEBUG] -   not runnable: C0:0 + R256:1 > P0:0 for input #0
[DEBUG] -    - consumer: fc1_Gemm (FC#0)
[DEBUG] -            C/R:    0:0/0:1
[DEBUG]                      0:0/30720:1
[DEBUG]                      0:0/120:1
[DEBUG] -            P:      0:0
Context: Consumer node fc1_Gemm (FC#0) input #0
[DEBUG] -   not runnable: C0:0 + R0:1 > P0:0 for input #0
[DEBUG] -    - consumer: fc2_Gemm (FC#1)
[DEBUG] -            C/R:    0:0/0:1
[DEBUG]                      0:0/10080:1
[DEBUG]                      0:0/84:1
[DEBUG] -            P:      0:0
Context: Consumer node fc2_Gemm (FC#1) input #0
[DEBUG] -   not runnable: C0:0 + R0:1 > P0:0 for input #0
[DEBUG] -    - consumer: fc3_Gemm (FC#2)
[DEBUG] -            C/R:    0:0/0:1
[DEBUG]                      0:0/840:1
[DEBUG]                      0:0/10:1
[DEBUG] -            P:      0:0
Context: Consumer node fc3_Gemm (FC#2) input #0
[DEBUG] -   not runnable: C0:0 + R0:1 > P0:0 for input #0
[DEBUG] - Runnable: conv1_Conv (Conv2D#0)
[DEBUG] - Updating producer and consumer lists...
[DEBUG] -    - consumer: conv1_Conv (Conv2D#0)
[DEBUG] -            C/R:    784:1/784:1
[DEBUG]                      150:1/150:1
[DEBUG]                      6:1/6:1
[DEBUG] -            P:      3456:1
Context: Consumer node conv1_Conv (Conv2D#0) input #0
[INFO] - No producer node attached to input#0 for node conv1_Conv (Conv2D)
[DEBUG] -   also producer
[DEBUG] - ********************
[DEBUG] - List of consumers with their priors:
[DEBUG] -    - consumer: Relu (ReLU#0)
[DEBUG] -            required producers: []
[DEBUG] -            prior consumers: ["Relu (ReLU#0)"]
[DEBUG] -    - consumer: conv2_Conv (Conv2D#1)
[DEBUG] -            required producers: []
[DEBUG] -            prior consumers: ["Relu (ReLU#0)"]
[DEBUG] -    - consumer: Reshape (Reshape#0)
[DEBUG] -            required producers: []
[DEBUG] -            prior consumers: ["Relu (ReLU#0)"]
[DEBUG] -    - consumer: fc1_Gemm (FC#0)
[DEBUG] -            required producers: []
[DEBUG] -            prior consumers: ["Relu (ReLU#0)"]
[DEBUG] -    - consumer: fc2_Gemm (FC#1)
[DEBUG] -            required producers: []
[DEBUG] -            prior consumers: ["Relu (ReLU#0)"]
[DEBUG] -    - consumer: fc3_Gemm (FC#2)
[DEBUG] -            required producers: []
[DEBUG] -            prior consumers: ["Relu (ReLU#0)"]
[DEBUG] - Updated list of consumers:
[DEBUG] -    - consumer: Relu (ReLU#0)
[DEBUG] -            C/R:    0:0/3456:1
[DEBUG] -            P:      0:0
[DEBUG] - Runnable: Relu (ReLU#0)
[DEBUG] - Updating producer and consumer lists...
[DEBUG] -    - consumer: Relu (ReLU#0)
[DEBUG] -            C/R:    3456:1/3456:1
[DEBUG] -            P:      3456:1
[DEBUG] -   also producer
[DEBUG] - ********************
[DEBUG] - List of consumers with their priors:
[DEBUG] -    - consumer: MaxPool (MaxPooling2D#0)
[DEBUG] -            required producers: []
[DEBUG] -            prior consumers: ["MaxPool (MaxPooling2D#0)"]
[DEBUG] - Updated list of consumers:
[DEBUG] -    - consumer: MaxPool (MaxPooling2D#0)
[DEBUG] -            C/R:    0:0/3456:1
[DEBUG] -            P:      0:0
[DEBUG]                      0:0
[DEBUG] - Runnable: MaxPool (MaxPooling2D#0)
[DEBUG] - Updating producer and consumer lists...
[DEBUG] -    - consumer: MaxPool (MaxPooling2D#0)
[DEBUG] -            C/R:    3456:1/3456:1
[DEBUG] -            P:      864:1
[DEBUG]                      864:1
[DEBUG] -   also producer
[DEBUG] - ********************
[DEBUG] - List of consumers with their priors:
[DEBUG] -    - consumer: conv2_Conv (Conv2D#1)
[DEBUG] -            required producers: []
[DEBUG] -            prior consumers: ["conv2_Conv (Conv2D#1)"]
[DEBUG] - Updated list of consumers:
[DEBUG] -    - consumer: conv2_Conv (Conv2D#1)
[DEBUG] -            C/R:    0:0/864:1
[DEBUG]                      0:0/2400:1
[DEBUG]                      0:0/16:1
[DEBUG] -            P:      0:0
[DEBUG] - Runnable: conv2_Conv (Conv2D#1)
[DEBUG] - Updating producer and consumer lists...
[DEBUG] -    - consumer: conv2_Conv (Conv2D#1)
[DEBUG] -            C/R:    864:1/864:1
[DEBUG]                      2400:1/2400:1
[DEBUG]                      16:1/16:1
[DEBUG] -            P:      1024:1
[DEBUG] -   also producer
[DEBUG] - ********************
[DEBUG] - List of consumers with their priors:
[DEBUG] -    - consumer: Relu_1 (ReLU#1)
[DEBUG] -            required producers: []
[DEBUG] -            prior consumers: ["Relu_1 (ReLU#1)"]
[DEBUG] - Updated list of consumers:
[DEBUG] -    - consumer: Relu_1 (ReLU#1)
[DEBUG] -            C/R:    0:0/1024:1
[DEBUG] -            P:      0:0
[DEBUG] - Runnable: Relu_1 (ReLU#1)
[DEBUG] - Updating producer and consumer lists...
[DEBUG] -    - consumer: Relu_1 (ReLU#1)
[DEBUG] -            C/R:    1024:1/1024:1
[DEBUG] -            P:      1024:1
[DEBUG] -   also producer
[DEBUG] - ********************
[DEBUG] - List of consumers with their priors:
[DEBUG] -    - consumer: MaxPool_1 (MaxPooling2D#1)
[DEBUG] -            required producers: []
[DEBUG] -            prior consumers: ["MaxPool_1 (MaxPooling2D#1)"]
[DEBUG] - Updated list of consumers:
[DEBUG] -    - consumer: MaxPool_1 (MaxPooling2D#1)
[DEBUG] -            C/R:    0:0/1024:1
[DEBUG] -            P:      0:0
[DEBUG]                      0:0
[DEBUG] - Runnable: MaxPool_1 (MaxPooling2D#1)
[DEBUG] - Updating producer and consumer lists...
[DEBUG] -    - consumer: MaxPool_1 (MaxPooling2D#1)
[DEBUG] -            C/R:    1024:1/1024:1
[DEBUG] -            P:      256:1
[DEBUG]                      256:1
[DEBUG] -   also producer
[DEBUG] - ********************
[DEBUG] - List of consumers with their priors:
[DEBUG] -    - consumer: Reshape (Reshape#0)
[DEBUG] -            required producers: []
[DEBUG] -            prior consumers: ["Reshape (Reshape#0)"]
[DEBUG] - Updated list of consumers:
[DEBUG] -    - consumer: Reshape (Reshape#0)
[DEBUG] -            C/R:    0:0/256:1
[DEBUG]                      0:0/2:1
[DEBUG] -            P:      0:0
[DEBUG] - Runnable: Reshape (Reshape#0)
[DEBUG] - Updating producer and consumer lists...
[DEBUG] -    - consumer: Reshape (Reshape#0)
[DEBUG] -            C/R:    256:1/256:1
[DEBUG]                      2:1/2:1
[DEBUG] -            P:      0:1
[DEBUG] -   also producer
[DEBUG] - ********************
[DEBUG] - List of consumers with their priors:
[DEBUG] -    - consumer: fc1_Gemm (FC#0)
[DEBUG] -            required producers: []
[DEBUG] -            prior consumers: ["fc1_Gemm (FC#0)"]
[DEBUG] - Updated list of consumers:
[DEBUG] -    - consumer: fc1_Gemm (FC#0)
[DEBUG] -            C/R:    0:0/0:1
[DEBUG]                      0:0/30720:1
[DEBUG]                      0:0/120:1
[DEBUG] -            P:      0:0
[DEBUG] - Runnable: fc1_Gemm (FC#0)
[DEBUG] - Updating producer and consumer lists...
[DEBUG] -    - consumer: fc1_Gemm (FC#0)
[DEBUG] -            C/R:    0:1/0:1
[DEBUG]                      30720:1/30720:1
[DEBUG]                      120:1/120:1
[DEBUG] -            P:      0:1
[DEBUG] -   also producer
[DEBUG] - ********************
[DEBUG] - List of consumers with their priors:
[DEBUG] -    - consumer: Relu_2 (ReLU#2)
[DEBUG] -            required producers: []
[DEBUG] -            prior consumers: ["Relu_2 (ReLU#2)"]
[DEBUG] - Updated list of consumers:
[DEBUG] -    - consumer: Relu_2 (ReLU#2)
[DEBUG] -            C/R:    0:0/0:1
[DEBUG] -            P:      0:0
[DEBUG] - Runnable: Relu_2 (ReLU#2)
[DEBUG] - Updating producer and consumer lists...
[DEBUG] -    - consumer: Relu_2 (ReLU#2)
[DEBUG] -            C/R:    0:1/0:1
[DEBUG] -            P:      0:1
[DEBUG] -   also producer
[DEBUG] - ********************
[DEBUG] - List of consumers with their priors:
[DEBUG] -    - consumer: fc2_Gemm (FC#1)
[DEBUG] -            required producers: []
[DEBUG] -            prior consumers: ["fc2_Gemm (FC#1)"]
[DEBUG] - Updated list of consumers:
[DEBUG] -    - consumer: fc2_Gemm (FC#1)
[DEBUG] -            C/R:    0:0/0:1
[DEBUG]                      0:0/10080:1
[DEBUG]                      0:0/84:1
[DEBUG] -            P:      0:0
[DEBUG] - Runnable: fc2_Gemm (FC#1)
[DEBUG] - Updating producer and consumer lists...
[DEBUG] -    - consumer: fc2_Gemm (FC#1)
[DEBUG] -            C/R:    0:1/0:1
[DEBUG]                      10080:1/10080:1
[DEBUG]                      84:1/84:1
[DEBUG] -            P:      0:1
[DEBUG] -   also producer
[DEBUG] - ********************
[DEBUG] - List of consumers with their priors:
[DEBUG] -    - consumer: Relu_3 (ReLU#3)
[DEBUG] -            required producers: []
[DEBUG] -            prior consumers: ["Relu_3 (ReLU#3)"]
[DEBUG] - Updated list of consumers:
[DEBUG] -    - consumer: Relu_3 (ReLU#3)
[DEBUG] -            C/R:    0:0/0:1
[DEBUG] -            P:      0:0
[DEBUG] - Runnable: Relu_3 (ReLU#3)
[DEBUG] - Updating producer and consumer lists...
[DEBUG] -    - consumer: Relu_3 (ReLU#3)
[DEBUG] -            C/R:    0:1/0:1
[DEBUG] -            P:      0:1
[DEBUG] -   also producer
[DEBUG] - ********************
[DEBUG] - List of consumers with their priors:
[DEBUG] -    - consumer: fc3_Gemm (FC#2)
[DEBUG] -            required producers: []
[DEBUG] -            prior consumers: ["fc3_Gemm (FC#2)"]
[DEBUG] - Updated list of consumers:
[DEBUG] -    - consumer: fc3_Gemm (FC#2)
[DEBUG] -            C/R:    0:0/0:1
[DEBUG]                      0:0/840:1
[DEBUG]                      0:0/10:1
[DEBUG] -            P:      0:0
[DEBUG] - Runnable: fc3_Gemm (FC#2)
[DEBUG] - Updating producer and consumer lists...
[DEBUG] -    - consumer: fc3_Gemm (FC#2)
[DEBUG] -            C/R:    0:1/0:1
[DEBUG]                      840:1/840:1
[DEBUG]                      10:1/10:1
[DEBUG] -            P:      0:1
[DEBUG] - ********************
[DEBUG] - run: conv1_bias (Producer#1)
[DEBUG] - run: fc1_weight (Producer#5)
[DEBUG] - run: conv2_bias (Producer#3)
[DEBUG] - run: conv1_weight (Producer#0)
[DEBUG] - run: conv2_weight (Producer#2)
[DEBUG] - run: fc1_bias (Producer#6)
[DEBUG] - run: fc2_weight (Producer#7)
[DEBUG] - run: fc2_bias (Producer#8)
[DEBUG] - run: fc3_weight (Producer#9)
[DEBUG] - run: fc3_bias (Producer#10)
[DEBUG] - run: Constant (Producer#4)
[DEBUG] - run: conv1_Conv (Conv2D#0)
[DEBUG] - CUDNN initialized on device #0
[DEBUG] - run: Relu (ReLU#0)
[DEBUG] - run: MaxPool (MaxPooling2D#0)
[DEBUG] - run: conv2_Conv (Conv2D#1)
[DEBUG] - run: Relu_1 (ReLU#1)
[DEBUG] - run: MaxPool_1 (MaxPooling2D#1)
[DEBUG] - run: Reshape (Reshape#0)
[DEBUG] - run: fc1_Gemm (FC#0)
[DEBUG] - CUBLAS initialized on device #0
[DEBUG] - run: Relu_2 (ReLU#2)
[DEBUG] - run: fc2_Gemm (FC#1)
[DEBUG] - run: Relu_3 (ReLU#3)
[DEBUG] - run: fc3_Gemm (FC#2)
  • get the ouput: Before getting the output we need to set it to backend cpu

[8]:
for outNode in model.get_output_nodes():
    outNode.get_operator().get_output(0).to_backend('cpu')
    output_aidge = np.array(outNode.get_operator().get_output(0))
    print("Aidge output: {}".format(output_aidge))
    # Make sure to set the  output back to "cuda" otherwise the model will not be usable
    outNode.get_operator().get_output(0).to_backend('cuda')
Aidge output: [[-0.02935277  0.05858836  0.0634138  -0.05418663 -0.02147451  0.0766751
  -0.11431056  0.03077557  0.10714434  0.03006938]]