Function rint

  • Round each element in a tensor to the nearest integer. There is a method version of this static function: Tensor.rint.

    $$ x = \begin{cases} \lfloor x \rfloor,& \text{if } x - \lfloor x \rfloor \leq \frac{1}{2}\\ \lceil x \rceil,& \text{otherwise} \end{cases} \forall x \in T $$


      const t = sm.randn([128, 128])

    // equivalent calls
    const a = t.rint()
    const b = sm.rint(t)



    • tensor: Tensor

      Tensor whose values will be rounded to the nearest integer

    Returns Tensor

Generated using TypeDoc