---
title: "apply(batchSize:input:labels:output:generatingInputGradient:)"
framework: accelerate
role: symbol
role_heading: Instance Method
path: "accelerate/bnns/losslayer/apply(batchsize:input:labels:output:generatinginputgradient:)"
---

# apply(batchSize:input:labels:output:generatingInputGradient:)

Applies the layer to a set of input objects, writing the result to a set of output objects.

## Declaration

```swift
func apply(batchSize: Int, input: BNNSNDArrayDescriptor, labels: BNNSNDArrayDescriptor, output: BNNSNDArrayDescriptor, generatingInputGradient inputGradient: BNNSNDArrayDescriptor) throws
```

## Parameters

- `batchSize`: The number of input-output pairs.
- `input`: The descriptor of the input.
- `labels`: The descriptor of the labels.
- `output`: The descriptor of the output.
- `inputGradient`: The descriptor of the input gradient.
