Skip to content

Commit 54a328c

Browse files
committed
Simplify Numba implementation of Alloc
1 parent 61b8164 commit 54a328c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pytensor/link/numba/dispatch/tensor_basic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def numba_funcify_Alloc(op, node, **kwargs):
7070
shapes_to_items_src = indent(
7171
"\n".join(
7272
[
73-
f"{item_name} = to_scalar({shape_name})"
73+
f"{item_name} = {shape_name}.item()"
7474
for item_name, shape_name in zip(shape_var_item_names, shape_var_names)
7575
]
7676
),
@@ -87,7 +87,7 @@ def numba_funcify_Alloc(op, node, **kwargs):
8787

8888
alloc_def_src = f"""
8989
def alloc(val, {", ".join(shape_var_names)}):
90-
val_np = np.asarray(val)
90+
val_np = val
9191
{shapes_to_items_src}
9292
scalar_shape = {create_tuple_string(shape_var_item_names)}
9393
{check_runtime_broadcast_src}

0 commit comments

Comments
 (0)