import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'#过滤爆红的信息
import tensorflow as tf
x=tf.random.normal([4,32,32,3])
print((x+tf.random.normal([3])).shape)#自动对准最后的数字
print((x+tf.random.normal([32,32,1])).shape)
print((x+tf.random.normal([4,1,1,1])).shape)
print((x+tf.random.normal([1,32,1,1])).shape)
输出:
(4, 32, 32, 3)
(4, 32, 32, 3)
(4, 32, 32, 3)
(4, 32, 32, 3)