MeanSquaredLossLayer

MeanSquaredLossLayer[]

represents a loss layer that computes the mean squared loss between its "Input" port and "Target" port.

Details and Options

  • MeanSquaredLossLayer exposes the following ports for use in NetGraph etc.:
  • "Input"a tensor of arbitrary rank
    "Target"a tensor of the same rank as "Input"
    "Loss"a real number
  • MeanSquaredLossLayer[][<|"Input"->in,"Target"target|>] explicitly computes the output from applying the layer.
  • MeanSquaredLossLayer[][<|"Input"->{in1,in2,},"Target"->{target1,target2,}|>] explicitly computes outputs for each of the ini and targeti.
  • MeanSquaredLossLayer is typically used inside NetGraph to construct a training network.
  • A MeanSquaredLossLayer[] can be provided as the third argument to NetTrain when training a specific network.
  • When appropriate, MeanSquaredLossLayer is automatically used by NetTrain if an explicit loss specification is not provided.
  • MeanSquaredLossLayer["port"->shape] allows the shape of the given input "port" to be specified. Possible forms for shape include:
  • "Real"a single real number
    na vector of length n
    {n1,n2,}a tensor of dimensions n1×n2×
    "Varying"a variable-length vector
    {"Varying",n2,n3,}a variable-length sequence of tensors of dimensions n2×n3×

Examples

open allclose all

Basic Examples  (3)

Create a MeanSquaredLossLayer:

In[1]:=
Click for copyable input
Out[1]=

Create a MeanSquaredLossLayer that takes length-3 vectors:

In[1]:=
Click for copyable input
Out[1]=

Apply the layer to data:

In[2]:=
Click for copyable input
Out[2]=

Create a NetGraph containing a MeanSquaredLossLayer:

In[1]:=
Click for copyable input
Out[1]=

Apply the net to input data:

In[2]:=
Click for copyable input
Out[2]=

Scope  (4)

Applications  (1)

Properties & Relations  (2)

Possible Issues  (1)

See Also

MeanAbsoluteLossLayer  CrossEntropyLossLayer  NetGraph  NetTrain  SquaredEuclideanDistance

Introduced in 2016
(11.0)