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


Python tensorflow.math.special.fresnel_cos()用法及代码示例


TensorFlow是Google设计的开源python库,用于开发机器学习模型和深度学习神经网络。

fresnel_cos()函数

fresnel_cos()用于计算元素明智的菲涅耳x的余弦积分。它定义为cos(t^2)从0到x的积分,定义域为所有正实数。

Sytnax:tensorflow.math.special.fresnel_cos(x,名称)

参数:

  • x:它是张量或稀疏张量。允许的dtype是float32和float64。
  • name(optional):它定义了操作的名称。

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



范例1:

Python3

# importing the library 
import tensorflow as tf 
  
# Initializing the input tensor 
a = tf.constant([ [-5, -7],[ 2, 0]], dtype=tf.float64) 
  
# Printing the input tensor 
print('a:', a) 
  
# Calculating result 
res = tf.math.special.fresnel_cos(a) 
  
# Printing the result 
print('Result:', res)

输出:

a: tf.Tensor(
[[-5. -7.]
 [ 2.  0.]], shape=(2, 2), dtype=float64)
Result: tf.Tensor(
[[-0.56363119 -0.54546709]
 [ 0.48825341  0.        ]], shape=(2, 2), dtype=float64)

范例2:

Python3

# importing the library 
import tensorflow as tf 
  
# Initializing the input tensor 
a = tf.constant([1, 2, 3, 4, 5], dtype=tf.float64) 
  
# Printing the input tensor 
print('a:', a) 
  
# Calculating result 
res = tf.math.special.fresnel_cos(a) 
  
# Printing the result 
print('Result:', res)

输出:

a: tf.Tensor([1. 2. 3. 4. 5.], shape=(5,), dtype=float64)
Result: tf.Tensor([0.7798934  0.48825341 0.60572079 0.49842603 0.56363119], shape=(5,), dtype=float64)




相关用法


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