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

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

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

# ones

[common]\
fun [ones](ones.md)(shape: [LongArray](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long-array/index.html), dtype: [DType](../DType/index.md), device: [Placement](../Placement/index.md)? = null, pinnedFor: [Placement](../Placement/index.md)? = null): [Tensor](../Tensor/index.md)

`ones(shape: LongArray, dtype: DType, device: Placement? = null, pinnedFor: Placement? = null)`: the `ones` operator. A new tensor of the given shape with every element set to one. Same shape-span and `pinned_for` contract as `empty` (extents are literals or 0-D integer Tensors).