    def test_do_not_fuse_with_add_not_1d(self):
        """
        We can't turn conv2d into conv2d_bias if the thing we do
        an add with is not 1d.
        """

        # Keep IntImm batch here just not to mess with profiling strategy
        B = [1]
        batch_dim = shape_utils.gen_int_var_min_max(B, name="batch_dim")
        CO, HH, WW, CI = 256, 28, 28, 128
        filter_HW = 3

        bias = Tensor(
            shape=[batch_dim, 26, 26, CO], dtype="float16", name="bias", is_input=True
        )
        conv2d = self._build_conv2d(batch_dim, CO, HH, WW, CI, filter_HW)
        output = ops.elementwise(FuncEnum.ADD)(bias, conv2d)
        output._attrs["is_output"] = True
        output._attrs["name"] = "output_0"

        target = detect_target()
        module = compile_model(
            output, target, "./tmp", "test_do_not_fuse_with_add_not_1d"
        )

        check_tensor = None
        for tensor in module.debug_sorted_graph:
            if tensor._attrs["name"] == "output_0":
                check_tensor = tensor
                break
        self.assertIsNotNone(check_tensor)
        self.assertEqual(len(check_tensor.src_ops()), 1)
        src_op = list(check_tensor.src_ops())[0]
        self.assertEqual(src_op._attrs["op"], "fused_elementwise")

        for b in B:
            X_pt = torch.randn(b, CI, HH, WW).cuda().half()
            W_pt = torch.randn(CO, CI, filter_HW, filter_HW).cuda().half()
            Y_pt = torch.nn.functional.conv2d(X_pt, W_pt)
            B_pt = torch.randn(Y_pt.size()).cuda().half()
            Y_pt = Y_pt + B_pt

            x = X_pt.permute((0, 2, 3, 1)).contiguous()
            w = W_pt.permute((0, 2, 3, 1)).contiguous()
            b_pt = B_pt.permute((0, 2, 3, 1)).contiguous()
            inputs = {"input_0": x, "input_1": w, "bias": b_pt}

            y = torch.empty([b, 26, 26, CO]).cuda().half()
            module.run_with_tensors(inputs, [y])
            y_transpose = y.permute(0, 3, 1, 2)
            self.assertTrue(torch.allclose(Y_pt, y_transpose, atol=1e-1, rtol=1e-1))
We can't turn conv2d into conv2d_bias if the thing we do
an add with is not 1d.
tests/unittest/compiler/test_fuse_conv_elementwise.py