代码演示
# -*- coding: utf-8 -*-
import tensorflow as tf
import numpy as np
"""
Created on Tue Jul 17 10:03:21 2018
@author: C.H.
"""
tf.reset_default_graph()#这一句话非常重要,如果没有这句话,就会出现重复定义变量的错误
x = tf.placeholder(tf.float32, shape=(1, 500, 500, 3))
#分别设置3*3,5*5,7*7三种大小的卷积核
weights1 = tf.get_variable('weights1',shape=[3, 3, 3, 16],dtype=tf.float32,initializer=tf.truncated_normal_initializer(stddev=0.1, dtype=tf.float32))
weights2 = tf.get_variable('weights2',shape=[5, 5, 3, 16],dtype=tf.float32,initializer=tf.truncated_normal_initializer(stddev=0.1, dtype=tf.float32))
weights3 = tf.get_variable('weights3',shape=[7, 7, 3, 16],dtype=tf.float32,initializer=tf.truncated_normal_initializer(stddev=0.1, dtype=tf.float32))
#第一组实