@@ -38,15 +38,15 @@ def test_vectorize_blockwise():
38
38
assert new_vect_node .inputs [0 ] is tns4
39
39
40
40
41
- class TestOp (Op ):
41
+ class MyTestOp (Op ):
42
42
def make_node (self , * inputs ):
43
43
return Apply (self , inputs , [i .type () for i in inputs ])
44
44
45
45
def perform (self , * args , ** kwargs ):
46
46
raise NotImplementedError ("Test Op should not be present in final graph" )
47
47
48
48
49
- test_op = TestOp ()
49
+ test_op = MyTestOp ()
50
50
51
51
52
52
def test_vectorize_node_default_signature ():
@@ -56,7 +56,7 @@ def test_vectorize_node_default_signature():
56
56
57
57
vect_node = vectorize_node (node , mat , mat )
58
58
assert isinstance (vect_node .op , Blockwise ) and isinstance (
59
- vect_node .op .core_op , TestOp
59
+ vect_node .op .core_op , MyTestOp
60
60
)
61
61
assert vect_node .op .signature == ("(i00),(i10,i11)->(o00),(o10,o11)" )
62
62
@@ -88,7 +88,7 @@ def test_blockwise_shape():
88
88
89
89
shape_fn = pytensor .function ([inp ], out .shape )
90
90
assert not any (
91
- isinstance (getattr (n .op , "core_op" , n .op ), TestOp )
91
+ isinstance (getattr (n .op , "core_op" , n .op ), MyTestOp )
92
92
for n in shape_fn .maker .fgraph .apply_nodes
93
93
)
94
94
assert tuple (shape_fn (inp_test )) == (5 , 3 , 4 )
@@ -100,13 +100,13 @@ def test_blockwise_shape():
100
100
101
101
shape_fn = pytensor .function ([inp ], out .shape )
102
102
assert any (
103
- isinstance (getattr (n .op , "core_op" , n .op ), TestOp )
103
+ isinstance (getattr (n .op , "core_op" , n .op ), MyTestOp )
104
104
for n in shape_fn .maker .fgraph .apply_nodes
105
105
)
106
106
107
107
shape_fn = pytensor .function ([inp ], out .shape [:- 1 ])
108
108
assert not any (
109
- isinstance (getattr (n .op , "core_op" , n .op ), TestOp )
109
+ isinstance (getattr (n .op , "core_op" , n .op ), MyTestOp )
110
110
for n in shape_fn .maker .fgraph .apply_nodes
111
111
)
112
112
assert tuple (shape_fn (inp_test )) == (5 , 4 )
@@ -124,20 +124,20 @@ def test_blockwise_shape():
124
124
125
125
shape_fn = pytensor .function ([inp1 , inp2 ], [out .shape for out in outs ])
126
126
assert any (
127
- isinstance (getattr (n .op , "core_op" , n .op ), TestOp )
127
+ isinstance (getattr (n .op , "core_op" , n .op ), MyTestOp )
128
128
for n in shape_fn .maker .fgraph .apply_nodes
129
129
)
130
130
131
131
shape_fn = pytensor .function ([inp1 , inp2 ], outs [0 ].shape )
132
132
assert not any (
133
- isinstance (getattr (n .op , "core_op" , n .op ), TestOp )
133
+ isinstance (getattr (n .op , "core_op" , n .op ), MyTestOp )
134
134
for n in shape_fn .maker .fgraph .apply_nodes
135
135
)
136
136
assert tuple (shape_fn (inp1_test , inp2_test )) == (7 , 5 , 3 , 4 )
137
137
138
138
shape_fn = pytensor .function ([inp1 , inp2 ], [outs [0 ].shape , outs [1 ].shape [:- 1 ]])
139
139
assert not any (
140
- isinstance (getattr (n .op , "core_op" , n .op ), TestOp )
140
+ isinstance (getattr (n .op , "core_op" , n .op ), MyTestOp )
141
141
for n in shape_fn .maker .fgraph .apply_nodes
142
142
)
143
143
assert tuple (shape_fn (inp1_test , inp2_test )[0 ]) == (7 , 5 , 3 , 4 )
0 commit comments