Skip to content

Commit

Permalink
Fix using Box as variable in functional math
Browse files Browse the repository at this point in the history
  • Loading branch information
holl- committed Jan 31, 2024
1 parent 1229800 commit 1f4745e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions phi/geom/_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ def __init__(self, lower: Tensor = None, upper: Tensor = None, **size: Optional[
self._upper = math.expand(self._upper, vector_shape)
if self.size.vector.item_names is None:
warnings.warn("Creating a Box without item names prevents certain operations like project()", DeprecationWarning, stacklevel=2)
self._shape = self._lower.shape & self._upper.shape

def __getitem__(self, item):
item = _keep_vector(slicing_dict(self, item))
Expand Down Expand Up @@ -320,9 +321,7 @@ def __variable_attrs__(self):

@property
def shape(self):
if self._lower is None or self._upper is None:
return None
return self._lower.shape & self._upper.shape
return self._shape

@property
def lower(self):
Expand Down

0 comments on commit 1f4745e

Please sign in to comment.