BatchNorm2d Type

Applies Batch Normalization over a 4D input (a mini-batch of 2D inputs with optional additional channel dimension)

The mean and standard-deviation are calculated per-dimension over the mini-batches and \(\gamma\( and \(\beta\) are learnable parameter vectors of size \(C\) (where \(C\) is the input size). By default, the elements of \(\gamma\) are set to 1 and the elements of \(\beta\) are set to 0. The standard-deviation is calculated via the biased estimator, equivalent to dfx.var(input, unbiased=False).

Also by default, during training this layer keeps running estimates of its computed mean and variance, which are then used for normalization during evaluation. The running estimates are kept with a default momentum of 0.1.

If trackRunningStats is set to False, this layer then does not keep running estimates, and batch statistics are instead used during evaluation time as well.

Constructors

Constructor Description

BatchNorm2d(numFeatures, ?eps, ?momentum, ?affine, ?trackRunningStats, ?reversible)

Full Usage: BatchNorm2d(numFeatures, ?eps, ?momentum, ?affine, ?trackRunningStats, ?reversible)

Parameters:
    numFeatures : int
    ?eps : double
    ?momentum : Tensor
    ?affine : bool
    ?trackRunningStats : bool
    ?reversible : bool

Returns: BatchNorm2d
numFeatures : int
?eps : double
?momentum : Tensor
?affine : bool
?trackRunningStats : bool
?reversible : bool
Returns: BatchNorm2d

Instance members

Instance member Description

this.bias

Full Usage: this.bias

Returns: Tensor

TBD

Returns: Tensor

this.mean

Full Usage: this.mean

Returns: Tensor

TBD

Returns: Tensor

this.stddev

Full Usage: this.stddev

Returns: Tensor

TBD

Returns: Tensor

this.variance

Full Usage: this.variance

Returns: Tensor

TBD

Returns: Tensor

this.weight

Full Usage: this.weight

Returns: Tensor

TBD

Returns: Tensor

Inherited members

Inherited from ModelBase

Instance members

Instance member Description

this.addBuffer (buffer, name)

Full Usage: this.addBuffer (buffer, name)

Parameters:
buffer : Parameter
name : string

this.addBuffer buffers

Full Usage: this.addBuffer buffers

Parameters:
buffers : (Parameter * string)[]

this.addBuffer buffers

Full Usage: this.addBuffer buffers

Parameters:
buffers : Parameter[]

this.addModel (model, name)

Full Usage: this.addModel (model, name)

Parameters:
    model : Model
    name : string

model : Model
name : string

this.addModel models

Full Usage: this.addModel models

Parameters:
    models : (Model * string)[]

models : (Model * string)[]

this.addModel models

Full Usage: this.addModel models

Parameters:
models : Model[]

this.addModel (model, name)

Full Usage: this.addModel (model, name)

Parameters:
model : ModelBase
name : string

this.addModel models

Full Usage: this.addModel models

Parameters:
models : (ModelBase * string)[]

this.addModel models

Full Usage: this.addModel models

Parameters:
models : ModelBase[]

this.addParameter (parameter, name)

Full Usage: this.addParameter (parameter, name)

Parameters:
parameter : Parameter
name : string

this.addParameter parameters

Full Usage: this.addParameter parameters

Parameters:
parameters : (Parameter * string)[]

this.addParameter parameters

Full Usage: this.addParameter parameters

Parameters:
parameters : Parameter[]

this.clone ()

Full Usage: this.clone ()

Returns: ModelBase

TBD

Returns: ModelBase

this.eval ()

Full Usage: this.eval ()

TBD

this.forwardDiff (derivatives, ?nestingTag)

Full Usage: this.forwardDiff (derivatives, ?nestingTag)

Parameters:
    derivatives : ParameterDict - The derivatives of the parameters
    ?nestingTag : uint32 - The level tag for nested differentiation. Defaults to the current global nesting level

Adjust the parameters of the model to initiate a new level of forward-mode automatic differentiation.

After this call the current parameters of the model will have attached derivatives for forward mode differentiation.

derivatives : ParameterDict

The derivatives of the parameters

?nestingTag : uint32

The level tag for nested differentiation. Defaults to the current global nesting level

this.init f

Full Usage: this.init f

Parameters:

TBD

f : string * Tensor -> Tensor

this.move (?device, ?dtype, ?backend)

Full Usage: this.move (?device, ?dtype, ?backend)

Parameters:

Moves the state (parameters and buffers) of the model to the given configuration

?device : Device
?dtype : Dtype
?backend : Backend

this.noDiff ()

Full Usage: this.noDiff ()

TBD

this.reverseDiff ?nestingTag

Full Usage: this.reverseDiff ?nestingTag

Parameters:
    ?nestingTag : uint32 - The level tag for nested differentiation. Defaults to the current global nesting level

Adjust the parameters of the model to initiate a new level of reverse-mode automatic differentiation.

After this call the current parameters of the model will support reverse-mode differentiation. After the completion of the corresponding reverse operation, the computed derivatives will be available.

?nestingTag : uint32

The level tag for nested differentiation. Defaults to the current global nesting level

this.summary ()

Full Usage: this.summary ()

Returns: string

TBD

Returns: string

this.train ()

Full Usage: this.train ()

TBD

this.backend

Full Usage: this.backend

Returns: Backend
Returns: Backend

this.state

Full Usage: this.state

Returns: ParameterDict

TBD

Returns: ParameterDict

this.buffers

Full Usage: this.buffers

Returns: ParameterDict

TBD

Returns: ParameterDict

this.hasOwnParameters

Full Usage: this.hasOwnParameters

Returns: bool

TBD

Returns: bool

this.isNoDiff

Full Usage: this.isNoDiff

Returns: bool
Returns: bool

this.device

Full Usage: this.device

Returns: Device
Returns: Device

this.hasOwnBuffers

Full Usage: this.hasOwnBuffers

Returns: bool

TBD

Returns: bool

this.parametersVector

Full Usage: this.parametersVector

Returns: Tensor

TBD

Returns: Tensor

this.isReverseDiff

Full Usage: this.isReverseDiff

Returns: bool
Returns: bool

this.nstate

Full Usage: this.nstate

Returns: int

TBD

Returns: int

this.nparameters

Full Usage: this.nparameters

Returns: int

Gets the number of parameters of the Model

Returns: int

this.hasOwnState

Full Usage: this.hasOwnState

Returns: bool

TBD

Returns: bool

this.children

Full Usage: this.children

Returns: ModelBase list

TBD

Returns: ModelBase list

this.isForwardDiff

Full Usage: this.isForwardDiff

Returns: bool
Returns: bool

this.parameters

Full Usage: this.parameters

Returns: ParameterDict

TBD

Returns: ParameterDict

this.descendants

Full Usage: this.descendants

Returns: ModelBase list

TBD

Returns: ModelBase list

this.nbuffers

Full Usage: this.nbuffers

Returns: int

TBD

Returns: int

this.buffersVector

Full Usage: this.buffersVector

Returns: Tensor

TBD

Returns: Tensor

this.dtype

Full Usage: this.dtype

Returns: Dtype
Returns: Dtype

this.stateVector

Full Usage: this.stateVector

Returns: Tensor

TBD

Returns: Tensor

© Copyright 2021, DiffSharp and dfx Contributors.