class MXNet::Random

Overview

Random number interface of MXNet.

Defined in:

mxnet/random.cr

Class Method Summary

Class Method Detail

def self.seed(seed_state : Int32, ctx : Context | ::Symbol = :all) #

Seeds the random number generators in MXNet.

This affects the behavior of modules in MXNet that use random number generators, like the dropout operator and the NDArray random sampling operators.

Parameters

  • seed_state (Int32) The random number seed.
  • ctx (Context or :all for all devices, default :all) The device context of the generator. The default is :all which means seeding random number generators of all devices.

Notes

Random number generators in MXNet are device specific. .seed(seed_state) sets the state of each generator using seed_state and the device id. Therefore, random numbers generated from different devices can be different even if they are seeded using the same seed.


[View source]