Batch inconsistency in PINNs!!

48 次查看(过去 30 天)
MAHSA YOUSEFI
MAHSA YOUSEFI 2024-10-24,14:51
评论: MAHSA YOUSEFI 2024-11-4,12:12
Hi there!
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!

采纳的回答

praguna manvi
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
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.
MAHSA YOUSEFI
MAHSA YOUSEFI 2024-11-4,12:12
@praguna manvi I can see now!! The key point was then in "the software automatically permutes the dimensions such that the format has dimensions in the order: "S", ''C", "B", and .... ". I appreciate for your answer.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Pattern Recognition and Classification 的更多信息

产品


版本

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by