Python | tensorflow.math.bessel_i0() method

TensorFlow is open-source python library designed by Google to develop Machine Learning models and deep learning neural networks.
bessel_i0() is method in TensorFlow math module. This method is used to calculate element wise Bessel i0 of a tensor.
Syntax:
tensorflow.math.bessel_i0(
input, name
)
Argument:
1. input: It's a tensor or SparseTensor for which element wise Bessel iO
need to be calculated. Allowed dtypes are half, float32, float64.
2. name: It is an optional argument that defines the name for the operation.
Return:
A Tensor if Tensor is given as input otherwise SparseTensor having the same dtype as input.
Example 1:
Python3
# importing the libraryimport tensorflow as tf# initializing constant tensor a = tf.constant([-1.5, 3 ], dtype=tf.float64)# calculating bessel i0b = tf.math.bessel_i0(a)# printing the inputprint('Input: ',a)# printing the outputprint('Output: ',b) |
Output:
Input: tf.Tensor([-1.5 3. ], shape=(2,), dtype=float64) Output: tf.Tensor([1.64672319 4.88079259], shape=(2,), dtype=float64)
Example 2:
This example uses tensor with dtype int32 that will raise an error . Only tensor with dtype half, float32, float64 are allowed.
Python3
# importing the libraryimport tensorflow as tf# initializing constant tensor with dtype int32a = tf.constant([1 , 3 ], dtype=tf.int32)# printing the inputprint('Input: ',a)# calculating bessel i0b = tf.math.bessel_i0(a) |
Output:
Input: tf.Tensor([1 3], shape=(2,), dtype=int32) NotFoundError Traceback (most recent call last) <ipython-input-43-4c70ca866e4c> in <module>() ----> 1 b = tf.math.bessel_i0(a)



