Skip to content

Commit

Permalink
style: pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Dec 2, 2024
1 parent c34ecf6 commit 1a0b085
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion autograd/numpy/numpy_boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class ArrayBox(Box):
def __getitem__(A, idx):
return A[idx]

def item(self): return self[(0,) * len(self.shape)]
def item(self):
return self[(0,) * len(self.shape)]

# Constants w.r.t float data just pass though
shape = property(lambda self: self._value.shape)
Expand Down
3 changes: 3 additions & 0 deletions autograd/numpy/numpy_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ def column_stack(tup):
arrays.append(arr)
return concatenate(arrays, 1)


def _maybe_unwrap(a):
"""Unwrap scalar arrays that do not contain sequences."""
from autograd.numpy.numpy_boxes import ArrayBox

if not a.shape: # it is a scalar array
if isinstance(a, ArrayBox):
if not isinstance(a._value, (list, tuple)):
Expand All @@ -75,6 +77,7 @@ def _maybe_unwrap(a):
return a.item()
return a


def array(A, *args, **kwargs):
t = builtins.type(A)
if t in (list, tuple):
Expand Down

0 comments on commit 1a0b085

Please sign in to comment.