Skip to content

Commit 81988be

Browse files
committed
Simplify Numba implementation of Alloc
1 parent a77c9ee commit 81988be

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
@@ -68,7 +68,7 @@ def numba_funcify_Alloc(op, node, **kwargs):
6868
shape_var_item_names = [f"{name}_item" for name in shape_var_names]
6969
shapes_to_items_src = indent(
7070
"\n".join(
71-
f"{item_name} = to_scalar({shape_name})"
71+
f"{item_name} = {shape_name}.item()"
7272
for item_name, shape_name in zip(
7373
shape_var_item_names, shape_var_names, strict=True
7474
)
@@ -86,7 +86,7 @@ def numba_funcify_Alloc(op, node, **kwargs):
8686

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

0 commit comments

Comments
 (0)