---
title: "init(function:i_desc:o_desc:reduction:label_smooth:)"
framework: accelerate
role: symbol
role_heading: Initializer
path: "accelerate/bnnslayerparameterslosssoftmaxcrossentropy/init(function:i_desc:o_desc:reduction:label_smooth:)"
---

# init(function:i_desc:o_desc:reduction:label_smooth:)

Returns a new softmax cross entropy loss layer parameters structure from the specified parameters.

## Declaration

```swift
init(function: BNNSLossFunction, i_desc: BNNSNDArrayDescriptor, o_desc: BNNSNDArrayDescriptor, reduction: BNNSLossReductionFunction, label_smooth: Float)
```

## Parameters

- `function`: The function that’s used to compute loss.
- `i_desc`: The descriptor of the input.
- `o_desc`: The descriptor of the output.
- `reduction`: The function that’s used to reduce the computed loss.
- `label_smooth`: A value that defines the smoothing that the loss function applies to the labels.

## Discussion

Discussion important: The input data type and output data type must be float. The output size must be 1, unless the reduction is BNNS.LossReduction.none.

## See Also

### Initializers

- [init()](accelerate/bnnslayerparameterslosssoftmaxcrossentropy/init().md)
