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

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

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

# diagEmbed

[common]\
fun [diagEmbed](diagEmbed.md)(input: [Tensor](../Tensor/index.md), offset: [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) = 0, dim1: [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) = -2L, dim2: [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) = -1L): [Tensor](../Tensor/index.md)

`diagEmbed(input: Tensor, offset: Long = 0L, dim1: Long = -2L, dim2: Long = -1L)`: the `diag_embed` operator. Embed the LAST dim along the diagonal of a fresh `(dim1, dim2)` plane: output rank = input rank + 1, both new dims sized `last + |offset|`, the inverse of `diagonal`. Defaults place the plane at the trailing two dims. Copies.