How do I use Tensorflow tf.nn.conv2 to make a convolutional layer?
问题 With tf.nn.conv2d , you can perform a convolutional operation on a tensor. E.g. import tensorflow as tf x = tf.random.uniform(shape=(1, 224, 224, 3), dtype=tf.float32) filters = tf.random.uniform(shape=(1, 3, 3, 10)) tf.nn.conv2d(input=x, filters=filters, strides=1, padding='VALID') <tf.Tensor: shape=(1, 224, 222, 10), dtype=float32, numpy= array([[[[2.1705112, 1.2065555, 1.7674012, ..., 1.705754 , 1.3659815, 1.7028458], [2.0048866, 1.4835871, 1.2038497, ..., 1.8981357, 1.4605963, 2.148876 ],