Sha256: 1813d1214a33ade15fee291a722b45d5793a9b6985761adf592caa31d9bdf261

Contents?: true

Size: 580 Bytes

Versions: 1

Compression:

Stored size: 580 Bytes

Contents

#include <torch/torch.h>

#include <rice/Constructor.hpp>
#include <rice/Module.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, std::string>())
    .define_method("index", &torch::Device::index)
    .define_method("index?", &torch::Device::has_index)
    .define_method(
      "type",
      *[](torch::Device& self) {
        std::stringstream s;
        s << self.type();
        return s.str();
      });
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
torch-rb-0.6.0 ext/torch/device.cpp