<pclass="paragraph">Creates a tensor whose diagonals of certain 2D planes (specified by <ahref="diagonal-embedding.html">dim1</a> and <ahref="diagonal-embedding.html">dim2</a>) are filled by <ahref="diagonal-embedding.html">diagonalEntries</a>. To facilitate creating batched diagonal matrices, the 2D planes formed by the last two dimensions of the returned tensor are chosen by default.</p><pclass="paragraph">The argument <ahref="diagonal-embedding.html">offset</a> controls, which diagonal to consider:</p><ol><li><pclass="paragraph">If <ahref="diagonal-embedding.html">offset</a> = 0, it is the main diagonal.</p></li><li><pclass="paragraph">If <ahref="diagonal-embedding.html">offset</a> 0, it is above the main diagonal.</p></li><li><pclass="paragraph">If <ahref="diagonal-embedding.html">offset</a>< 0, it is below the main diagonal.</p></li></ol><pclass="paragraph">The size of the new matrix will be calculated to make the specified diagonal of the size of the last input dimension. For more information: https://pytorch.org/docs/stable/generated/torch.diag_embed.html</p><h4class="">Return</h4><pclass="paragraph">tensor whose diagonals of certain 2D planes (specified by <ahref="diagonal-embedding.html">dim1</a> and <ahref="diagonal-embedding.html">dim2</a>) are filled by <ahref="diagonal-embedding.html">diagonalEntries</a></p><h2class="">Parameters</h2><divdata-togglable="Parameters"><divclass="platform-hinted WithExtraAttributes"data-platform-hinted="data-platform-hinted"data-togglable="Parameters"><divclass="content sourceset-depenent-content"data-active=""data-togglable=":kmath-tensors:dokkaHtmlPartial/commonMain"><divdata-togglable="Parameters"><divclass="table"data-togglable="Parameters"><divclass="table-row"data-filterable-current=":kmath-tensors:dokkaHtmlPartial/commonMain"data-filterable-set=":kmath-tensors:dokkaHtmlPartial/commonMain"><divclass="main-subrow keyValue WithExtraAttributes"><divclass=""><spanclass="inline-flex">diagonalEntries</span></div><div><divclass="title"><divdata-togglable="Parameters"><pclass="paragraph">the input tensor. Must be at least 1-dimensional.</p></div></div></div></div></div><divclass="table-row"data-filterable-current=":kmath-tensors:dokkaHtmlPartial/commonMain"data-filterable-set=":kmath-tensors:dokkaHtmlPartial/commonMain"><divclass="main-subrow keyValue WithExtraAttributes"><divclass=""><spanclass="inline-flex">offset</span></div><div><divclass="title"><divdata-togglable="Parameters"><pclass="paragraph">which diagonal to consider. Default: 0 (main diagonal).</p></div></div></div></div></div><divclass="table-row"data-filterable-current=":kmath-tensors:dokkaHtmlPartial/commonMain"data-filterable-set=":kmath-tensors:dokkaHtmlPartial/commonMain"><divclass="main-subrow keyValue WithExtraAttributes"><divclass=""><spanclass="inline-flex">dim1</span></div><div><divclass="title"><divdata-togglable="Parameters"><pclass="paragraph">first dimension with respect to which to take diagonal. Default: -2.</p></div></div></div></div></div><divclass="table-row"data-filterable-current=":kmath-tensors:dokkaHtmlPartial/commonMain"data-filterable-set=":kmath-tensors:dokkaHtmlPartial/commonMain"><divclass="main-subrow keyValue WithExtraAttributes"><divclass=""><spanclass="inline-flex">dim2</span></div><div><divclass="title"><divdata-togglable="Parameters"><pclass="paragraph">second dimension with respect to which to take diagonal. Default: -1.</p></div></div></div></div></div></div></div></div></div></div></div>