Skip to content

Instantly share code, notes, and snippets.

@funwarioisii
Created June 6, 2018 10:45
Show Gist options
  • Save funwarioisii/c0f3228f576ac5f92ddc97f1beb4c67a to your computer and use it in GitHub Desktop.
Save funwarioisii/c0f3228f576ac5f92ddc97f1beb4c67a to your computer and use it in GitHub Desktop.
tf.summary.imageのやり方を忘れがちなのでメモしておく
import tensorflow as tf
def cnn(image):
with tf.name_scope('conv1'):
W_conv1 = tf.nn.conv2d(image, weight, strides=[1, 1, 1, 1], padding='SAME')
w_conv1 = tf.transpose(tf.reshape(W_conv1, [-1, 224, 224, 3]), perm=[3, 0, 1, 2]) # 可視化用
with tf.device('/cpu:0'): # どこかでtf.device('/gpu:2')などしてると落ちるので
tf.summary.image('filter', w_conv1, 10)
return y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment