Python – tensorflow.math.bessel_i0e()函数
TensorFlow 是由 Google 设计的开源Python库,用于开发机器学习模型和深度学习神经网络。 bessel_i0e()是 tensorflow 数学模块中的函数。此函数用于查找元素明智的指数缩放修改的 0 阶 Bessel函数。
bessel_i0e(x) = exp(-abs(x)) bessel_i0(x)
bessel_i0e(x) is faster and numerically stabler than bessel_i0(x).
Syntax: tensorflow.math.bessel_i0e( x, name)
Parameters:
- x: It’s a tensor and the allowed dtypes for this tensor are bfloat16, half, float32, float64.
- name: It’s is an optional argument which is used to give operation name.
Returns: It returns a tensor or sparse tensor depending upon x of same dtype as x.
示例 1:
Python3
# importing the library
import tensorflow as tf
# initializing the input
a = tf.constant([1,2,3,4,5], dtype = tf.float64)
# printing the input
print('a: ',a)
# evaluating the result
r = tf.math.bessel_i0e(a)
# printing the result
print("Result: ",r)
Python3
# importing the library
import tensorflow as tf
import matplotlib.pyplot as plt
# initializing the input
a = tf.constant([1,2,3,4,5], dtype = tf.float64)
# evaluating the result
r = tf.math.bessel_i0e(a)
#plotting the graph
plt.plot(a, r, color = 'green', marker = "o")
plt.title("tensorflow.math.bessel_i0e")
plt.xlabel("Input")
plt.ylabel("Result")
plt.show()
输出:
a: tf.Tensor([1. 2. 3. 4. 5.], shape=(5,), dtype=float64)
Result: tf.Tensor([0.46575961 0.30850832 0.24300035 0.20700192 0.18354081], shape=(5,), dtype=float64)
示例 2:可视化
Python3
# importing the library
import tensorflow as tf
import matplotlib.pyplot as plt
# initializing the input
a = tf.constant([1,2,3,4,5], dtype = tf.float64)
# evaluating the result
r = tf.math.bessel_i0e(a)
#plotting the graph
plt.plot(a, r, color = 'green', marker = "o")
plt.title("tensorflow.math.bessel_i0e")
plt.xlabel("Input")
plt.ylabel("Result")
plt.show()
输出: