At::torch::variable::autograd type convert

Hi ~
I made the model with libtorch. So I want to extract and convert at::torch::variable::autograd to c++ float
but i can’t access tensor directly

anyone help me?

Oh i fixed it
i using data_ptr()
In below is my solution

weight[a][b][c][d]= (*(float*)T[a][b][c][d].data_ptr());

This will also work:

weight[a][b][c][d]= T[a][b][c][d].item().toFloat();