Skip to content

Commit 00e008b

Browse files
majosminducer
authored andcommitted
copy axes and tags in zeros_like/full_like
1 parent 85e4285 commit 00e008b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

arraycontext/impl/pytato/fake_numpy.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ def __getattr__(self, name):
7373

7474
def zeros_like(self, ary):
7575
def _zeros_like(array):
76-
return self._array_context.zeros(array.shape, array.dtype)
76+
return self._array_context.zeros(
77+
array.shape, array.dtype).copy(axes=array.axes, tags=array.tags)
7778

7879
return self._array_context._rec_map_container(
7980
_zeros_like, ary, default_scalar=0)
@@ -83,7 +84,8 @@ def ones_like(self, ary):
8384

8485
def full_like(self, ary, fill_value):
8586
def _full_like(subary):
86-
return pt.full(subary.shape, fill_value, subary.dtype)
87+
return pt.full(subary.shape, fill_value, subary.dtype).copy(
88+
axes=subary.axes, tags=subary.tags)
8789

8890
return self._array_context._rec_map_container(
8991
_full_like, ary, default_scalar=fill_value)

0 commit comments

Comments
 (0)