@@ -18,9 +18,7 @@ def clone_model(self, model: ir.Model) -> ir.Model:
18
18
19
19
def test_conv_affine_fusion (self ):
20
20
tape = ir .tape .Tape ()
21
- x = ir .Input (
22
- "x" , shape = ir .Shape ([1 , 3 , 32 , 32 ]), type = ir .TensorType (ir .DataType .FLOAT )
23
- )
21
+ x = ir .val ("x" , dtype = ir .DataType .FLOAT , shape = ir .Shape ([1 , 3 , 32 , 32 ]))
24
22
w = tape .initializer (ir .tensor (np .ones ((3 , 3 , 3 , 3 ), dtype = np .float32 ), name = "w" ))
25
23
b = tape .initializer (ir .tensor (np .ones ((3 ,), dtype = np .float32 ), name = "b" ))
26
24
scale = tape .initializer (ir .tensor (np .array ([2.0 ], dtype = np .float32 ), name = "scale" ))
@@ -31,10 +29,10 @@ def test_conv_affine_fusion(self):
31
29
z = tape .op (
32
30
"Add" ,
33
31
[mul_out , offset ],
34
- output = ir .Input (
32
+ output = ir .val (
35
33
"z" ,
34
+ dtype = ir .DataType .FLOAT ,
36
35
shape = ir .Shape ([1 , 3 , 32 , 32 ]),
37
- type = ir .TensorType (ir .DataType .FLOAT ),
38
36
),
39
37
)
40
38
@@ -65,9 +63,7 @@ def test_conv_affine_fusion(self):
65
63
66
64
def test_affine_conv_fusion_without_pad (self ):
67
65
tape = ir .tape .Tape ()
68
- x = ir .Input (
69
- "x" , shape = ir .Shape ([1 , 3 , 32 , 32 ]), type = ir .TensorType (ir .DataType .FLOAT )
70
- )
66
+ x = ir .val ("x" , dtype = ir .DataType .FLOAT , shape = ir .Shape ([1 , 3 , 32 , 32 ]))
71
67
w = tape .initializer (ir .tensor (np .ones ((3 , 3 , 3 , 3 ), dtype = np .float32 ), name = "w" ))
72
68
b = tape .initializer (ir .tensor (np .ones ((3 ,), dtype = np .float32 ), name = "b" ))
73
69
scale = tape .initializer (ir .tensor (np .array ([2.0 ], dtype = np .float32 ), name = "scale" ))
@@ -77,10 +73,10 @@ def test_affine_conv_fusion_without_pad(self):
77
73
z = tape .op (
78
74
"Add" ,
79
75
[mul_out , offset ],
80
- output = ir .Input (
76
+ output = ir .val (
81
77
"z" ,
78
+ dtype = ir .DataType .FLOAT ,
82
79
shape = ir .Shape ([1 , 3 , 32 , 32 ]),
83
- type = ir .TensorType (ir .DataType .FLOAT ),
84
80
),
85
81
)
86
82
conv_out = tape .op ("Conv" , [z , w , b ], attributes = {"pads" : [0 , 0 , 0 , 0 ]})
0 commit comments