本文整理汇总了Python中memory.Memory.use_memory方法的典型用法代码示例。如果您正苦于以下问题:Python Memory.use_memory方法的具体用法?Python Memory.use_memory怎么用?Python Memory.use_memory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类memory.Memory
的用法示例。
在下文中一共展示了Memory.use_memory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FCN8VGG
# 需要导入模块: from memory import Memory [as 别名]
# 或者: from memory.Memory import use_memory [as 别名]
img_channel = 3
num_classes = 21
images = tf.placeholder(tf.float32,shape=(batch_size,img_height, img_width, img_channel))
labels = tf.placeholder(tf.int64,shape=(batch_size*img_height*img_width))
learning_rate = tf.placeholder(tf.float32, shape=[])
#valid_index = tf.placeholder(tf.bool,shape=(batch_size*img_height*img_width))
vgg_fcn = FCN8VGG()
with tf.name_scope("content_vgg"):
upscore32 = vgg_fcn.build(images, num_classes=num_classes, debug=False, random_init_fc8=True, train=True)
upscore32_test = vgg_fcn.build(images, num_classes=num_classes, debug=False, random_init_fc8=True, train=False)
mm = Memory()
with tf.name_scope("memory"):
mems = mm.build(images, batch_size=batch_size)
pred_score = mm.use_memory(upscore32, mems, num_classes=num_classes, kernal_size=3, train=True, wd=1e-3)
pred_score_test = mm.use_memory(upscore32_test, mems, num_classes=num_classes, kernal_size=3, train=False, wd=1e-3)
cc = loss(pred_score, labels,num_classes=num_classes)
cc_test = loss(pred_score_test, labels,num_classes=num_classes)
pred_test = tf.argmax(pred_score_test, dimension=3)
optimizer=tf.train.AdamOptimizer(learning_rate)
optimizer2 = tf.train.AdamOptimizer(1e-3, beta1=0.5)
varis=tf.trainable_variables()
varis_cnn = []
varis_lstm = []
for i,v in enumerate(varis):
print v.name
if v.name.startswith("sensor") or v.name.startswith("lstm") or v.name.startswith("writeW"):
varis_lstm.append(v)