lululxvi / deeponet

Learning nonlinear operators via DeepONet
Other
474 stars 130 forks source link

If the input of the trunk net could be set to be different #28

Open cb-sjtu opened 1 year ago

cb-sjtu commented 1 year ago

Hello Dr. Lu,

I am Bo Chen from SJTU. We had some communication before in online conference, and I have read your code of the article"A comprehensive and fair comparison of two neural operators (with practical extensions) based on FAIR data". It is really wonderful work and I have learnt a lot from it.

But it can be found that in the cases you offered, the input of the trunk net is always the same distribution for every input of the branch net so that the data can be set by "dde.data.TripleCartesianProd()" with a grid of only one distribution.

However in my application, the input of the trunk net must be different distribution because of the data limitation of labels. This situation is just
mentioned in your article as case I or case II ,which means different u have the different locations of ξ.

image

I have made same attempts but it seems that the shape of data_trunknet is fixed and hard to be changed. And I also see a type of error "ValueError("DeepONet does not support setting trunk net input.")" in the code even though I did not meet this kind of error in my attempts.

So I wonder if there is a method of that could feed the input of the trunk net with different distribution to DEEPONET. If possible, could you give me some guidance or a simple demo is better.

Thanks very much!

Looking forword to your reply!

lululxvi commented 1 year ago

See https://deepxde.readthedocs.io/en/latest/demos/operator/antiderivative_unaligned.html

cb-sjtu commented 1 year ago

Dr. Lu, Thank you very much for your reply! I have read this demo before. But the "random location x" in this demo is "only one". I wonder if the input shape could be (dataset size, Nu, dimension), i.e., (10000,100, 1) for the training dataset of the trunk net , whose "Nu" is defined in the demo of "Antiderivative operator from an aligned dataset". So I mean that in the demo of "Antiderivative operator from an aligned dataset", We assume that for each u, we have the values of u(x) in the same Nu=100 locations. But if deeponet could handle this dataset that for each u, we have the values of u(x) in the different Nu=100 locations.

cb-sjtu commented 1 year ago

And I have made this problem done by editing the code you provide named as "darcy_triangular_notch" which don't use deepxde and is easier to be edited. But I am still looking forword to your reply about the confusion above.

lululxvi commented 1 year ago

Then you can see the example https://deepxde.readthedocs.io/en/latest/demos/operator/antiderivative_aligned.html

cb-sjtu commented 1 year ago

Dr. Lu, Thank you very much for your reply! I have figured out how to set the "unaligned dataset" thanks to your guidance. Another mystery that I'm not sure about the dataset is whether the "unaligned dataset" could be feed into POD_DeepONet. In my opinion, it can't be done because of the "tf.concat" about "self.pod_basis" and "x_loc". Looking forword to your reply please!

lululxvi commented 1 year ago

You are right.

cb-sjtu commented 1 year ago

Thank you very much! Best wishes!