Batch inconsistency in PINNs!!

4 Ansichten (letzte 30 Tage)
MAHSA YOUSEFI
MAHSA YOUSEFI am 24 Okt. 2024
Kommentiert: MAHSA YOUSEFI am 4 Nov. 2024
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!

Akzeptierte Antwort

praguna manvi
praguna manvi am 29 Okt. 2024
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 Kommentare
praguna manvi
praguna manvi am 4 Nov. 2024
Bearbeitet: praguna manvi am 4 Nov. 2024
@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 am 4 Nov. 2024
@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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Pattern Recognition and Classification finden Sie in Help Center und File Exchange

Produkte


Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by