Jupyter에서 Tensorboard 시각화 하는 법
2019. 5. 1. 17:26ㆍ분석 Python/Tensorflow
모델 아키텍추 구성하고
tensorboard() 함수 만든 것을 시행하면 jupyter에 tensorboard가 켜진다!
def _strip_consts( graph_def):
from IPython.display import clear_output, Image, display, HTML
"""Strip large constant values from graph_def."""
strip_def = tf.GraphDef()
for n0 in graph_def.node:
n = strip_def.node.add()
n.MergeFrom(n0)
if n.op == 'Const':
tensor = n.attr['value'].tensor
size = len(tensor.tensor_content)
return strip_def
def _show_graph( graph_def):
from IPython.display import clear_output, Image, display, HTML
"""Visualize TensorFlow graph."""
if hasattr(graph_def, 'as_graph_def'):
graph_def = graph_def.as_graph_def()
strip_def = _strip_consts(graph_def)
code = """
<script>
function load() {{
document.getElementById("{id}").pbtxt = {data};
}}
</script>
<div style="height:600px">
<tf-graph-basic id="{id}"></tf-graph-basic>
</div>
""".format(data=repr(str(strip_def)), id='graph'+str(np.random.rand()))
iframe = """
<iframe seamless style="width:100%;height:620px;border:0" srcdoc="{}"></iframe>
""".format(code.replace('"', '"'))
display(HTML(iframe))
def tensorboard():
_show_graph(tf.get_default_graph().as_graph_def())
728x90
'분석 Python > Tensorflow' 카테고리의 다른 글
GAN minibatch discrimination code (0) | 2019.05.28 |
---|---|
[Python] 실습 Categorical 변수를 Embedding 해보기 (0) | 2019.05.20 |
Colaboratory와 tensorboard와 tensorflow를 활용한 GAN 구현물 (4) | 2019.05.18 |
tensorflow eager gpu 할당 쓴만큼만 잡게하기. (0) | 2019.05.04 |
Jupyter width 100% 만들기 및 tensorflow warning 안뜨게 하기 (0) | 2019.05.01 |