<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreML",
  "identifier" : "/documentation/CoreML/MLTensor/cumulativeProduct(alongAxis:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core ML",
      "CoreML"
    ],
    "preciseIdentifier" : "s:6CoreML8MLTensorV17cumulativeProduct9alongAxisACSi_tF"
  },
  "title" : "cumulativeProduct(alongAxis:)"
}
-->

# cumulativeProduct(alongAxis:)

Computes the cumulative product along the specified axis.

```
func cumulativeProduct(alongAxis axis: Int = 0) -> MLTensor
```

## Parameters

`axis`

The axis along which to perform the cumulative product. The default value is `0`. Must be in the range
`[-rank, rank)` and have a rank greater than zero.

## Return Value

The result of the cumulative product operation.

## Discussion

The scalar type of the tensor must be numeric.

For example:

```swift
MLTensor([1, 2, 3]).cumulativeProduct() = [1, 1 * 2, 1 * 2 * 3]
```

---

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)