Home Reference Source
public class | source

Vol

Store a 3D volume of numbers with width(sx), height(sy), depth(depth) for the network. It also holds weights and gradients w.r.t the weights.

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

depth: *

public

dw: *

public
public

sy: *

public

w: *

Method Summary

Public Methods
public

add(x: number, y: number, d: number, v: number)

Address the node and add the given value(v) to its weight.

public

addFrom(volume: Vol)

Add the weights of a given network volume to current network

public

addFromScaled(volume: Vol, alpha: number)

Add the weights of a given network volume with scale alpha to current network

public

add_grad(x: number, y: number, d: number, v: number)

Address the node and add the given value(v) to its gradient.

public

clone(): Vol

Return a clone of current network with the same parameters, only reset gradients to 0

public

Return a clone of current network and initialize the weights and gradients as 0

public

fromJSON(obj: VolInterface)

Reset the netwrok information parameters informations

public

get(x: number, y: number, d: number): number

Address the node and return its weight.

public

Address the node by given width(x), height(y) and depth(d), then return the index of this node in the flatten 1D list.

public

Address the node and return its gradient.

public

init(sx: undefined, sy: undefined, depth: number, c: number)

Initialize the network input placeholders and parameters

  • If the given width is an array, we assume that 1D volume is provided
  • If the given width/height/depth are all number, it will be treated as a 3D vlumn
public

set(x: number, y: number, d: number, v: number)

Address the node and reset its weight to the given value(v).

public

setConst(value: number)

Reset the weights of current network to a given constant number value

public

set_grad(x: number, y: number, d: number, v: number)

Address the node and reset its gradient to the given value(v).

public

toJSON(): VolInterface

Expose the netwrok parameters information

Public Constructors

public constructor() source

Public Members

public depth: * source

public dw: * source

public sx: number source

public sy: * source

public w: * source

Public Methods

public add(x: number, y: number, d: number, v: number) source

Address the node and add the given value(v) to its weight.

Params:

NameTypeAttributeDescription
x number
y number
d number
v number

public addFrom(volume: Vol) source

Add the weights of a given network volume to current network

Params:

NameTypeAttributeDescription
volume Vol

public addFromScaled(volume: Vol, alpha: number) source

Add the weights of a given network volume with scale alpha to current network

Params:

NameTypeAttributeDescription
volume Vol
alpha number

public add_grad(x: number, y: number, d: number, v: number) source

Address the node and add the given value(v) to its gradient.

Params:

NameTypeAttributeDescription
x number
y number
d number
v number

public clone(): Vol source

Return a clone of current network with the same parameters, only reset gradients to 0

Return:

Vol

public cloneAndZero(): Vol source

Return a clone of current network and initialize the weights and gradients as 0

Return:

Vol

public fromJSON(obj: VolInterface) source

Reset the netwrok information parameters informations

Params:

NameTypeAttributeDescription
obj VolInterface

public get(x: number, y: number, d: number): number source

Address the node and return its weight.

Params:

NameTypeAttributeDescription
x number
y number
d number

Return:

number

public getNodeIndex(x: number, y: number, d: number): number source

Address the node by given width(x), height(y) and depth(d), then return the index of this node in the flatten 1D list.

Params:

NameTypeAttributeDescription
x number
y number
d number

Return:

number

public get_grad(x: number, y: number, d: number): number source

Address the node and return its gradient.

Params:

NameTypeAttributeDescription
x number
y number
d number

Return:

number

public init(sx: undefined, sy: undefined, depth: number, c: number) source

Initialize the network input placeholders and parameters

  • If the given width is an array, we assume that 1D volume is provided
  • If the given width/height/depth are all number, it will be treated as a 3D vlumn

Params:

NameTypeAttributeDescription
sx undefined
sy undefined
depth number
c number

public set(x: number, y: number, d: number, v: number) source

Address the node and reset its weight to the given value(v).

Params:

NameTypeAttributeDescription
x number
y number
d number
v number

public setConst(value: number) source

Reset the weights of current network to a given constant number value

Params:

NameTypeAttributeDescription
value number

public set_grad(x: number, y: number, d: number, v: number) source

Address the node and reset its gradient to the given value(v).

Params:

NameTypeAttributeDescription
x number
y number
d number
v number

public toJSON(): VolInterface source

Expose the netwrok parameters information

Return:

VolInterface