aai-institute / continuiti

Learning function operators with neural networks.
GNU Lesser General Public License v3.0
19 stars 3 forks source link

Fix typo in assertion statement in DeepONet architecture #54

Closed MLuchmann closed 6 months ago

MLuchmann commented 6 months ago

Bugfix: PR Fix typo in assertion statement in DeepONet architecture

Description

There was a type in assertion statement.

samuelburbulla commented 6 months ago

I think the assertion should be:

assert y.shape[-1:] == torch.Size([self.shapes.y.dim])

as y will have shape (batch_size * #evaluations, y_dim). Note that we put #evaluations into the batch dim.

We could also check for the first dimension (and alike for all other tensors) if we infer the batch_size from the inputs.

MLuchmann commented 6 months ago

I think the assertion should be:

assert y.shape[-1:] == torch.Size([self.shapes.y.dim])

You are completely right.

We could also check for the first dimension (and alike for all other tensors) if we infer the batch_size from the inputs.

The first dimension is merged with #evaluations which can change during inference times (so it won't be equal to self.shapes.y.num any longer). Inferring both from the input: batch size and #evaluations doesn't make much sense I believe. Therefore, I think your first proposal makes the most sense.