pymc.math.sqrt#

pymc.math.sqrt = Elemwise(scalar_op=sqrt,inplace_pattern=<frozendict {}>)[source]#

square root of a

Computes element-wise square root of a tensor.

Parameters:
aTensorLike

Input tensor (should contain non-negative values)

Returns:
TensorVariable

Output tensor with the square root of each element in a

Notes

For negative inputs, the behavior depends on the backend, typically resulting in NaN values.

Examples

>>> import pytensor
>>> import pytensor.tensor as pt
>>> x = pt.vector("x")
>>> f = pytensor.function([x], pt.sqrt(x))
>>> f([0, 1, 4, 9])
array([0., 1., 2., 3.])