cdancette:

Yes, if your final output is an integer (that will be an index), then ofc it’s not differentiable (functions that outputs integers are not).
Why do you need to do something like this ?
If you’re training a classifier, you can just output a softmax, and train it to be the one hot encoding of your true label


I am currently doing a tricky thing. It’s a regression problem of xyz coordinates of an object. After inference of xyz coordinates, I want to convert them voxel style. For that, I want to use those regressed values as index of a matrix. To sum up, I want to know a differentiable way to convert coordinates into voxel.