当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python tensorflow.raw_ops.Asin()用法及代码示例


TensorFlow是Google设计的开源python库,用于开发机器学习模型和深度学习神经网络。 TensorFlow raw_ops提供对所有TensorFlow操作的低级别访问。 Asin()用于查找x的元素明智反正弦。

用法:tf.raw_ops.Asin(x, name)

参数:

  • x:它是输入张量。此张量的允许dtype是bfloat16,half,float32,float64。
  • name(optional):它定义了操作的名称。

返回值:它返回与x相同dtype的张量。

注意:它只接受关键字参数。



范例1:

Python3

# Importing the library 
import tensorflow as tf 
  
# Initializing the input tensor 
a = tf.constant([.2, .5, .7, 1], dtype=tf.float64) 
  
# Printing the input tensor 
print('Input:', a) 
  
# Calculating inverse sine 
res = tf.raw_ops.Asin(x=a) 
  
# Printing the result 
print('Result:', res)

输出:

Input: tf.Tensor([0.2 0.5 0.7 1. ], shape=(4,), dtype=float64)
Result: tf.Tensor([0.20135792 0.52359878 0.7753975  1.57079633], shape=(4,), dtype=float64)


范例2:可视化

Python3

# importing the library 
import tensorflow as tf 
import matplotlib.pyplot as plt 
  
# Initializing the input tensor 
a = tf.constant([.2, .5, .7, 1], dtype=tf.float64) 
  
# Calculating inverse sine 
res = tf.raw_ops.Asin(x=a) 
  
# Plotting the graph 
plt.plot(a, res, color='green') 
plt.title('tensorflow.raw_ops.Asin') 
plt.xlabel('Input') 
plt.ylabel('Result') 
plt.show()

输出:




相关用法


注:本文由纯净天空筛选整理自aman neekhara大神的英文原创作品 Python – tensorflow.raw_ops.Asin()。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。