---
title: "PhaseContext"
sidebar_label: "PhaseContext"
description: "Kotlin binding reference: PhaseContext."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

//[clika-runtime](../../../index.md)/[io.clika.runtime](../index.md)/[PhaseContext](index.md)

# PhaseContext

[common]\
class [PhaseContext](index.md)

What a run-once phase body reads and writes: the request's inputs (each read answers a fresh tensor the body owns; the bytes are the request's) and the phase's outputs. Valid for the body's call alone; never keep it past the return. An op the body issues runs on the phase's own stream.

## Properties

| Name | Summary |
|---|---|
| [state](state.md) | [common]<br>val [state](state.md): [Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)?<br>The session's state, the object the model's state factory made (null for a stateless model). |

## Functions

| Name | Summary |
|---|---|
| [hasInput](hasInput.md) | [common]<br>fun [hasInput](hasInput.md)(name: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)): [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)<br>True when the request carries an input named [name](hasInput.md). |
| [input](input.md) | [common]<br>fun [input](input.md)(name: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)): [Tensor](../Tensor/index.md)<br>The input named [name](input.md) as a tensor the body owns; fails with `NOT_FOUND` when absent. |
| [inputNames](inputNames.md) | [common]<br>fun [inputNames](inputNames.md)(): [List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)&lt;[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)&gt;<br>The names of the request's inputs. |
| [setOutput](setOutput.md) | [common]<br>fun [setOutput](setOutput.md)(name: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), tensor: [Tensor](../Tensor/index.md))<br>Set the phase's output named [name](setOutput.md) to [tensor](setOutput.md) (the body keeps its own handle to close). |