tf.math.sqrt  |  TensorFlow v2.16.1 (original) (raw)

tf.math.sqrt

Stay organized with collections Save and categorize content based on your preferences.

Computes element-wise square root of the input tensor.

View aliases

Main aliases

tf.sqrt

Compat aliases for migration

SeeMigration guide for more details.

tf.compat.v1.sqrt

tf.math.sqrt(
    x, name=None
)

Used in the notebooks

Used in the guide Used in the tutorials
Distributed training with Core APIs and DTensor Multilayer perceptrons for digit recognition with Core APIs Optimizers with Core APIs Uncertainty-aware Deep Learning with SNGP TFP Release Notes notebook (0.12.1) Copulas Primer Substantial Undocumented Infection Facilitates the Rapid Dissemination of Novel Coronavirus (SARS-CoV2) Neural machine translation with a Transformer and Keras

x = tf.constant([[4.0], [16.0]]) tf.sqrt(x) <tf.Tensor: shape=(2, 1), dtype=float32, numpy= array([[2.], [4.]], dtype=float32)> y = tf.constant([[-4.0], [16.0]]) tf.sqrt(y) <tf.Tensor: shape=(2, 1), dtype=float32, numpy= array([[nan], [ 4.]], dtype=float32)> z = tf.constant([[-1.0], [16.0]], dtype=tf.complex128) tf.sqrt(z) <tf.Tensor: shape=(2, 1), dtype=complex128, numpy= array([[0.0+1.j], [4.0+0.j]])>

Args
x A tf.Tensor of type bfloat16, half, float32, float64,complex64, complex128
name A name for the operation (optional).
Returns
A tf.Tensor of same size, type and sparsity as x.If x is a SparseTensor, returnsSparseTensor(x.indices, tf.math.sqrt(x.values, ...), x.dense_shape)

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.

Last updated 2024-04-26 UTC.