Skip to content

Commit 66a200c

Browse files
committed
Check what happens if we remove view_ops
1 parent 0f5da80 commit 66a200c

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

pytensor/compile/function/types.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import pytensor
1515
import pytensor.compile.profiling
1616
from pytensor.compile.io import In, SymbolicInput, SymbolicOutput
17-
from pytensor.compile.ops import deep_copy_op, view_op
17+
from pytensor.compile.ops import deep_copy_op
1818
from pytensor.compile.profiling import ProfileStats
1919
from pytensor.configdefaults import config
2020
from pytensor.graph.basic import (
@@ -1260,9 +1260,11 @@ def insert_deepcopy(fgraph, wrapped_inputs, wrapped_outputs):
12601260
# and not(wrapped_outputs[i].borrow and wrapped_outputs[j].borrow):
12611261
if fgraph.outputs[j] in views_of_output_i:
12621262
if wrapped_outputs[i].borrow and wrapped_outputs[j].borrow:
1263-
fgraph.change_node_input(
1264-
*output_client, view_op(original_out), reason=reason
1265-
)
1263+
pass
1264+
1265+
# fgraph.change_node_input(
1266+
# *output_client, view_op(original_out), reason=reason
1267+
# )
12661268
else:
12671269
fgraph.change_node_input(
12681270
*output_client, deep_copy_op(original_out), reason=reason
@@ -1287,11 +1289,11 @@ def insert_deepcopy(fgraph, wrapped_inputs, wrapped_outputs):
12871289
if input_j in fgraph.inputs:
12881290
j = fgraph.inputs.index(input_j)
12891291
if wrapped_outputs[i].borrow and wrapped_inputs[j].borrow:
1290-
fgraph.change_node_input(
1291-
*output_client,
1292-
view_op(original_out),
1293-
reason=reason,
1294-
)
1292+
# fgraph.change_node_input(
1293+
# *output_client,
1294+
# view_op(original_out),
1295+
# reason=reason,
1296+
# )
12951297
break
12961298
else:
12971299
fgraph.change_node_input(
@@ -1301,11 +1303,11 @@ def insert_deepcopy(fgraph, wrapped_inputs, wrapped_outputs):
13011303
)
13021304
break
13031305
elif wrapped_outputs[i].borrow:
1304-
fgraph.change_node_input(
1305-
*output_client,
1306-
view_op(original_out),
1307-
reason=reason,
1308-
)
1306+
# fgraph.change_node_input(
1307+
# *output_client,
1308+
# view_op(original_out),
1309+
# reason=reason,
1310+
# )
13091311
break
13101312
else:
13111313
fgraph.change_node_input(

pytensor/tensor/subtensor.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2203,12 +2203,16 @@ def c_code(self, node, name, input_names, output_names, sub):
22032203
}}
22042204
}}
22052205
}}
2206+
if ({output_name}==NULL){{
2207+
printf("Have to allocate new AdvancedSubtensor1 output\n");
2208+
}}
22062209
{output_name} = (PyArrayObject*)PyArray_TakeFrom(
22072210
{a_name}, (PyObject*){i_name}, 0, {output_name}, NPY_RAISE);
22082211
if ({output_name} == NULL) {fail};
22092212
"""
22102213

22112214
def c_code_cache_version(self):
2215+
return None
22122216
return (4,)
22132217

22142218

0 commit comments

Comments
 (0)