tensorboard+win10+pycharm(记录自己的问题)

本文记录了在Win10环境下使用Tensorboard进行神经网络可视化时遇到的问题及解决过程。首先确保安装了Anaconda、Python和Tensorflow。在尝试使用Tensorboard时,通过代码生成日志文件,关键在于设置正确的log_dir。运行代码后,需在Anaconda的终端中切换到日志文件夹并启动Tensorboard。如果出现无法显示数据的情况,可能是因为父路径不是文件夹导致,应确保父路径为一个具体的文件夹。此外,学习了如何在指定路径打开CMD的方法。

tensorboad使用血泪史

本来是按照师姐的吩咐,在做压缩神经的实验,改改师姐的代码,看起来都很容易,突然抽了个疯,想把这个网络的图画出来,结果,死在tensorboard上了:

前提

  1. 安装好anaconda 和 python 和tensorflow。下面这个博客,一站搞定:windows+anaconda+python
  2. 安装tensorboard

找一段代码然后执行

我用的是自己的代码改了改。尝试使用tensorboard的可以使用下面这个代码,传说是官网给的,有点长啊啊。这有个教程解释得还比较详细:tensorboard,辛苦他了。

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import argparse
import sys

import tensorflow as tf

from tensorflow.examples.tutorials.mnist import input_data

FLAGS = None


def train():
    # Import data
    mnist = input_data.read_data_sets(FLAGS.data_dir,
                                      one_hot=True,
                                      fake_data=FLAGS.fake_data)

    sess = tf.InteractiveSession()
    # Create a multilayer model.

    # Input placeholders
    with tf.name_scope('input'):
        x = tf.placeholder(tf.float32, [None, 784], name='x-input')
        y_ = tf.placeholder(tf.float32, [None, 10], name='y-input')

    with tf.name_scope('input_reshape'):
        image_shaped_input = tf.reshape(x, [-1, 28, 28, 1])
        tf.summary.image('input', image_shaped_input, 10)

        # We can't initialize these variables to 0 - the network will get stuck.

    def weight_variable(shape):
        """Create a weight variable with appropriate initialization."""
        initial = tf.truncated_normal(shape, stddev=0.1)
        return tf.Variabl
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值