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

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

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

# shape

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

`shape(input: Tensor, dim: Long? = null)`: the `shape` operator. The tensor's shape as a 1-D Int64 tensor (or one extent as 0-D). The value is produced ON DEVICE and is traceable; under tracing it carries the symbolic value. For a plain host integer use the `*_host` sibling instead. With `dim` set, returns that single extent as a 0-D Int64 tensor (negative `dim` counts from the end).

[common]\
fun [shape](shape.md)(input: [Tensor](../Tensor/index.md), start: [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)?, end: [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)?): [Tensor](../Tensor/index.md)

`shape(input: Tensor, start: Long?, end: Long?)`: the `shape` operator. The `[start, end)` window of the shape as ONE 1-D Int64 tensor, a contiguous dim range in a single call (Python-slice bounds: negative values count from the end, `std::nullopt` leaves that side open). Same on-device, traceable contract as `shape(x)`; the host-integer sibling is `shape_host(x, start, end)`.