def test_add_op():
    """
    Test add statement to an empty program, also change the output
    """

    @mb.program(input_specs=[mb.TensorSpec(shape=(2, 4))])
    def prog(x0):
        return x0

    print("before:\n{}".format(prog))
    block = prog.functions["main"]
    x0 = block.inputs["x0"]
    with block:
        x1 = mb.log(x=x0)
    block.set_outputs([x1])
    print("after:\n{}".format(prog))
    assert block.inputs["x0"] == block.find_ops(op_type="log")[0].inputs["x"]
    assert len(block.operations) == 2 # const op for epsilon + log
    assert list(block.operations)[1].op_type == "log"
    assert block.outputs[0] == x1

    Test add statement to an empty program, also change the output
    
coremltools/converters/mil/mil/tests/test_block.py