Sha256: af77a4c9e5e16dab3c15dce6a9dd274e36f3b2a5f321d7590a812e1abdf57cd3

Contents?: true

Size: 504 Bytes

Versions: 9

Compression:

Stored size: 504 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")
    .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

9 entries across 9 versions & 1 rubygems

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