Sha256: 73af1663a0dc0f326bad257dc20b53f9edd8baf0fe69269346972b7d41fc9709

Contents?: true

Size: 653 Bytes

Versions: 1

Compression:

Stored size: 653 Bytes

Contents

#include <torch/torch.h>

#include <rice/rice.hpp>

#include "utils.h"

void init_backends(Rice::Module& m) {
  auto rb_mBackends = Rice::define_module_under(m, "Backends");

  Rice::define_module_under(rb_mBackends, "OpenMP")
    .add_handler<torch::Error>(handle_error)
    .define_singleton_function("available?", &torch::hasOpenMP);

  Rice::define_module_under(rb_mBackends, "MKL")
    .add_handler<torch::Error>(handle_error)
    .define_singleton_function("available?", &torch::hasMKL);

  Rice::define_module_under(rb_mBackends, "MPS")
    .add_handler<torch::Error>(handle_error)
    .define_singleton_function("available?", &torch::hasMPS);
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
torch-rb-0.13.0 ext/torch/backends.cpp