Skip to main content

//clika-runtime/io.clika.runtime/PhaseContext

PhaseContext

[common]
class PhaseContext

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​

NameSummary
state[common]
val state: Any?
The session's state, the object the model's state factory made (null for a stateless model).

Functions​

NameSummary
hasInput[common]
fun hasInput(name: String): Boolean
True when the request carries an input named name.
input[common]
fun input(name: String): Tensor
The input named name as a tensor the body owns; fails with NOT_FOUND when absent.
inputNames[common]
fun inputNames(): List<String>
The names of the request's inputs.
setOutput[common]
fun setOutput(name: String, tensor: Tensor)
Set the phase's output named name to tensor (the body keeps its own handle to close).