represents a layer that multiplies its input by a learnable scaling array.


includes options for initial scaling and other parameters.

Details and Options


open allclose all

Basic Examples  (2)

Create a ConstantTimesLayer:

Create a ConstantTimesLayer with an explicit scaling:

Apply the layer to an input vector:

Scope  (3)

Create a ConstantTimesLayer that operates on single numbers by encoding them as length-1 vectors:

Apply the layer to an input:

The layer threads across a batch of inputs:

Plot the output of the layer as a function of the input, compared to y=x:

Use a ConstantTimesLayer in a NetChain to independently scale the components of the output of another layer:

Plot the three output components:

Create a random ConstantTimesLayer that applies a per-pixel and per-channel scaling to an image:

Options  (1)

"Scaling"  (1)

Specify an initial scaling:

Apply the layer to an input vector:

Properties & Relations  (1)

By default, NetInitialize will create a scaling that is composed of ones:

This is the identity scaling:

Specify a custom distribution to NetInitialize:

Alternatively, a scaling array can be supplied directly:

Possible Issues  (1)

ConstantTimesLayer cannot accept symbolic inputs:

Introduced in 2017
Updated in 2020