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

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

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

# onComplete

[common]\
fun [onComplete](onComplete.md)(callback: [TensorCallback](../TensorCallback/index.md))

Register [callback](onComplete.md) to run once this tensor's producer has finished (a tensor that is already available fires it right away). The [Tensor](index.md) handed to the callback is its own for the call: whatever it does not [release](release.md) itself is released when the callback returns.

```kotlin
val latch = CountDownLatch(1)
x.onComplete { result -> println(result.summary()); latch.countDown() }
latch.await()
```