<jupyter_start><jupyter_text>Create 2 filters<jupyter_code>#shape of filters is [fh,fw,fn',fn]
"""
fh: filter height
fw: filter width
fn': Num feature maps in previous layer
fn: Num feature maps in this layer
"""
filters = np.zeros(shape=(7,7,channels,2), dtype=np.float32)
filters[:,3,:,0] = 1 # Vertical Line in the middle
filters[3,:,:,1] = 1 # Horizontal line<jupyter_output><empty_output><jupyter_text>Create a graph with input X and conv layer applying these 2 filters<jupyter_code>import tensorflow as tf
X = tf.placeholder(dtype=tf.float32,shape=(None,height,width,channels),name="X")
convolution = tf.nn.conv2d(X,filters,strides=[1,2,2,1],padding="SAME")
import matplotlib.pyplot as plt
%matplotlib inline
with tf.Session() as sess:
    output = sess.run(convolution, feed_dict={X:dataset})
    
plt.imshow(output[0,:,:,1], cmap="gray")#plot 1st image's 2nd feature map
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14689880304678998, 'fraction_numerical': 0.026115342763873776, 'mean_word_length': 7.288288288288288, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '102597', 'license': 'Apache-2.0', 'n_tokens_mistral': 347, 'n_tokens_neox': 332, 'n_words': 81, 'path': 'Ch13_CNNs/CNN codealong.ipynb', 'repo_name': 'edwardchaos/Hands-on-ML-with-Sklearn-and-TensorFlow', 'size': '919'}