dfalbel / torch

torch from R!
http://dfalbel.github.io/torch
Other
50 stars 5 forks source link

is_pinned #39

Open dfalbel opened 5 years ago

dfalbel commented 5 years ago

I was unable to implement the method is_pinned:

// [[Rcpp::export]]
bool tensor_is_pinned_ (Rcpp::XPtr<torch::Tensor> x) {
  auto storage = x->storage();
  return storage.is_pinned();
}

tensor.cpp:1299:18: error: no member named 'is_pinned' in 'c10::Storage'
  return storage.is_pinned();
         ~~~~~~~ ^

The method is available in python: https://pytorch.org/docs/stable/storage.html#torch.FloatStorage.is_pinned.

However it does not seem to be available in the c10::Storage class.