📜  Python – tensorflow.raw_ops.Sin()(1)

📅  最后修改于: 2023-12-03 15:04:11.259000             🧑  作者: Mango

Python - tensorflow.raw_ops.Sin()

tensorflow.raw_ops.Sin() is a TensorFlow operation that returns a tensor with element-wise sine of the input tensor.

Syntax
tf.raw_ops.Sin(x, name=None)

Parameters

  • x: A Tensor of type float32, float64, complex64, or complex128.
  • name: A name for the operation (optional).

Return Value

A Tensor. Has the same type as x.

Example
import tensorflow as tf

# Create input tensor with random values between -pi and pi
x = tf.constant(tf.random.uniform([2, 3], -3.14, 3.14))

# Apply sine function element-wise
y = tf.raw_ops.Sin(x)

# Print the result
print(y)

Output:

tf.Tensor(
[[ 0.93658483 -0.07787313 -0.49905896]
 [-0.97609484 -0.9722766   0.73675054]], shape=(2, 3), dtype=float32)
Conclusion

tensorflow.raw_ops.Sin() is a simple and useful TensorFlow operation for applying sine function element-wise on a tensor. It's an important mathematical operation used in many fields such as signal processing, control theory, and physics.