相关疑难解决方法(0)

在TensorFlow中计算摘要时出错

我正在尝试使用TensorFlow生成摘要并使用TensorBoard可视化它们.但是,我收到一个InvalidArgumentError: You must feed a value for placeholder tensor 'Placeholder_1' with dtype float我不明白的错误().

这是我的计划的完整来源:

from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)

import tensorflow as tf

x = tf.placeholder(tf.float32, [None, 784])
W = tf.Variable(tf.zeros([784, 10]))
b = tf.Variable(tf.zeros([10]))
y = tf.nn.softmax(tf.matmul(x, W) + b)

_ = tf.histogram_summary("weights", W)
_ = tf.histogram_summary("biases", b)
_ = tf.histogram_summary("y", y)


y_ = tf.placeholder(tf.float32, [None, 10])

with tf.name_scope("xent") as scope:
    cross_entropy = -tf.reduce_sum(y_*tf.log(y))
    _ = tf.scalar_summary("cross entropy", cross_entropy)

with tf.name_scope("train") as scope:
    train_step …
Run Code Online (Sandbox Code Playgroud)

python tensorflow tensorboard

4
推荐指数
2
解决办法
7188
查看次数

InvalidArgumentError:您必须使用dtype float和shape [1000,625]为占位符张量'Placeholder'提供值

尝试运行此代码时出现上述意外错误:

# -*- coding: utf-8 -*-
"""
Created on Fri Jun 24 10:38:04 2016

@author: andrea
"""

# pylint: disable=missing-docstring
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import time

from six.moves import xrange  # pylint: disable=redefined-builtin
import tensorflow as tf
from pylab import *
import argparse
import mlp

# Basic model parameters as external flags.
tf.app.flags.FLAGS = tf.python.platform.flags._FlagValues()
tf.app.flags._global_parser = argparse.ArgumentParser()
flags = tf.app.flags
FLAGS = flags.FLAGS
flags.DEFINE_float('learning_rate', 0.01, 'Initial learning rate.')
flags.DEFINE_integer('max_steps', 20, 'Number …
Run Code Online (Sandbox Code Playgroud)

machine-learning neural-network tensorflow

4
推荐指数
1
解决办法
1万
查看次数