self_example/TensorFlow_eaxmple/TensorFlow_constant_Variable/卷积函数实现详解.py

11 lines
333 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import tensorflow as tf
matric1=tf.random.normal([1,5,5,1])
input=tf.Variable(matric1)
print('matric1',matric1)
conv=tf.keras.layers.Conv2D(1,2,padding="SAME")(input)
#上式等价于conv=tf.keras.layers.Conv2D(filters=1,kernel_size=2)(input)
print('conv的大小',conv.shape)
#tf.keras.layers.Conv2D()
tf.keras.layers.MaxPool2D