    def _test_consecutive_1s_broadcast(
        self,
        ks,
        test_name,
        expected_max_read_t,
        expected_read_types,
        expected_op_t,
        expected_data_t,
        dtype="float16",
    ):
        """
        Tests A(1, 1, K, 1, 1, K) / B(1, 1, 1, 1, 1, 1).
        """

        k_dim = shape_utils.gen_int_var_min_max(ks)

        X1 = Tensor(
            shape=[IntImm(1), IntImm(1), k_dim, IntImm(1), IntImm(1), k_dim],
            dtype=dtype,
            name="input0",
            is_input=True,
        )
        X2 = Tensor(
            shape=[IntImm(1), IntImm(1), IntImm(1), IntImm(1), IntImm(1), IntImm(1)],
            dtype=dtype,
            name="input1",
            is_input=True,
        )
        X3 = ops.elementwise(FuncEnum.DIV)(X1, X2)
        X3._attrs["name"] = "output0"
        X3._attrs["is_output"] = True
        self.assertEqual(X3._attrs["shape"], X1._attrs["shape"])

        target = detect_target()
        module = compile_model(X3, target, "./tmp", test_name)

        debug_sorted_graph = module.debug_sorted_graph
        sorted_ops = graph_utils.get_sorted_ops(debug_sorted_graph)
        self.assertEqual(len(sorted_ops), 1)
        self.assertEqual(sorted_ops[0]._attrs["op"], "fused_elementwise")
        self.assertEqual(sorted_ops[0]._attrs["max_read_t"], expected_max_read_t)
        self.assertEqual(
            self._get_sorted_read_types(sorted_ops[0]), expected_read_types
        )
        self.assertEqual(sorted_ops[0]._attrs["op_t"], expected_op_t)
        self.assertEqual(sorted_ops[0]._attrs["data_t"], expected_data_t)

        for k in ks:
            x1_pt = get_random_torch_tensor([1, 1, k, 1, 1, k], dtype=dtype)
            x2_pt = get_random_torch_tensor([1, 1, 1, 1, 1, 1], dtype=dtype)
            x3_pt = x1_pt / x2_pt
            inputs = {"input0": x1_pt, "input1": x2_pt}
            x3 = torch.empty_like(x3_pt)
            module.run_with_tensors(inputs, [x3])
            self.assertTrue(torch.allclose(x3, x3_pt, atol=1e-2, rtol=1e-2))
Tests A(1, 1, K, 1, 1, K) / B(1, 1, 1, 1, 1, 1).
tests/unittest/ops/test_fused_elementwise_broadcast.py