I want to use torch.distributions.Gumbel in C++ by using libtorch, so I try the following code:
torch::distributions::Gumbel gumbel_distribution(norm_weight, torch::ones_like(norm_weight)); auto weight_phi = gumbel_distribution.rsample();
However, when I try to compile the code, it reports error like the following:
error: name followed by “::” must be a class or namespace name
So later I ask ChatGpt on how to implement it, and it shows me the following code:
#include <torch/torch.h> #include <torch/distributions/gumbel.h> double location = 0.0; double scale = 1.0; torch::distributions::Gumbel gumbel(location, scale);
When I try to compile this code, my laptop reports that the file “torch/distributions/gumbel.h” does not exist! Later I ask ChatGpt the same question again, and it gives me the following answer:
The torch::distributions::Gumbel class I mentioned in my previous answer is not available in the C++ API of PyTorch as of version 1.10.0.
So I am wondering if I can use torch.distributions.Gumbel through libtorch now?Many thanks!