![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1800265/image.png)
Batch inconsistency in PINNs!!
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MAHSA YOUSEFI
am 24 Okt. 2024
Kommentiert: MAHSA YOUSEFI
am 4 Nov. 2024
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 Kommentare
Akzeptierte Antwort
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)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1800265/image.png)
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
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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Pattern Recognition and Classification finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!