Closed durswd closed 4 years ago
It seems that broadcasting test exists...
Looking the ONNXRuntime's test, shape of slope
(= W
in Chainer) is (num, 1)
, not (num,)
. If shape of W
on this PR is (5, 1)
, not (5,)
, ONNXRuntime would be pass, but Chainer does not allow the dimension.
Actually add the below condition to convert_PReLUFunction
, the test is passed.
def convert_PReLUFunction(
func, opset_version, input_names, output_names, context):
# ...
elif opset_version == 7:
w = func.inputs[1].get_variable()
if broadcast_is_needed:
slope = w[:, None]
input_names[1] = context.add_param(slope, input_names[1])
return onnx_helper.make_node('PRelu', input_names, output_names),
To support Chainer's broadcasting on PRelu
accepting different rank (=ndim), have to fix ONXN-Chainer converter. We need more discussion about this and out of scope of this PR, so close.
When we would get requirements about Chainer's broadcasting spec or increasing test coverage of chainer.functions
, we'll support them on Chainer's repository. Thanks.
ONNXRuntime looks not to support broadcasting on PRelu, but PRelu test is split https://github.com/chainer/onnx-chainer/blob/v1.5.0/tests/functions_tests/test_activations.py#L56 so you can omit it, or add another test pattern on split it.