Python - функция tensorflow.math.bessel_i1 ()

Опубликовано: 29 Марта, 2022

TensorFlow - это библиотека Python с открытым исходным кодом, разработанная Google для разработки моделей машинного обучения и нейронных сетей глубокого обучения. bessel_i1 () - функция, присутствующая в математическом модуле тензорного потока. Эта функция используется для поэлементного поиска модифицированной функции Бесселя первого порядка.

Syntax: tensorflow.math.bessel_i1( 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_i1(a)
  
# printing the result
print("Result: ",r)

Выход:

 a: tf.Tensor ([1. 2. 3. 4. 5.], shape = (5,), dtype = float64)
Результат: tf.Tensor ([0.5651591 1.59063685 3.95337022 9.75946515 24.33564214], shape = (5,), dtype = float64)

Example 2: Visualization

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_i1(a)
  
#plotting the graph
plt.plot(a, r, color = "green", marker = "o")  
plt.title("tensorflow.math.bessel_i1")  
plt.xlabel("Input")  
plt.ylabel("Result")  
plt.show() 

Выход:

Внимание компьютерщик! Укрепите свои основы с помощью базового курса программирования Python и изучите основы.

Для начала подготовьтесь к собеседованию. Расширьте свои концепции структур данных с помощью курса Python DS. А чтобы начать свое путешествие по машинному обучению, присоединяйтесь к курсу Машинное обучение - базовый уровень.