ONNX IR version: 0.0.3
Opset version: 8
Producer name:
Producer version:
Domain:
Model version: 0
Parsing model
While parsing node number 6 [PRelu -> "relu0"]:
ERROR: /opt/github4/onnx-tensorrt/ModelImporter.cpp:142 In function importNode:
[8] No importer registered for op: PRelu
Can we integrate this into the solution:
I come cross this problem too.no PRelu layer锛孒ow Can I solve this problem?
@deimsdeutsch we'll need to change the implementation, since how mxnet performs PReLU is different from Caffe. Parameters for mxnet PReLU will be different from caffe's implementation of PReLU.
Same problem while converting model from onnx( model from pytorch ) to trt.
same problem. with op ATen. actually it's a torch.max call.
Try changing the implementation of PReLU in onnx, which currently supports scalar values.
Eagerly waiting for the solution....
Eagerly waiting for the solution....
@coolbei Hi, I have the same problem with ATen, do you have a solution now?
@ibrahimsherdil
3 months and still waiting for the solution....
So I find a workaround for the PReLU problem if you stuck with this. You have to create an intermediate model which replace the PReLU with the original implementation of the PReLU:
PReLU = ReLU(x) - prelu_weight * ReLU(-x)
In that:
It will be a lot of work. So stay strong!!!
class PseudoPReLu(Module):
def __init__(self, num_parameters=1, init=0.25, inplace=True):
self.num_parameters = num_parameters
super(PseudoPReLu, self).__init__()
self.weight = Parameter(torch.Tensor(num_parameters).fill_(init))
self.inplace = inplace
def forward(self, input):
res = F.relu(input, inplace=self.inplace)
min_res = F.relu(-input, inplace=self.inplace)
weight_broadcast = self.weight.reshape(1, self.weight.shape[0], 1, 1)
return res - weight_broadcast * min_res
def extra_repr(self):
return 'num_parameters={}'.format(self.num_parameters)
I take @LovExtreme advice and reimplement PReLU with ReLU. Parsing with no problem.
Extending @hadeson's version to work for inputs other than 2D data tensors.
class PseudoPReLu(Module):
def __init__(self, num_parameters=1, init=0.25, inplace=True):
self.num_parameters = num_parameters
super(PseudoPReLu, self).__init__()
self.weight = Parameter(torch.Tensor(num_parameters).fill_(init))
self.inplace = inplace
def forward(self, input):
res = F.relu(input, inplace=self.inplace)
min_res = F.relu(-input, inplace=self.inplace)
weight_shape = [-1 if idx == 1 else 1 for idx in range(len(x.data.detach().shape))]
weight_broadcast = self.weight.reshape(*weight_shape)
return res - weight_broadcast * min_res
def extra_repr(self):
return 'num_parameters={}'.format(self.num_parameters)
Go to hell Nvidia.
Parsing model
While parsing node number 6 [PRelu -> "relu0"]:
ERROR: /opt/github/onnx-tensorrt-5.1/ModelImporter.cpp:143 In function importNode:
[8] No importer registered for op: PRelu
9 Months and no support...
I was putting hacks like this to replace unsupported operations since 2018...
It's nothing compared to conversion from TF (UFF) back to 2018...
PRelu has been supported since TensorRT 6.0. Closing this issue.
Most helpful comment
Go to hell Nvidia.