From 6bc8d81a5c47450720bd1d3a232a06c1be20066c Mon Sep 17 00:00:00 2001 From: ndem0 Date: Wed, 20 Mar 2024 13:19:17 +0000 Subject: [PATCH] :art: Format Python code with psf/black --- pina/model/avno.py | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/pina/model/avno.py b/pina/model/avno.py index b77e453..878185b 100644 --- a/pina/model/avno.py +++ b/pina/model/avno.py @@ -62,19 +62,26 @@ class AveragingNeuralOperator(KernelNeuralOperator): # check hidden dimensions match input_lifting_net = next(lifting_net.parameters()).size()[-1] output_lifting_net = lifting_net( - torch.rand(size=next(lifting_net.parameters()).size()) - ).shape[-1] - projecting_net_input=next(projecting_net.parameters()).size()[-1] + torch.rand(size=next(lifting_net.parameters()).size()) + ).shape[-1] + projecting_net_input = next(projecting_net.parameters()).size()[-1] - if len(field_indices)+len(coordinates_indices) != input_lifting_net: - raise ValueError('The lifting_net must take as input the ' - 'coordinates vector and the field vector.') - - if output_lifting_net+len(coordinates_indices) != projecting_net_input: - raise ValueError('The projecting_net input must be equal to' - 'the embedding dimension (which is the output) ' - 'of the lifting_net plus the dimension of the ' - 'coordinates, i.e. len(coordinates_indices).') + if len(field_indices) + len(coordinates_indices) != input_lifting_net: + raise ValueError( + "The lifting_net must take as input the " + "coordinates vector and the field vector." + ) + + if ( + output_lifting_net + len(coordinates_indices) + != projecting_net_input + ): + raise ValueError( + "The projecting_net input must be equal to" + "the embedding dimension (which is the output) " + "of the lifting_net plus the dimension of the " + "coordinates, i.e. len(coordinates_indices)." + ) # assign self.coordinates_indices = coordinates_indices @@ -108,4 +115,4 @@ class AveragingNeuralOperator(KernelNeuralOperator): new_batch = self._integral_kernels(new_batch) new_batch = concatenate((new_batch, points_tmp), dim=2) new_batch = self._projection_operator(new_batch) - return new_batch \ No newline at end of file + return new_batch