Python - tensorflow.math.conj ()
TensorFlow - это библиотека Python с открытым исходным кодом, разработанная Google для разработки моделей машинного обучения и нейронных сетей глубокого обучения. Cony () используется для поэлементного комплексного сопряжения комплексного входного тензора.
Syntax: tensorflow.math.conj( x, name)
Parameters:
- x: It’s a tensor and it must have numeric values.
- name(optional): It’s defines the name for the operation.
Returns:
It return a tensor of same dtype as x.
It will raise TypeError if input is not numeric tensor.
Пример 1:
Python3
# importing the libraryimport tensorflow as tf # Initializing the input tensora = tf.constant([1+5j,3+2j,4+1j],dtype = tf.complex128) # Printing the input tensorprint("a: ",a) # Finding the complex conjugateres = tf.math.conj(a) # Printing the resultprint("Complex Conjugate: ",res) |
Выход:
a: tf.Tensor ([1. + 5.j 3. + 2.j 4. + 1.j], shape = (3,), dtype = complex128) Комплексное сопряжение: tf.Tensor ([1.-5.j 3.-2.j 4.-1.j], shape = (3,), dtype = complex128)
Example 2: This example uses input with dtype float64.
Python3
# importing the libraryimport tensorflow as tf # Initializing the input tensora = tf.constant([1, 2, 3],dtype = tf.float64) # Printing the input tensorprint("a: ",a) # Finding the complex conjugateres = tf.math.conj(a) # Printing the resultprint("Complex Conjugate: ",res) |
Выход:
a: tf.Tensor ([1. 2. 3.], shape = (3,), dtype = float64) Комплексное сопряжение: tf.Tensor ([1. 2. 3.], shape = (3,), dtype = float64)
Внимание компьютерщик! Укрепите свои основы с помощью базового курса программирования Python и изучите основы.
Для начала подготовьтесь к собеседованию. Расширьте свои концепции структур данных с помощью курса Python DS. А чтобы начать свое путешествие по машинному обучению, присоединяйтесь к курсу Машинное обучение - базовый уровень.