We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, after I generate the onnx file using a Lenet 5 pytorch model, running the code dtypes = {} (outputs, placeholders, variables, constants, operators) = ng.from_onnx(onnx_filename, value_dtypes=dtypes, default_placeholder_dtype=act_dtype, default_variable_dtype=weight_dtype, default_constant_dtype=weight_dtype, default_operator_dtype=act_dtype, default_scale_dtype=scale_dtype, default_bias_dtype=bias_dtype, disable_fusion=disable_fusion)
dtypes = {} (outputs, placeholders, variables, constants, operators) = ng.from_onnx(onnx_filename, value_dtypes=dtypes, default_placeholder_dtype=act_dtype, default_variable_dtype=weight_dtype, default_constant_dtype=weight_dtype, default_operator_dtype=act_dtype, default_scale_dtype=scale_dtype, default_bias_dtype=bias_dtype, disable_fusion=disable_fusion)
I got this error.
KeyError Traceback (most recent call last) in 1 dtypes = {} 2 (outputs, placeholders, variables, ----> 3 constants, operators) = ng.from_onnx(onnx_filename, 4 value_dtypes=dtypes, 5 default_placeholder_dtype=act_dtype,
~/.linuxbrew/opt/[email protected]/lib/python3.8/site-packages/nngen/onnx/init.py in from_onnx(filename, value_dtypes, value_shapes, default_placeholder_dtype, default_variable_dtype, default_constant_dtype, default_operator_dtype, default_scale_dtype, default_bias_dtype, onnx_input_layout, onnx_filter_layout, disable_fusion, verbose) 327 328 for name, output_node in output_nodes.items(): --> 329 visitor.visit(name) 330 331 # outputs
~/.linuxbrew/opt/[email protected]/lib/python3.8/site-packages/nngen/onnx/init.py in visit(self, name) 144 node = util.search_node_from_model(self.model, name) 145 --> 146 node_func = _get_func(node.op_type) 147 node_op = node_func(self, node) 148
~/.linuxbrew/opt/[email protected]/lib/python3.8/site-packages/nngen/onnx/init.py in _get_func(op_type) 73 74 def _get_func(op_type): ---> 75 return func_map[op_type] 76 77
KeyError: 'MatMul'
My Lenet 5 model:
`import torch import torchvision import torch.nn as nn import torch.nn.functional as F
class Lenet5(nn.Module): # Constructer #def init(self, out_1 = 20, out_2 = 50, hidden_1 = 500): def init(self, out_1 = 6, out_2 = 16, hidden_1 = 120, hidden_2 = 84): super(Lenet5, self).init() # CNN1 out channel num and CNN2 out channel num self.out1 = out_1 self.out2 = out_2
# CNN1 self.conv1 = nn.Conv2d(in_channels = 1, out_channels= out_1, kernel_size=5, stride = 1, bias = False) self.maxpool1 = nn.MaxPool2d(kernel_size = 2, padding = 2) # CNN2 self.conv2 = nn.Conv2d(in_channels = out_1, out_channels = out_2, kernel_size=5, stride = 1, bias = False) self.maxpool2 = nn.MaxPool2d(kernel_size = 2, padding = 2) # Linear layer self.fc1 = nn.Linear(out_2 * 4 * 4, hidden_1, bias = False) self.fc2 = nn.Linear(hidden_1, hidden_2, bias = False) self.fc3 = nn.Linear(hidden_2, 10, bias = False) def forward(self, x): x = F.relu(self.conv1(x)) x = F.max_pool2d(x, 2, 2) x = F.relu(self.conv2(x)) x = F.max_pool2d(x, 2, 2) x = x.reshape(-1, 4*4*self.out2) x = F.relu(self.fc1(x)) x = F.relu(self.fc2(x)) x = self.fc3(x) return x #return F.log_softmax(x, dim=1) # Output in each steps def activation(self, x): z1 = self.conv1(x) a1 = torch.relu(z1) out = self.maxpool1(a1) z2 = self.conv2(out) a2 = torch.relu(z2) out1 = self.maxpool2(a2) out = out.view(out.size(0), -1) return z1, a1, z2, a2, out1, out`
The text was updated successfully, but these errors were encountered:
Hello. I'm getting the same error while using an onnx file as input. How did you fix it?
Sorry, something went wrong.
No branches or pull requests
Hi, after I generate the onnx file using a Lenet 5 pytorch model, running the code
dtypes = {} (outputs, placeholders, variables, constants, operators) = ng.from_onnx(onnx_filename, value_dtypes=dtypes, default_placeholder_dtype=act_dtype, default_variable_dtype=weight_dtype, default_constant_dtype=weight_dtype, default_operator_dtype=act_dtype, default_scale_dtype=scale_dtype, default_bias_dtype=bias_dtype, disable_fusion=disable_fusion)
I got this error.
KeyError Traceback (most recent call last)
in
1 dtypes = {}
2 (outputs, placeholders, variables,
----> 3 constants, operators) = ng.from_onnx(onnx_filename,
4 value_dtypes=dtypes,
5 default_placeholder_dtype=act_dtype,
~/.linuxbrew/opt/[email protected]/lib/python3.8/site-packages/nngen/onnx/init.py in from_onnx(filename, value_dtypes, value_shapes, default_placeholder_dtype, default_variable_dtype, default_constant_dtype, default_operator_dtype, default_scale_dtype, default_bias_dtype, onnx_input_layout, onnx_filter_layout, disable_fusion, verbose)
327
328 for name, output_node in output_nodes.items():
--> 329 visitor.visit(name)
330
331 # outputs
~/.linuxbrew/opt/[email protected]/lib/python3.8/site-packages/nngen/onnx/init.py in visit(self, name)
144 node = util.search_node_from_model(self.model, name)
145
--> 146 node_func = _get_func(node.op_type)
147 node_op = node_func(self, node)
148
~/.linuxbrew/opt/[email protected]/lib/python3.8/site-packages/nngen/onnx/init.py in _get_func(op_type)
73
74 def _get_func(op_type):
---> 75 return func_map[op_type]
76
77
KeyError: 'MatMul'
My Lenet 5 model:
`import torch
import torchvision
import torch.nn as nn
import torch.nn.functional as F
class Lenet5(nn.Module):
# Constructer
#def init(self, out_1 = 20, out_2 = 50, hidden_1 = 500):
def init(self, out_1 = 6, out_2 = 16, hidden_1 = 120, hidden_2 = 84):
super(Lenet5, self).init()
# CNN1 out channel num and CNN2 out channel num
self.out1 = out_1
self.out2 = out_2
The text was updated successfully, but these errors were encountered: