Open SemyonTab opened 3 months ago
torch_amax works fine by the way:
m_tensor <- torch_tensor(matrix(1:8, nrow = 2), dtype = torch_float64(), requires_grad = TRUE) n <- torch_amax(m_tensor, dim = 2) n_sum <- torch_sum(n) n_sum$backward() m_tensor$grad
Returns:
torch_tensor 0 0 0 1 0 0 0 1 [ CPUDoubleType{2,4} ]
Seems that the backward pass does not work with torch_max function, or I made a mistake somewhere. R code:
Fails with an error:
Analogous code in Python seems to work fine:
Returns:
I would greatly appreciate your help, thanks!