MCPcopy
hub / github.com/tinygrad/tinygrad / sqrt

Method sqrt

tinygrad/mixin/elementwise.py:455–463  ·  view source on GitHub ↗

Computes the square root of the tensor element-wise. ```python exec="true" source="above" session="tensor" result="python" print(Tensor([1., 2., 3., 4.]).sqrt().numpy()) ```

(self)

Source from the content-addressed store, hash-verified

453 return self.alu(Ops.TRUNC)
454
455 def sqrt(self) -> Self:
456 """
457 Computes the square root of the tensor element-wise.
458
459 ```python exec="true" source="above" session="tensor" result="python"
460 print(Tensor([1., 2., 3., 4.]).sqrt().numpy())
461 ```
462 """
463 return self._ensure_float().alu(Ops.SQRT)
464
465 def sin(self) -> Self:
466 """

Callers 15

rsqrtMethod · 0.95
randn_likeMethod · 0.80
x86.pyFile · 0.80
_stepMethod · 0.80
_stepMethod · 0.80
ReduceL2Function · 0.80
LpNormalizationFunction · 0.80
attention_contribFunction · 0.80
AdagradFunction · 0.80
__init__Method · 0.80
__init__Method · 0.80

Calls 2

_ensure_floatMethod · 0.95
aluMethod · 0.45