---
title: MPSCNNGradientKernel
framework: metalperformanceshaders
role: symbol
role_heading: Class
path: metalperformanceshaders/mpscnngradientkernel
---

# MPSCNNGradientKernel

The base class for gradient layers.

## Declaration

```swift
class MPSCNNGradientKernel
```

## Topics

### Initializers

- [init(coder:device:)](metalperformanceshaders/mpscnngradientkernel/init(coder:device:).md)
- [init(device:)](metalperformanceshaders/mpscnngradientkernel/init(device:).md)

### Instance Properties

- [kernelOffsetX](metalperformanceshaders/mpscnngradientkernel/kerneloffsetx.md)
- [kernelOffsetY](metalperformanceshaders/mpscnngradientkernel/kerneloffsety.md)

### Instance Methods

- [encode(commandBuffer:sourceGradient:sourceImage:gradientState:)](metalperformanceshaders/mpscnngradientkernel/encode(commandbuffer:sourcegradient:sourceimage:gradientstate:).md)
- [encode(commandBuffer:sourceGradient:sourceImage:gradientState:destinationGradient:)](metalperformanceshaders/mpscnngradientkernel/encode(commandbuffer:sourcegradient:sourceimage:gradientstate:destinationgradient:).md)
- [encodeBatch(commandBuffer:sourceGradients:sourceImages:gradientStates:)](metalperformanceshaders/mpscnngradientkernel/encodebatch(commandbuffer:sourcegradients:sourceimages:gradientstates:).md)
- [encodeBatch(commandBuffer:sourceGradients:sourceImages:gradientStates:destinationGradients:)](metalperformanceshaders/mpscnngradientkernel/encodebatch(commandbuffer:sourcegradients:sourceimages:gradientstates:destinationgradients:).md)

## Relationships

### Inherits From

- [MPSCNNBinaryKernel](metalperformanceshaders/mpscnnbinarykernel.md)

### Inherited By

- [MPSCNNArithmeticGradient](metalperformanceshaders/mpscnnarithmeticgradient.md)
- [MPSCNNBatchNormalizationGradient](metalperformanceshaders/mpscnnbatchnormalizationgradient.md)
- [MPSCNNBatchNormalizationStatisticsGradient](metalperformanceshaders/mpscnnbatchnormalizationstatisticsgradient.md)
- [MPSCNNConvolutionGradient](metalperformanceshaders/mpscnnconvolutiongradient.md)
- [MPSCNNConvolutionTransposeGradient](metalperformanceshaders/mpscnnconvolutiontransposegradient.md)
- [MPSCNNCrossChannelNormalizationGradient](metalperformanceshaders/mpscnncrosschannelnormalizationgradient.md)
- [MPSCNNDropoutGradient](metalperformanceshaders/mpscnndropoutgradient.md)
- [MPSCNNGroupNormalizationGradient](metalperformanceshaders/mpscnngroupnormalizationgradient.md)
- [MPSCNNInstanceNormalizationGradient](metalperformanceshaders/mpscnninstancenormalizationgradient.md)
- [MPSCNNLocalContrastNormalizationGradient](metalperformanceshaders/mpscnnlocalcontrastnormalizationgradient.md)
- [MPSCNNLogSoftMaxGradient](metalperformanceshaders/mpscnnlogsoftmaxgradient.md)
- [MPSCNNNeuronGradient](metalperformanceshaders/mpscnnneurongradient.md)
- [MPSCNNPoolingGradient](metalperformanceshaders/mpscnnpoolinggradient.md)
- [MPSCNNSoftMaxGradient](metalperformanceshaders/mpscnnsoftmaxgradient.md)
- [MPSCNNSpatialNormalizationGradient](metalperformanceshaders/mpscnnspatialnormalizationgradient.md)
- [MPSCNNUpsamplingGradient](metalperformanceshaders/mpscnnupsamplinggradient.md)
- [MPSNNGramMatrixCalculationGradient](metalperformanceshaders/mpsnngrammatrixcalculationgradient.md)
- [MPSNNPadGradient](metalperformanceshaders/mpsnnpadgradient.md)
- [MPSNNReshapeGradient](metalperformanceshaders/mpsnnreshapegradient.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)

## See Also

### Layer Base Classes

- [MPSCNNKernel](metalperformanceshaders/mpscnnkernel.md)
- [MPSCNNBinaryKernel](metalperformanceshaders/mpscnnbinarykernel.md)
