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

# complexConstant(realPart:imaginaryPart:dataType:)

Creates a complex constant operation and returns the result tensor.

## Declaration

```swift
func complexConstant(realPart: Double, imaginaryPart: Double, dataType: MPSDataType) -> 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.
- `dataType`: The dataType of the constant tensor.

## Return Value

Return Value A valid MPSGraphTensor object.
