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

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

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

# to

[common]\
fun [to](to.md)(src: [Tensor](../Tensor/index.md), target: [Placement](../Placement/index.md)? = null): [Tensor](../Tensor/index.md)

`to(src: Tensor, target: Placement? = null)`: the `to` operator. Moves a tensor to a device or stream. Already-resident inputs pass through (no transfer). The result is produced on `target`'s stream; downstream ops on that stream order after the transfer automatically.

[common]\
fun [to](to.md)(tensors: [List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)&lt;[Tensor](../Tensor/index.md)&gt;, target: [Placement](../Placement/index.md)? = null): [List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)&lt;[Tensor](../Tensor/index.md)&gt;

`to(tensors: List<Tensor>, target: Placement? = null)`: the `to` operator. Multi-tensor `to`: moves a batch in ONE call; the batched transfer beats N single moves when several tensors cross together (one submission, one ordering point).

[common]\
fun [to](to.md)(src: [Tensor](../Tensor/index.md), deviceStr: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)): [Tensor](../Tensor/index.md)

`to(src: Tensor, deviceStr: String)`: the `to` operator. String-addressed `to`: the device is named by string: `"cpu"`, `"cuda"`, `"cuda:1"`, ….