an><span class="p">],</span> <span class="n">device</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">device</span><span class="p">)</span>

                <span class="c1"># If constrained to be positive, use nnls. Otherwise, use torch&#39;s lstsq method.</span>
                <span class="k">if</span> <span class="n">positive</span><span class="p">:</span>
                    <span class="n">x_i</span><span class="p">,</span> <span class="n">_</span> <span