Hi everyone,

I’m currently trying to train a physics informed NN and I have a (probably very) simple question regarding autograd.
My training samples are points in space and time, i.e. a two-dimensional tensor and my question is as follows. When I compute the gradient wrt. the training data, i.e.

trainingData,
create_graph=True,
allow_unused=True)

and I want to obtain the time derivative (first component of training data) of u, does the time derivative coincide with this quantity:

And similarly, If I want to obtain the spatial derivative, would It be this quantity:

Thank you very much for your help!

Best
Fabian

Hi Fabian!

I don’t understand what you are saying here.

import torch
torch.__version__

def  f (x, y):
return x * y

x = torch.Tensor ([2.0])
y = torch.Tensor ([3.0])
u = f (x, y)


Here is its output:

>>> import torch
>>> torch.__version__
'1.6.0'
>>>
>>> def  f (x, y):
...     return x * y
...
>>> x = torch.Tensor ([2.0])
>>> y = torch.Tensor ([3.0])
>>> u = f (x, y)


Best.

K. Frank

Hi Frank,

thank you very much for your explanation, it is indeed very helpful!

Sorry, I was very unspecific. I wanted to say that the input for my NN is simply (t,x)\in \R^2.

Again, thank you very much.

Best
Fabian