def check_output(self, model, x): for opset_version in range(onnx_chainer.MINIMUM_OPSET_VERSION, onnx.defs.onnx_opset_version() + 1): test_onnxruntime.check_output(model, x, self.fn, opset_version=opset_version)
def test_output(self): for opset_version in range(test_onnxruntime.MINIMUM_OPSET_VERSION, onnx.defs.onnx_opset_version() + 1): test_onnxruntime.check_output(self.model, self.x, self.fn, opset_version=opset_version)
def test_variable_dicts(self): arg_names = ['x', 'y', 'z'] # current exporter ignores these names ins = { arg_names[i]: chainer.Variable(v) for i, v in enumerate(self.ins) } test_onnxruntime.check_output(self.model, ins, self.fn)
def test_output(self): for opset_version in range( onnx_chainer.MINIMUM_OPSET_VERSION, onnx.defs.onnx_opset_version() + 1): with self.assertRaises(RuntimeError): test_onnxruntime.check_output( self.model, self.x, self.fn, opset_version=opset_version)
def test_outputs(self): model = self.get_model() x = np.ones((1, 3), dtype=np.float32) # TODO(disktnk) output keys are not intuitive test_onnxruntime.check_output(model, x, 'IntermediateOutput.onnx', out_keys=['Identity_0', 'Gemm_1'])
def test_output(self): for opset_version in range( test_onnxruntime.MINIMUM_OPSET_VERSION, onnx.defs.onnx_opset_version() + 1): with warnings.catch_warnings(record=True) as w: test_onnxruntime.check_output( self.model, [self.x, self.rois], self.fn, opset_version=opset_version) assert len(w) == 1
def test_multiple_outputs(self): model = self.get_model(use_bn=self.use_bn, out_type=self.out_type) x = np.zeros((1, 3, 32, 32), dtype=np.float32) # 'out_keys' is necessary even if self.out_type is tuple or list # because onnxruntime does not guarantee the order of outputs when # output keys are None. test_onnxruntime.check_output(model, x, 'MultipleOutputs.onnx', out_keys=['Tanh_0', 'Sigmoid_0'])
def test_output(self): opset_ids = onnx_chainer.mapping.operators[self.info] minimum_version = max(onnx_chainer.MINIMUM_OPSET_VERSION, opset_ids[0]) for opset_version in range(minimum_version, onnx.defs.onnx_opset_version() + 1): test_onnxruntime.check_output(self.model, self.a, self.fn, opset_version=opset_version)
def test_output(self): for opset_version in range( onnx_chainer.MINIMUM_OPSET_VERSION, onnx.defs.onnx_opset_version() + 1): # TODO(hamaji): onnxruntime does not support Upsample-9 yet. # https://github.com/chainer/onnx-chainer/issues/111 if self.name == 'unpooling_2d' and opset_version == 9: continue test_onnxruntime.check_output( self.model, self.x, self.fn, opset_version=opset_version)
def test_implicit_input(self): x = chainer.Variable(np.array(1, dtype=np.float32)) test_onnxruntime.check_output(self.model, x, self.fn)
def test_variables(self): ins = [chainer.Variable(i) for i in self.ins] test_onnxruntime.check_output(self.model, ins, self.fn)
def test_arrays(self): test_onnxruntime.check_output(self.model, self.ins, self.fn)
def test_output(self): for opset_version in (9, ): test_onnxruntime.check_output(self.model, [self.x, self.t], 'softmax_cross_entropy.onnx', opset_version=opset_version)