Solved by CoderHam in post #2 
              
              
                torch::Double can’t be casted to double directly, you should use output_tensor[i][j][k].item().to<double>(). It first converts a Tensor with a single value to a ScalarType then to a double.