Sha256: 6590bfc66af31d8c352d88c7a4c5401a967705b13f6b2363293435601d76b729

Contents?: true

Size: 549 Bytes

Versions: 18

Compression:

Stored size: 549 Bytes

Contents

#include <torch/torch.h>

#include <rice/rice.hpp>

#include "utils.h"

void init_random(Rice::Module& m) {
  Rice::define_module_under(m, "Random")
    .add_handler<torch::Error>(handle_error)
    .define_singleton_function(
      "initial_seed",
      []() {
        return at::detail::getDefaultCPUGenerator().current_seed();
      })
    .define_singleton_function(
      "seed",
      []() {
        // TODO set for CUDA when available
        auto generator = at::detail::getDefaultCPUGenerator();
        return generator.seed();
      });
}

Version data entries

18 entries across 18 versions & 1 rubygems

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