---
title: "assign(_:tensor:name:)"
framework: metalperformanceshadersgraph
role: symbol
role_heading: Instance Method
path: "metalperformanceshadersgraph/mpsgraph/assign(_:tensor:name:)"
---

# assign(_:tensor:name:)

Creates an assign operation which writes at this point of execution of the graph.

## Declaration

```swift
func assign(_ variable: MPSGraphTensor, tensor: MPSGraphTensor, name: String?) -> MPSGraphOperation
```

## Parameters

- `variable`: The variable resource tensor to assign to.
- `tensor`: The tensor to assign to the variable.
- `name`: The name for the operation.

## Return Value

Return Value A valid MPSGraphTensor object.
