Sha256: f3d4aa7f029f8995d87cbb44b07d65e084c7e47d58b70d7d863476b1aaf3f04e

Contents?: true

Size: 660 Bytes

Versions: 18

Compression:

Stored size: 660 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")
    .add_handler<torch::Error>(handle_error)
    .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

18 entries across 18 versions & 1 rubygems

Version Path
torch-rb-0.13.0 ext/torch/device.cpp
torch-rb-0.12.2 ext/torch/device.cpp
torch-rb-0.12.1 ext/torch/device.cpp
torch-rb-0.12.0 ext/torch/device.cpp
torch-rb-0.11.2 ext/torch/device.cpp
torch-rb-0.11.1 ext/torch/device.cpp
torch-rb-0.11.0 ext/torch/device.cpp
torch-rb-0.10.2 ext/torch/device.cpp
torch-rb-0.10.1 ext/torch/device.cpp
torch-rb-0.10.0 ext/torch/device.cpp
torch-rb-0.9.2 ext/torch/device.cpp
torch-rb-0.9.1 ext/torch/device.cpp
torch-rb-0.9.0 ext/torch/device.cpp
torch-rb-0.8.3 ext/torch/device.cpp
torch-rb-0.8.2 ext/torch/device.cpp
torch-rb-0.8.1 ext/torch/device.cpp
torch-rb-0.8.0 ext/torch/device.cpp
torch-rb-0.7.0 ext/torch/device.cpp