From 03710e07c8fc8b0cd80dc03429a3ac63a8cb1134 Mon Sep 17 00:00:00 2001 From: FilippoOlivo Date: Thu, 7 Nov 2024 15:38:30 +0100 Subject: [PATCH] Solve #377 in 0.2 --- pina/domain/operation_interface.py | 2 +- pina/domain/union_domain.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pina/domain/operation_interface.py b/pina/domain/operation_interface.py index 0300f524..abe3be2b 100644 --- a/pina/domain/operation_interface.py +++ b/pina/domain/operation_interface.py @@ -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." ) diff --git a/pina/domain/union_domain.py b/pina/domain/union_domain.py index 0af8e1bd..8b4e0efd 100644 --- a/pina/domain/union_domain.py +++ b/pina/domain/union_domain.py @@ -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)