---
title: "complexConstant(realPart:imaginaryPart:)"
framework: metalperformanceshadersgraph
role: symbol
role_heading: Instance Method
path: "metalperformanceshadersgraph/mpsgraph/complexconstant(realpart:imaginarypart:)"
---

# complexConstant(realPart:imaginaryPart:)

Creates a complex constant op with the MPSDataTypeComplexFloat32 data type and returns the result tensor.

## Declaration

```swift
func complexConstant(realPart: Double, imaginaryPart: Double) -> MPSGraphTensor
```

## Parameters

- `realPart`: The real part of the complex scalar to fill the entire tensor values with.
- `imaginaryPart`: The imaginary part of the complex scalar to fill the entire tensor values with.

## Return Value

Return Value A valid MPSGraphTensor object.
