pulp-platform / dory

A tool to deploy Deep Neural Networks on PULP-based SoC's
Apache License 2.0
72 stars 22 forks source link

Dory error during converting nemo's output onnx file #27

Closed mvtkurd closed 1 year ago

mvtkurd commented 2 years ago

hi @ABurrello

with the help of nemo I export the onxx file of my model but I got this error during converting onnx file to C code by dory :

Screenshot 2022-07-08 180205

here is my onnx model : my_model onnx (1)

Best, Milad

ABurrello commented 2 years ago

Hello, can you try to use the Alessio-refactoring branch? The error could be given by the first pad node which is not supported. Usually, it is included in the convolutional layers.

mvtkurd commented 2 years ago

Dear @ABurrello

I test it with Alessio-refactoring branch but the same error is occurred!

2

here is my model code for more clarification :

class DuelingDeepQNetwork(nn.Module): def __init__(self, learning_rate=0.0001,n_actions=6, input_dims=[4,200,200]): super(DuelingDeepQNetwork, self).__init__()

   ` # 3 convolutional layers
    self.conv1 = nn.Conv2d(4, 32, kernel_size=8, stride=4)
    self.relu1 = nn.ReLU()
    self.conv2 = nn.Conv2d(32, 64, kernel_size=4, stride=2)
    self.relu2 = nn.ReLU()
    self.conv3 = nn.Conv2d(64, 64, kernel_size=3, stride=1)
    self.relu3 = nn.ReLU()
    self.conv_output_dims = self.get_conv_output_dimensions(input_dims)

    # 2 fully-connected layers
    self.fc1 = nn.Linear(self.conv_output_dims, 1024)
    self.fcrelu1 = nn.ReLU()
    self.fc2 = nn.Linear(1024, 512)
    self.fcrelu2 = nn.ReLU()

    self.Value = nn.Linear(512, 1)
    self.Advantage = nn.Linear(512, 6)

    # Initialize optimizer and loss functions
    self.optimizer = optim.RMSprop(self.parameters(), lr=learning_rate)
    self.loss = nn.MSELoss()

def get_conv_output_dimensions(self,input_dims):
    """
    Returns the product of output dimensions of convoluted output to feed
    in linear classifier.
    """
    temp = torch.zeros(1,  *input_dims)
    dim1 = self.conv1(temp)
    dim2 = self.conv2(dim1)
    dim3 = self.conv3(dim2)
    return int(np.prod(dim3.size()))

def forward(self, data):
    """
    Feed forward the network to get the value, advantage tuple
    """
    conv_layer1 = self.relu1(self.conv1(data))

    conv_layer2 = self.relu2(self.conv2(conv_layer1))
    conv_layer3 = self.relu3(self.conv3(conv_layer2))

    output_conv_layer = conv_layer3.view(conv_layer3.size()[0], -1)

    fc_layer1 = self.fcrelu1(self.fc1(output_conv_layer))
    fc_layer2 = self.fcrelu2(self.fc2(fc_layer1))

    value = self.Value(fc_layer2)
    advantage = self.Advantage(fc_layer2)

    return value, advantage`
mvtkurd commented 1 year ago

Dear @ABurrello I've modified my model but now I have a new error during network generating by dory. Below image shows the error! dory_err