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

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

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

# takeAlongDim

[common]\
fun [takeAlongDim](takeAlongDim.md)(input: [Tensor](../Tensor/index.md), index: [Tensor](../Tensor/index.md), dim: [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)? = null): [Tensor](../Tensor/index.md)

`takeAlongDim(input: Tensor, index: Tensor, dim: Long? = null)`: the `take_along_dim` operator. `gather` with broadcasting between `input` and `index` on the other dims. With `dim` absent both operands are treated as flattened 1-D. Same index dtype law as `gather` (`Int32`/`Int64`).