Friday, October 24, 2025
HomeLanguagesPython | tensorflow.math.bessel_i0() method

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 library
import tensorflow as tf
 
# initializing constant tensor
a = tf.constant([-1.5, 3 ], dtype=tf.float64)
 
# calculating bessel i0
b = tf.math.bessel_i0(a)
 
# printing the input
print('Input: ',a)
 
# printing the output
print('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 library
import tensorflow as tf
 
# initializing constant tensor with dtype int32
a = tf.constant([1 , 3 ], dtype=tf.int32)
 
# printing the input
print('Input: ',a)
 
# calculating bessel i0
b = 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)
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11954 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS