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

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

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

# fillDiagonal

[common]\
fun [fillDiagonal](fillDiagonal.md)(input: [Tensor](../Tensor/index.md), fillValue: [Double](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html), wrap: [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) = false, device: [Placement](../Placement/index.md)? = null): [Tensor](../Tensor/index.md)

`fillDiagonal(input: Tensor, fillValue: Double, wrap: Boolean = false, device: Placement? = null)`: the `fill_diagonal` operator. A copy of the 2-D matrix `input` with `fill_value` written along its diagonal. Without `wrap` the diagonal stops at `min(rows, cols)`; with `wrap = true` a TALL matrix continues the diagonal below the wrap row, restarting at the left edge (the classic tall-matrix wrap).