溫馨提示×

tensorflow創建張量的方法是什么

小億
87
2024-03-15 12:38:23
欄目: 深度學習

在TensorFlow中,可以使用tf.constant()函數來創建張量。例如:

import tensorflow as tf

# 創建一個標量
scalar = tf.constant(5)

# 創建一個向量
vector = tf.constant([1, 2, 3])

# 創建一個矩陣
matrix = tf.constant([[1, 2], [3, 4]])

# 創建一個三維張量
tensor = tf.constant([[[1, 2], [3, 4]], [[5, 6], [7, 8]]])

0
亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女