Skip to content

Commit

Permalink
Solve #377 in 0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
FilippoOlivo committed Nov 7, 2024
1 parent 02addbf commit 03710e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pina/domain/operation_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def _check_dimensions(self, geometries):
:type geometries: list[Location]
"""
for geometry in geometries:
if geometry.variables != geometries[0].variables:
if sorted(geometry.variables) != sorted(geometries[0].variables):
raise NotImplementedError(
f"The geometries need to have same dimensions and labels."
)
5 changes: 2 additions & 3 deletions pina/domain/union_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,9 @@ def sample(self, n, mode="random", variables="all"):
sampled_points.append(
geometry.sample(
num_points + int(i < remainder), mode, variables
)
).sort_labels()
)
# in case number of sampled points is smaller than the number of geometries
if len(sampled_points) >= n:
break

return LabelTensor(torch.cat(sampled_points), labels=self.variables)
return LabelTensor.cat(sampled_points)

0 comments on commit 03710e0

Please sign in to comment.