initializers

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package initializers include several weight initializers, to be used with context. They implement computation.VariableInitializer type.

Index

Constants

View Source
const NoSeed = int64(0)

Variables

This section is empty.

Functions

func Finalize added in v0.4.0

func Finalize()

Finalize will clear the global state kept alive and free up the memory. Namely, the random number generator states.

Used for testing and debugging.

func One

func One(graph *Graph, shape shapes.Shape) *Node

One initializes variables with one.

func Zero

func Zero(graph *Graph, shape shapes.Shape) *Node

Zero initializes variables with zero.

Types

type VariableInitializer

type VariableInitializer func(graph *Graph, shape shapes.Shape) *Node

VariableInitializer builds a node that returns a value to initialize a variable of the given shape. It is defined in the Context.

func RandomNormalFn

func RandomNormalFn(initialSeed int64, stddev float64) VariableInitializer

RandomNormalFn returns an initializer that generates random normal values with the given standard deviation and mean set to 0.

The parameter `initialSeed` is used to initialize the random number generator -- only the first time it is used for a graph. If it is set to 0 (NoSeed), a random seed is instead generated (from the nanosecond clock).

func RandomUniformFn

func RandomUniformFn(initialSeed int64, min, max float64) VariableInitializer

RandomUniformFn return an initializer that generates a random uniform values from [min, max).

The parameter `initialSeed` is used to initialize the random number generator -- only the first time it is used for a graph. If it is set to 0 (NoSeed), a random seed is instead generated (from the nanosecond clock).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL