Batch inconsistency in PINNs!!
48 次查看(过去 30 天)
显示 更早的评论
Hi there!
I am working on this example: Solve PDE Using Physics-Informed Neural Network
Based on the following highlights extracted from this example:
X0 = [x0IC x0BC1 x0BC2]; %numBoundaryConditionPoints = [25 25];
T0 = [t0IC t0BC1 t0BC2]; %numInitialConditionPoints = 50;
points = rand(numInternalCollocationPoints,2); %numInternalCollocationPoints=10000
dataX = 2*points(:,1)-1;
dataT = points(:,2);
These mean:
- dataX and dataT are column vectors of length 10000.
- X0, and T0 are two row vectors of length 100, i.e. 50+25+25
The following dlarray formats make sense because of column vectors X, T and row vectors X0, T0.
X = dlarray(dataX,"BC");
T = dlarray(dataT,"BC");
X0 = dlarray(X0,"CB");
T0 = dlarray(T0,"CB");
What I cannot underestant from model function is these parts:
XT = cat(1,X,T); %====>???!!!
U = forward(net,XT);
and
XT0 = cat(1,X0,T0);
U0Pred = forward(net,XT0);
Shouldn't it be as below?
XT = cat(2,X,T);
U = forward(net,XT);
How it has been worked?
Thanks in advance for any clarification!
0 个评论
采纳的回答
praguna manvi
2024-10-29,8:38
As I see, you are looking for an explanation of the function “cat(1, X, T)” which concatenates on dimension 1 for the following Physics-Informed Neural Network (PINN) example:
openExample('nnet/TrainPhysicsInformedNeuralNetworkWithLBFGSAndAutoDiffExample’)
In this example, the network expects input features of size “2C x 1B”, meaning 2 features with a batch size of “B”. You can visualize the network using:
analyzeNetwork(net)
In the example, the dimensions of “X”, “T”, “X0”, and “T0” are in the data format “1(C) x 10000(B) and 1(C) x 100(B)” respectively. Using “cat(1, X, T)”, you create an input feature of size “2(C) x 10000(B)”, which matches the feature input size expected by the neural network. On the other hand, “cat(2, X, T)” would create a size of “1(C) x 20000(B)” on dimension two.
For more information on data format and functions on “dlarray” refer to the following link:
3 个评论
praguna manvi
2024-11-4,4:48
编辑:praguna manvi
2024-11-4,4:49
@MAHSA YOUSEFI, the dimensions of "dataX" and "dataY" in the following lines of the example:
X = dlarray(dataX, "BC");
T = dlarray(dataT, "BC");
are 10000 x 1, which is read in the format as "BC". This results in "X" & "T" being "1(C) x 10000(B)". Therefore, we can concatenate them along dimension 1.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Pattern Recognition and Classification 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!