<divclass="platform-hinted "data-platform-hinted="data-platform-hinted"><divclass="content sourceset-depenent-content"data-active=""data-togglable=":kmath-tensors:dokkaHtmlPartial/commonMain"><divclass="symbol monospace"><spanclass="token keyword">abstract </span><spanclass="token keyword"></span><spanclass="token keyword">fun </span><ahref="../../../kmath-core/space.kscience.kmath.nd/-structure-n-d/index.html">StructureND</a><spanclass="token operator"><</span><spanclass="token keyword"></span><ahref="index.html">T</a><spanclass="token operator">></span><spanclass="token punctuation">.</span><ahref="variance.html"><spanclass="token function">variance</span></a><spanclass="token punctuation">(</span><spanclass="token punctuation">)</span><spanclass="token operator">: </span><ahref="index.html">T</a><spanclass="top-right-position"><spanclass="copy-icon"></span><divclass="copy-popup-wrapper popup-to-left"><spanclass="copy-popup-icon"></span><span>Content copied to clipboard</span></div></span></div><h4class="">Return</h4><pclass="paragraph">the variance of all elements in the input tensor.</p><br><divclass="symbol monospace"><spanclass="token keyword">abstract </span><spanclass="token keyword"></span><spanclass="token keyword">fun </span><ahref="../../../kmath-core/space.kscience.kmath.nd/-structure-n-d/index.html">StructureND</a><spanclass="token operator"><</span><spanclass="token keyword"></span><ahref="index.html">T</a><spanclass="token operator">></span><spanclass="token punctuation">.</span><ahref="variance.html"><spanclass="token function">variance</span></a><spanclass="token punctuation">(</span>dim<spanclass="token operator">: </span><ahref="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a><spanclass="token punctuation">, </span>keepDim<spanclass="token operator">: </span><ahref="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a><spanclass="token punctuation">)</span><spanclass="token operator">: </span><ahref="../index.html#-1680022905%2FClasslikes%2F-1345790395">Tensor</a><spanclass="token operator"><</span><spanclass="token keyword"></span><ahref="index.html">T</a><spanclass="token operator">></span><spanclass="top-right-position"><spanclass="copy-icon"></span><divclass="copy-popup-wrapper popup-to-left"><spanclass="copy-popup-icon"></span><span>Content copied to clipboard</span></div></span></div><pclass="paragraph">Returns the variance of each row of the input tensor in the given dimension <ahref="variance.html">dim</a>.</p><pclass="paragraph">If <ahref="variance.html">keepDim</a> is true, the output tensor is of the same size as input except in the dimension <ahref="variance.html">dim</a> where it is of size 1. Otherwise, <ahref="variance.html">dim</a> is squeezed, resulting in the output tensor having 1 fewer dimension.</p><h4class="">Return</h4><pclass="paragraph">the variance of each row of the input tensor in the given dimension <ahref="variance.html">dim</a>.</p><h2class="">Parameters</h2><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"><div><span><span>dim</span></span></div></span></div><div><divclass="title"><divdata-togglable="Parameters"><pclass="paragraph">the dimension to reduce.</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"><div><span>keep</span><wbr><span><span>Dim</span></span></div></span></div><div><divclass="title"><divdata-togglable="Parameters"><pclass="paragraph">whether the output tensor has <ahref="variance.html">di