# Wolfram Language & System 11.0 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.
BUILT-IN WOLFRAM LANGUAGE SYMBOL

# CrossEntropyLossLayer

represents a net layer that computes the cross-entropy loss by comparing probabilities with specified target values.

CrossEntropyLossLayer[form]
specifies the form of target that has been supplied.

## Details and OptionsDetails and Options

• In CrossEntropyLossLayer[form], possible forms include:
•  "Index" single integer giving the index of the target result "Probabilities" vector of target probabilities for different possible results
• CrossEntropyLossLayer[][<|"Input"->in,"Target"target|>] explicitly computes the output from applying the layer.
• CrossEntropyLossLayer[][<|"Input"->{in1,in2,},"Target"->{target1,target2,}|>] explicitly computes outputs for each of the ini and targeti.
• CrossEntropyLossLayer exposes the following ports for use in NetGraph etc.:
•  "Input" a numeric vector "Target" an integer if sparse is True and a numeric vector if False "Loss" a real number
• CrossEntropyLossLayer is typically used inside NetChain, NetGraph, and NetTrain.
• When it cannot be inferred from other layers in a larger net, the option "Input"->n can be used to fix the input dimensions of CrossEntropyLossLayer.

## ExamplesExamplesopen allclose all

### Basic Examples  (4)Basic Examples  (4)

Create a CrossEntropyLossLayer object:

 In[1]:=
 Out[1]=

Apply data to a CrossEntropyLossLayer, where the label is the index of the target class:

 In[1]:=
 In[2]:=
 Out[2]=

Apply data to a CrossEntropyLossLayer, where the label is a vector of class probabilities:

 In[1]:=
 In[2]:=
 Out[2]=

Create a CrossEntropyLossLayer that takes in True or False as the target using a NetEncoder:

 In[1]:=
 Out[1]=

Apply the layer to an example:

 In[2]:=
 Out[2]=