pytaco.sqrt

pytaco.sqrt(e1)

Return the element-wise sqrt of the index expression.

The index expression must have a floating point type. If necessary, a user may cast() the input expression before applying the square root.

This must be assigned to a tensor for the computation to be performed.

Parameters
e1: index_expression

Input index expression

Returns
sqrt_exp: index_expression

An index expression representing the element wise square root of the input expression.

Examples

>>> import pytaco as pt
>>> t = pt.as_tensor([4, 16])
>>> i = pt.index_var()
>>> res_t = pt.tensor([t.shape[0]])
>>> res_t[i] = pt.sqrt(pt.cast(t[i], pt.float32))
>>> res_t.to_array()
array([2., 4.], dtype=float32)