Skip to content

"NoneType" in self.losses method  #1

@kmarchais

Description

@kmarchais

Hello, thank you very much for the study and providing the code.

When I try to run it, I am unfortunately encountering the following issue.

u0_train.shape =  (2400, 4)
u0_testing.shape =  (600, 4)
xyz_train.shape (2400, 5000, 4)
xyz_testing.shape (600, 5000, 4)
s_train.shape =  (2400, 5000, 1)
s_testing.shape =  (600, 5000, 1)
Compiling model...
'build' took 0.000001 s

Traceback (most recent call last):
  File "/home/kmarchais/dev/IA/GeomDeepONet/Example1/Code/GeomDeepONet_DistanceSplit.py", line 347, in <module>
    model.compile(
  File "/home/kmarchais/miniforge3/envs/deep_learning/lib/python3.10/site-packages/deepxde/utils/internal.py", line 22, in wrapper
    result = f(*args, **kwargs)
  File "/home/kmarchais/miniforge3/envs/deep_learning/lib/python3.10/site-packages/deepxde/model.py", line 137, in compile
    self._compile_tensorflow_compat_v1(lr, loss_fn, decay)
  File "/home/kmarchais/miniforge3/envs/deep_learning/lib/python3.10/site-packages/deepxde/model.py", line 186, in _compile_tensorflow_compat_v1
    losses_train = losses(self.data.losses_train)
  File "/home/kmarchais/miniforge3/envs/deep_learning/lib/python3.10/site-packages/deepxde/model.py", line 172, in losses
    losses = losses_fn(
  File "/home/kmarchais/miniforge3/envs/deep_learning/lib/python3.10/site-packages/deepxde/data/data.py", line 13, in losses_train
    return self.losses(targets, outputs, loss_fn, inputs, model, aux=aux)
  File "/home/kmarchais/dev/IA/GeomDeepONet/Example1/Code/GeomDeepONet_DistanceSplit.py", line 109, in losses
    return loss_fn(targets, outputs)
  File "/home/kmarchais/miniforge3/envs/deep_learning/lib/python3.10/site-packages/deepxde/losses.py", line 23, in mean_squared_error
    return bkd.reduce_mean(bkd.square(y_true - y_pred))
TypeError: unsupported operand type(s) for -: 'NoneType' and 'NoneType'

I have ran the ResampleData.py script first and modified in the DistanceSplit script the path to the folder containing the data.
Could you please help me understand what I did wrong and how to resolve this issue? I have the same problem with both GeomDeepONet and DeepONet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions