Generator

torch.Generator
class Generator(val device: Device)

Creates and returns a generator object that manages the state of the algorithm which produces pseudo random numbers.

Attributes

Source
Generator.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

Returns the Generator state as a [[torch.Tensor[UInt8]].

Returns the Generator state as a [[torch.Tensor[UInt8]].

Attributes

Source
Generator.scala

Returns the initial seed for generating random numbers.

Returns the initial seed for generating random numbers.

Attributes

Source
Generator.scala

Sets the seed for generating random numbers. Returns a torch.Generator object.

Sets the seed for generating random numbers. Returns a torch.Generator object.

It is recommended to set a large seed, i.e. a number that has a good balance of 0 and 1 bits. Avoid having many 0 bits in the seed.

Value parameters

seed

The desired seed. Value must be within the inclusive range [-0x8000_0000_0000_0000,0xffff_ffff_ffff_ffff]. Otherwise, a RuntimeError is raised. Negative inputs are remapped to positive values with the formula 0xffff_ffff_ffff_ffff + seed.

Attributes

Source
Generator.scala
def seed: Long

Gets a non-deterministic random number from std::random_device or the current time and uses it to seed a Generator.

Gets a non-deterministic random number from std::random_device or the current time and uses it to seed a Generator.

Attributes

Source
Generator.scala

Sets the Generator state.

Sets the Generator state.

Value parameters

newState

The desired state.

Attributes

Source
Generator.scala

Concrete fields

val device: Device

Attributes

Source
Generator.scala