def conv(scope, operator, container): W = operator.raw_operator.W op = OnnxSub(operator.inputs[0], W, output_names=operator.outputs) op.add_to(scope, container) text = str(container) if 'name:"Sub"' not in text: raise AssertionError("Unnamed operator:\n".format(text)) nin = list(op.enumerate_initial_types()) nno = list(op.enumerate_nodes()) nva = list(op.enumerate_variables()) assert len(nin) == 1 assert nin[0][0] == 'input' assert nin[0][1].shape == [1, 2] assert len(nno) == 1 assert nno[0].output_names == ['variable'] assert len(nva) == 1 assert isinstance(nva[0], tuple) assert nva[0][1] == 0
def conv(scope, operator, container): dtype = guess_numpy_type(operator.inputs[0].type) W = operator.raw_operator.W.astype(dtype) op = OnnxSub( operator.inputs[0], W, output_names=operator.outputs, op_version=TARGET_OPSET) op.add_to(scope, container) text = str(container) if 'name:"Su_Sub"' not in text: raise AssertionError( "Unnamed operator: '{}'".format(text)) nin = list(op.enumerate_initial_types()) nno = list(op.enumerate_nodes()) nva = list(op.enumerate_variables()) assert len(nin) == 1 assert nin[0][0] == 'input' assert nin[0][1].shape == [None, 2] assert len(nno) == 1 assert nno[0].output_names == ['variable'] assert len(nva) == 1 assert isinstance(nva[0], tuple) assert nva[0][1] == 0
def conv(scope, operator, container): W = operator.raw_operator.W op = OnnxSub(operator.inputs[0], W, output_names=operator.outputs) op.add_to(scope, container) text = str(container) assert 'name:"Sub"' in text