Tensorboard提供运行时统计信息,可以分析内存消耗和计算时间(请参阅文档).然而,在tensorflow v1.2.1中,我的一些操作以虚线和橙色显示为"未使用的子结构",并且根本没有提供任何信息 - 没有设备,也没有内存,也没有计算时间.
随着tensorflow v1.3的更新,这甚至变得更糟.现在一切都是橙色破旧的"未使用的子结构"
我尝试了各种更大的tensorflow项目,我需要优化它以及工作的同事PC.我做错了什么,或者这是张量流/张量板中的错误?
这是一个简约的示例代码:
import tensorflow as tf
from tensorflow.python.client import timeline
sess = tf.InteractiveSession()
run_options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)
run_metadata = tf.RunMetadata()
# create some dummy Ops for the graph
C1 = tf.constant(5)
C2 = tf.constant(3)
myOp = C1*C2 + tf.square(C2)
res = sess.run([myOp], options=run_options,run_metadata = run_metadata)
writer = tf.summary.FileWriter(logdir='tensorboard/profile_bug',graph=sess.graph)
print (res)
tl = timeline.Timeline(run_metadata.step_stats)
ctf = tl.generate_chrome_trace_format()
with open('tensorboard/timelineOfBug.json', 'w') as f:
f.write(ctf)
writer.add_run_metadata(run_metadata,"mySess")
writer.close()
sess.close()
Run Code Online (Sandbox Code Playgroud) 我是numpy的蒙面数组数据结构的新手,我想用它来处理分段彩色图像.
当我使用matplotlib plt.imshow( masked_gray_image, "gray")显示蒙版灰色图像时,无效区域将显示为透明,这就是我想要的.但是,当我为彩色图像做同样的事情时,它似乎不起作用.有趣的是,数据点光标不会显示rgb值[r,g,b]而是为空[],但仍会显示颜色值而不是透明.
我做错了还是matplotlib尚未提供imshow?
import numpy as np
import matplotlib.pyplot as plt
from scipy.misc import face
img_col = face() #example image from scipy
img_gray = np.dot(img_col[...,:3], [0.299, 0.587, 0.114]) #convert to gray
threshold = 25
mask2D = img_gray < threshold # some exemplary mask
mask3D = np.atleast_3d(mask2D)*np.ones_like(img_col) # expand to 3D with broadcasting...
# using numpy's masked array to specify where data is valid
m_img_gray = np.ma.masked_where( mask2D, img_gray)
m_img_col = …Run Code Online (Sandbox Code Playgroud)