Sha256: e5799da3e1589cf968d08177925decc323b2d117687046c4838aa96fafad40aa

Contents?: true

Size: 615 Bytes

Versions: 9

Compression:

Stored size: 615 Bytes

Contents

#include <torch/torch.h>

#include <rice/rice.hpp>

#include "utils.h"

void init_device(Rice::Module& m) {
  Rice::define_class_under<torch::Device>(m, "Device")
    .define_constructor(Rice::Constructor<torch::Device, const std::string&>())
    .define_method(
      "index",
      [](torch::Device& self) {
        return self.index();
      })
    .define_method(
      "index?",
      [](torch::Device& self) {
        return self.has_index();
      })
    .define_method(
      "type",
      [](torch::Device& self) {
        std::stringstream s;
        s << self.type();
        return s.str();
      });
}

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
torch-rb-0.18.0 ext/torch/device.cpp
torch-rb-0.17.1 ext/torch/device.cpp
torch-rb-0.17.0 ext/torch/device.cpp
torch-rb-0.16.0 ext/torch/device.cpp
torch-rb-0.15.0 ext/torch/device.cpp
torch-rb-0.14.1 ext/torch/device.cpp
torch-rb-0.14.0 ext/torch/device.cpp
torch-rb-0.13.2 ext/torch/device.cpp
torch-rb-0.13.1 ext/torch/device.cpp