This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

scalingLayer

Scaling layer for actor or critic network

Description

ScalingLayer is a deep neural network layer that linearly scales and biases an input array U, giving an output Y = Scale.*U + Bias. You can incorporate this layer into the deep neural networks you define for actors or critics in reinforcement learning agents. This layer is useful for scaling and shifting the outputs of nonlinear layers, such as tanhLayer and sigmoid.

For instance, tanhLayer gives bounded output that falls between –1 and 1. If your actor network output has different bounds (as defined in the actor specification), you can include a ScalingLayer as an output to scale and shift the actor network output appropriately.

Scaling layer parameters are not learnable.

Creation

Syntax

sLayer = scalingLayer
sLayer = scalingLayer(Name,Value)

Description

sLayer = scalingLayer creates a scaling layer with default property values.

example

sLayer = scalingLayer(Name,Value) sets properties using Name,Value pairs. For example, scalingLayer('Scale',0.5) creates a scaling layer that scales its input by 0.5. Enclose each property name in quotes.

Properties

expand all

Name of layer, specified as a character vector. To include a layer in a layer graph, you must specify a nonempty unique layer name. If you train a series network with this layer and Name is set to '', then the software automatically assigns a name to the layer at training time.

This property is read-only.

Description of layer, specified when you create the scaling layer and stored as a character vector. When you create the scaling layer, you can use this property to give it a description that helps you identify its purpose.

Element-wise scale on the input to the scaling layer, specified as a numeric scalar. The scaling layer takes an input U and generates the output Y = Scale.*U + Bias.

Element-wise bias on the input to the scaling layer, specified as a numeric scalar. The scaling layer takes an input U and generates the output Y = Scale.*U + Bias.

Examples

collapse all

Create a scaling layer that converts an input array U to the output array Y = 0.1.*U - 0.4.

sLayer = scalingLayer('Scale',0.1,'Bias',-0.4)
sLayer = 
  ScalingLayer with properties:

     Name: 'scaling'
    Scale: 0.1000
     Bias: -0.4000

  Show all properties

Confirm that the scaling layer scales and offsets an input array as expected.

predict(sLayer,[10,20,30])
ans = 1×3

    0.6000    1.6000    2.6000

You can incorporate sLayer into an actor network or critic network for reinforcement learning.

Introduced in R2019a