---
title: "init(input:output:lossFunction:lossReduction:filterParameters:)"
framework: accelerate
role: symbol
role_heading: Initializer
path: "accelerate/bnns/losslayer/init(input:output:lossfunction:lossreduction:filterparameters:)"
---

# init(input:output:lossFunction:lossReduction:filterParameters:)

Returns a new loss layer.

## Declaration

```swift
convenience init?(input: BNNSNDArrayDescriptor, output: BNNSNDArrayDescriptor, lossFunction: BNNS.LossFunction, lossReduction: BNNS.LossReduction, filterParameters: BNNSFilterParameters? = nil)
```

## Parameters

- `input`: The descriptor of the input.
- `output`: The descriptor of the output.
- `lossFunction`: The function that’s used to compute the loss.
- `lossReduction`: The function that’s used to reduce the computed loss.
- `filterParameters`: The filter runtime parameters.

## 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.
