def _test_elementwise_binary(
        self, context, op_name, op, test_input, num_constants, expected_result
    ):
        """Helper function, runs op on test input and compares against expected result"""
        constants, input_list, output_name = self._gen_constants(
            num_constants, test_input
        )
        eb_node = InternalTorchIRNode(
            kind=op_name, inputs=input_list, outputs=[output_name]
        )
        ssa = self._construct_test_graph(
            context, op, eb_node, output_name, constants=constants
        )
        np.testing.assert_allclose(expected_result, ssa.val, atol=1e-6)
Helper function, runs op on test input and compares against expected result
coremltools/converters/mil/frontend/torch/test/test_internal_graph.py