<!--
{
  "availability" : [
    "iOS: 14.0.0 - 17.4.0",
    "iPadOS: 14.0.0 - 17.4.0",
    "macCatalyst: 14.0.0 - 17.4.0",
    "macOS: 11.0.0 - 14.3.0",
    "tvOS: 14.0.0 - 17.4.0"
  ],
  "documentType" : "symbol",
  "framework" : "MLCompute",
  "identifier" : "/documentation/MLCompute/MLCSGDOptimizer",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "ML Compute"
    ],
    "preciseIdentifier" : "c:objc(cs)MLCSGDOptimizer"
  },
  "title" : "MLCSGDOptimizer"
}
-->

# MLCSGDOptimizer

An optimizer that represents the stochastic gradient decent algorithm.

```
class MLCSGDOptimizer
```

## Topics

### Creating an SGD Optimizer

[`init(descriptor:)`](/documentation/MLCompute/MLCSGDOptimizer/init(descriptor:))

Creates an SGD optimizer with the descriptor you specify.

[`init(descriptor:momentumScale:usesNesterovMomentum:)`](/documentation/MLCompute/MLCSGDOptimizer/init(descriptor:momentumScale:usesNesterovMomentum:))

Create an SGD optimizer with the descriptor, momentum scale, and option to enable Nesterov momentum that you specify.

### Inspecting an SGD Optimizer

[`momentumScale`](/documentation/MLCompute/MLCSGDOptimizer/momentumScale)

A hyper-parameter specifying the momentum factor.

[`usesNesterovMomentum`](/documentation/MLCompute/MLCSGDOptimizer/usesNesterovMomentum)

A Boolean that indicates whether you enable Nesterov momentum.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)