You won’t be able to change the pre-built binaries so would need to build PyTorch from source as described here.
The easier approach to change the backward method of a specific operation would be to implement a custom autograd.Function and write the backward method manually as described e.g. here.
But, before doing it, can you specify where the original tanh’s backwar function is?
I could find the forward function of it, but i cannot find the backward of tanh’s.
I want to check the exact math expression of tanh’s backward function.
How backward of tanh is coded. So, I want where is this directory is.
And i have to know exactly what output is.
For example, (tanh function) y = tanh(x), output should be y, right?
Then, at the forward path, it must be something like ‘ctx.save_for_backward(output)’.
So, i presume those kind of things. But i want to see it.
I searched myself through all the directories of pytorch github. But I could not understand the structure of it. So, i lost myself and don’t know where to go.