Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Tensor Properties | Tensors
Introduction to TensorFlow

Свайпніть щоб показати меню

book
Tensor Properties

1234567891011121314151617
import tensorflow as tf # Create tensors tensor_1D = tf.constant([1, 2, 3]) tensor_2D = tf.constant([ [1, 2], [3, 4] ]) tensor_3D = tf.constant([ [[1, 2], [3, 4]], [[5, 6], [7, 8]] ]) # Get ranks print(f'Rank of 1D tensor: {tensor_1D.ndim}') print(f'Rank of 2D tensor: {tensor_2D.ndim}') print(f'Rank of 3D tensor: {tensor_3D.ndim}')
copy
123456789101112131415161718
import tensorflow as tf # Create tensors tensor_1D = tf.constant([1, 2, 3, 4]) tensor_2D = tf.constant([ [1, 2, 3], [4, 5, 6] ]) tensor_3D = tf.constant([ [[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]], [[13, 14, 15], [16, 17, 18]] ]) # Get shapes print(f'Shape of 1D tensor: {tensor_1D.shape}') print(f'Shape of 2D tensor: {tensor_2D.shape}') print(f'Shape of 3D tensor: {tensor_3D.shape}')
copy
1234567891011
import tensorflow as tf # Create tensors tensor_int = tf.constant([1, 2, 3, 4]) tensor_float = tf.constant([1., 2., 3., 4.]) tensor_string = tf.constant(['a', 'b', 'c', 'd']) # Get data type print(f'Data type of 1D tensor: {tensor_int.dtype}') print(f'Data type of 2D tensor: {tensor_float.dtype}') print(f'Data type of 3D tensor: {tensor_string.dtype}')
copy
Завдання

Swipe to start coding

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 3
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

close

Awesome!

Completion rate improved to 5.56

book
Tensor Properties

1234567891011121314151617
import tensorflow as tf # Create tensors tensor_1D = tf.constant([1, 2, 3]) tensor_2D = tf.constant([ [1, 2], [3, 4] ]) tensor_3D = tf.constant([ [[1, 2], [3, 4]], [[5, 6], [7, 8]] ]) # Get ranks print(f'Rank of 1D tensor: {tensor_1D.ndim}') print(f'Rank of 2D tensor: {tensor_2D.ndim}') print(f'Rank of 3D tensor: {tensor_3D.ndim}')
copy
123456789101112131415161718
import tensorflow as tf # Create tensors tensor_1D = tf.constant([1, 2, 3, 4]) tensor_2D = tf.constant([ [1, 2, 3], [4, 5, 6] ]) tensor_3D = tf.constant([ [[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]], [[13, 14, 15], [16, 17, 18]] ]) # Get shapes print(f'Shape of 1D tensor: {tensor_1D.shape}') print(f'Shape of 2D tensor: {tensor_2D.shape}') print(f'Shape of 3D tensor: {tensor_3D.shape}')
copy
1234567891011
import tensorflow as tf # Create tensors tensor_int = tf.constant([1, 2, 3, 4]) tensor_float = tf.constant([1., 2., 3., 4.]) tensor_string = tf.constant(['a', 'b', 'c', 'd']) # Get data type print(f'Data type of 1D tensor: {tensor_int.dtype}') print(f'Data type of 2D tensor: {tensor_float.dtype}') print(f'Data type of 3D tensor: {tensor_string.dtype}')
copy
Завдання

Swipe to start coding

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

close

Awesome!

Completion rate improved to 5.56

Свайпніть щоб показати меню

some-alt