Sha256: 1a7e76fdf55ea337c8639388f06419a837c5ea16d478ad6e2668a495e5b3a313

Contents?: true

Size: 1.42 KB

Versions: 12

Compression:

Stored size: 1.42 KB

Contents

#include <torch/torch.h>

#include <rice/rice.hpp>

void init_fft(Rice::Module& m);
void init_linalg(Rice::Module& m);
void init_nn(Rice::Module& m);
void init_special(Rice::Module& m);
void init_tensor(Rice::Module& m, Rice::Class& c, Rice::Class& rb_cTensorOptions);
void init_torch(Rice::Module& m);

void init_backends(Rice::Module& m);
void init_cuda(Rice::Module& m);
void init_device(Rice::Module& m);
void init_generator(Rice::Module& m, Rice::Class& rb_cGenerator);
void init_ivalue(Rice::Module& m, Rice::Class& rb_cIValue);
void init_random(Rice::Module& m);

extern "C"
void Init_ext()
{
  auto m = Rice::define_module("Torch");

  // need to define certain classes up front to keep Rice happy
  auto rb_cIValue = Rice::define_class_under<torch::IValue>(m, "IValue")
    .define_constructor(Rice::Constructor<torch::IValue>());
  auto rb_cGenerator = Rice::define_class_under<torch::Generator>(m, "Generator");
  auto rb_cTensor = Rice::define_class_under<torch::Tensor>(m, "Tensor");
  auto rb_cTensorOptions = Rice::define_class_under<torch::TensorOptions>(m, "TensorOptions")
    .define_constructor(Rice::Constructor<torch::TensorOptions>());

  // keep this order
  init_torch(m);
  init_tensor(m, rb_cTensor, rb_cTensorOptions);
  init_nn(m);
  init_fft(m);
  init_linalg(m);
  init_special(m);

  init_backends(m);
  init_cuda(m);
  init_device(m);
  init_generator(m, rb_cGenerator);
  init_ivalue(m, rb_cIValue);
  init_random(m);
}

Version data entries

12 entries across 12 versions & 1 rubygems

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