Hello Thank you for viewing my post,
I have error in finding dy/dx for the following case:
y = [2,3,4] ( This values are determined by function f(x) this may be different every time they are called)
and I have x = [3,4,5] …
What I mean to say is y is not directly a function of x (All the Examples I found on Youtube/Google involve declaring x and setting y as a function of x with mathematical functions)

How can i find dy/dx using tensor.?
Thank you for reading my question I would mean i lot if you could help me

Example of what I want:
Lets say I have following data:
y = [2,3,4]
x = [1,2,3]
then dy/dx for first element is Δy/ Δx = (3-2)/(2-1) = 1
(Euler Backward)
similarly for other elements

If y is not depending on x, it seems you won’t be able to use Autograd and the chain rule to calculate the gradients. Could you describe in more detail how y is calculated?

Thank you very much.
y is taken from a prestored pandas dataframe (Solution of a Differential equation calculated using FEM methods) and x is the spatial domain.
Thank you once again

In this case you might either need to implement the FEM in a differentiable way or try to calculate the gradinets somehow analytically. I don’t know how PyTorch or rather Autograd would be able to compute the backward pass without the actual computation graph.

Thank you
The tutorials on youtube don’t give a detailed behind the scene structure of pytorch I found only this video https://www.youtube.com/watch?v=MswxJw-8PvE&t=281s
Can you suggest some other resource or material …