---
title: computeAllGradients
framework: ML Compute
role: symbol
role_heading: Type Property
platforms: [iOS 14.0+, iPadOS 14.0+, Mac Catalyst 14.0+, macOS 11.0+, tvOS 14.0+]
path: mlcompute/mlcgraphcompilationoptions/computeallgradients
---

# computeAllGradients

The option to compute all gradients during graph compilation.

## Declaration

```swift
static var computeAllGradients: MLCGraphCompilationOptions { get }
```

## Discussion

Discussion Include this option to compute gradients for layers with or without parameters that only take input tensors. For example, if the first layer of a graph is a convolution layer, the framework only computes the gradients for weights and biases associated with the convolution layer, but not the gradients for the input. Include this option if you want to compute all gradients for the input.

## See Also

### Creating Graph Compilation Options

- [init(rawValue:)](mlcompute/mlcgraphcompilationoptions/init(rawvalue:).md)
- [debugLayers](mlcompute/mlcgraphcompilationoptions/debuglayers.md)
- [disableLayerFusion](mlcompute/mlcgraphcompilationoptions/disablelayerfusion.md)
- [linkGraphs](mlcompute/mlcgraphcompilationoptions/linkgraphs.md)
