Skip to content

minimize raises "ValueError: None values not supported." error when tf.while_loop used inside fn() of tf.cond() #3208

@liusiqi43

Description

@liusiqi43

On TF 0.9.0, The following code with tf.while_loop inside tf.cond raises ValueError when minimized.

import tensorflow as tf
from tensorflow.python.ops import tensor_array_ops

with tf.Session() as sess:
    a = tf.constant([[1., 2.], [3.,4.]])
    w = tf.get_variable('w', [2, 1], tf.float32)
    c = tf.Variable(1)

    def loss_a(a, w):
        a_ta = tensor_array_ops.TensorArray(dtype=tf.float32, size=2,
                                            tensor_array_name="a_ta")
        a_ta = a_ta.unpack(a)

        b_ta = tensor_array_ops.TensorArray(dtype=tf.float32, size=2,
                                            tensor_array_name="b_ta")


        time = tf.constant(0, dtype=tf.int32, name="time")

        def _time_step(time, a_ta_t, b_ta_t):
          a = a_ta_t.read(time)
          b_ta_t = b_ta_t.write(time, a * w)
          return (time+1, a_ta_t, b_ta_t)

        (_, _, final_b) = tf.while_loop(
            cond=lambda time, _1, _2: time < 2,
            body=_time_step,
            loop_vars=(time, a_ta, b_ta),
            parallel_iterations=32,
            swap_memory=True)
        b = tf.reduce_sum(final_b.pack(), 0)
        return b

    def loss_b(a, w):
        return 2 * a * w

    loss = tf.cond(tf.equal(c, 0), lambda: loss_a(a, w), lambda: loss_b(a,w))
    train_op = tf.train.AdamOptimizer(1e-4).minimize(loss)

    sess.run(tf.initialize_all_variables())

    sess.run(train_op)

Traceback (most recent call last):
File "test.py", line 39, in
train_op = tf.train.AdamOptimizer(1e-4).minimize(loss)
File "/.../tensorflow/python/training/optimizer.py", line 193, in minimize
grad_loss=grad_loss)
File "/.../tensorflow/python/training/optimizer.py", line 250, in compute_gradients
colocate_gradients_with_ops=colocate_gradients_with_ops)
File "/.../tensorflow/python/ops/gradients.py", line 481, in gradients
in_grads = _AsList(grad_fn(op, *out_grads))
File "/.../tensorflow/python/ops/tensor_array_grad.py", line 115, in _TensorArrayWriteGrad
grad = g.read(index)
File "/.../tensorflow/python/ops/tensor_array_ops.py", line 191, in read
dtype=self._dtype, name=name)
File "/.../tensorflow/python/ops/gen_data_flow_ops.py", line 905, in _tensor_array_read
flow_in=flow_in, dtype=dtype, name=name)
File "/.../tensorflow/python/ops/op_def_library.py", line 704, in apply_op
op_def=op_def)
File "/.../tensorflow/python/framework/ops.py", line 2260, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/.../tensorflow/python/framework/ops.py", line 1234, in init
self._control_flow_context.AddOp(self)
File "/.../tensorflow/python/ops/control_flow_ops.py", line 1479, in AddOp
self._AddOpInternal(op)
File "/.../tensorflow/python/ops/control_flow_ops.py", line 1499, in _AddOpInternal
self.AddValue(x)
File "/.../tensorflow/python/ops/control_flow_ops.py", line 1438, in AddValue
real_val = grad_ctxt.grad_state.GetRealValue(val)
File "/.../tensorflow/python/ops/control_flow_ops.py", line 781, in GetRealValue
real_value = self.AddBackPropAccumulatedValue(h_value, value)
File "/.../tensorflow/python/ops/control_flow_ops.py", line 731, in AddBackPropAccumulatedValue
history_value = _SwitchRefOrTensor(history_value, pred)[branch]
File "/.../tensorflow/python/ops/control_flow_ops.py", line 324, in _SwitchRefOrTensor
return ref_switch(data, pred, name=name)
File "/.../tensorflow/python/ops/gen_control_flow_ops.py", line 341, in ref_switch
result = _op_def_lib.apply_op("RefSwitch", data=data, pred=pred, name=name)
File "/.../tensorflow/python/ops/op_def_library.py", line 459, in apply_op
as_ref=input_arg.is_ref).dtype.name
File "/.../tensorflow/python/framework/ops.py", line 620, in convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/.../tensorflow/python/ops/constant_op.py", line 179, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "/.../tensorflow/python/ops/constant_op.py", line 162, in constant
tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape))
File "/.../tensorflow/python/framework/tensor_util.py", line 346, in make_tensor_proto
raise ValueError("None values not supported.")
ValueError: None values not supported.

It works fine if I add la, lb as follows, although this would force execution of loss_a and loss_b regardless of the pred in tf.cond().

    la = loss_a(a, w)
    lb = loss_b(a, w)

    loss = tf.cond(tf.equal(c, 0), lambda: la, lambda: lb)
    train_op = tf.train.AdamOptimizer(1e-4).minimize(loss)

    sess.run(tf.initialize_all_variables())

    sess.run(train_op)

Is this a known issue or did I miss something in how to use tf.while_loop within tf.cond?

Activity

changed the title [-]minimize raise "ValueError: None values not supported." error when tf.while_loop used inside fn() of tf.cond()[/-] [+]minimize raises "ValueError: None values not supported." error when tf.while_loop used inside fn() of tf.cond()[/+] on Jul 6, 2016
concretevitamin

concretevitamin commented on Jul 18, 2016

@concretevitamin
Contributor

Could you try using the (somewhat experimental) @Defun functionality to see if it works? See testWhileFuncBasic() in control_flow_ops_py_test.py.

aselle

aselle commented on Jul 27, 2016

@aselle
Contributor

Automatically closing due to lack of recent activity. Please reopen if additional information becomes available.

rifatmahmud

rifatmahmud commented on Jul 28, 2016

@rifatmahmud

The error is also occurring when restoring a model trained using layers.stack with a Estimator class(providing as model directory where the model is saved, and model_fn as the conv_model written in skflow mnist example).
File "/usr/local/lib/python3.4/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 394, in predict as_iterable=as_iterable) File "/usr/local/lib/python3.4/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 663, in _infer_model predictions = self._get_predict_ops(features) File "/usr/local/lib/python3.4/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 897, in _get_predict_ops predictions, _, _ = self._call_model_fn(features, targets, ModeKeys.INFER) File "/usr/local/lib/python3.4/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 806, in _call_model_fn return self._model_fn(features, targets) File "test.py", line 34, in conv_model return learn.models.logistic_regression(h_fc1, y) File "/usr/local/lib/python3.4/dist-packages/tensorflow/contrib/learn/python/learn/models.py", line 137, in logistic_regression logging_ops.histogram_summary('%s.y' % vs.get_variable_scope().name, y) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/ops/logging_ops.py", line 125, in histogram_summary tag=tag, values=values, name=scope) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/ops/gen_logging_ops.py", line 100, in _histogram_summary name=name) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/framework/op_def_library.py", line 458, in apply_op as_ref=input_arg.is_ref).dtype.name File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/framework/ops.py", line 621, in convert_to_tensor ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/framework/constant_op.py", line 180, in _constant_tensor_conversion_function return constant(v, dtype=dtype, name=name) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/framework/constant_op.py", line 163, in constant tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape)) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/framework/tensor_util.py", line 346, in make_tensor_proto raise ValueError("None values not supported.") ValueError: None values not supported.

reopened this on Jul 28, 2016
hendrycks

hendrycks commented on Aug 5, 2016

@hendrycks

I get a similar error when I have a map_fn modifying a variable, and the map_fn is inside of a cond, but this may not be informative if map_fn uses while (I haven't checked).

Traceback (most recent call last):
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 454, in apply_op
    as_ref=input_arg.is_ref)
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 621, in convert_to_tensor
    ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/constant_op.py", line 180, in _constant_tensor_conversion_function
    return constant(v, dtype=dtype, name=name)
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/constant_op.py", line 163, in constant
    tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape))
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/tensor_util.py", line 346, in make_tensor_proto
    raise ValueError("None values not supported.")
ValueError: None values not supported.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "cifar10_shallow.py", line 161, in <module>
    optimizer = tf.train.AdamOptimizer(learning_rate=lr).minimize(loss, global_step=global_step)
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/training/optimizer.py", line 193, in minimize
    grad_loss=grad_loss)
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/training/optimizer.py", line 250, in compute_gradients
    colocate_gradients_with_ops=colocate_gradients_with_ops)
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/gradients.py", line 484, in gradients
    in_grads = _AsList(grad_fn(op, *out_grads))
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/tensor_array_grad.py", line 115, in _TensorArrayWriteGrad
    grad = g.read(index)
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/tensor_array_ops.py", line 191, in read
    dtype=self._dtype, name=name)
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/gen_data_flow_ops.py", line 1344, in _tensor_array_read
    flow_in=flow_in, dtype=dtype, name=name)
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 703, in apply_op
    op_def=op_def)
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 2298, in create_op
    original_op=self._default_original_op, op_def=op_def)
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1236, in __init__
    self._control_flow_context.AddOp(self)
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/control_flow_ops.py", line 1493, in AddOp
    self._AddOpInternal(op)
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/control_flow_ops.py", line 1513, in _AddOpInternal
    self.AddValue(x)
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/control_flow_ops.py", line 1452, in AddValue
    real_val = grad_ctxt.grad_state.GetRealValue(val)
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/control_flow_ops.py", line 788, in GetRealValue
    real_value = self.AddBackPropAccumulatedValue(history_value, value)
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/control_flow_ops.py", line 737, in AddBackPropAccumulatedValue
    history_value = _SwitchRefOrTensor(history_value, pred)[branch]
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/control_flow_ops.py", line 325, in _SwitchRefOrTensor
    return ref_switch(data, pred, name=name)
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/gen_control_flow_ops.py", line 341, in ref_switch
    result = _op_def_lib.apply_op("RefSwitch", data=data, pred=pred, name=name)
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 458, in apply_op
    as_ref=input_arg.is_ref).dtype.name
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 621, in convert_to_tensor
    ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/constant_op.py", line 180, in _constant_tensor_conversion_function
    return constant(v, dtype=dtype, name=name)
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/constant_op.py", line 163, in constant
    tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape))
  File "/home-nfs/dan/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/tensor_util.py", line 346, in make_tensor_proto
    raise ValueError("None values not supported.")
cshapeshifter

cshapeshifter commented on Aug 17, 2016

@cshapeshifter

I'm encountering the same error when calling learn.Estimator.predict on a restored, already trained model, unless I call learn.Estimator.fit beforehand. The following code is largely based on this example. My guess is that some important stuff isn't initialized by calling predict. For example, I don't see "Creating TensorFlow device" or anything like that when only calling predict.

I'm using a tensorflow 0.10.0rc0 nightly from a few days ago.

To reproduce:

  1. Run ./text_classification_character_rnn.py -m model to train a model stored in the "model" directory
  2. Run ./text_classification_character_rnn.py -m model -t to load the model and make a prediction only, without calling fit first, which causes the error.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from optparse import OptionParser
import numpy as np
from sklearn import metrics
import pandas

import tensorflow as tf
from tensorflow.contrib import learn

FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_bool('test_with_fake_data', False,
                         'Test the example code with fake data.')

MAX_DOCUMENT_LENGTH = 200
HIDDEN_SIZE = 60

parser = OptionParser()
parser.add_option("-m", "--model", dest="model_dir",
                  help="specify current model directory")
parser.add_option("-t", "--testonly", action="store_true", dest="testonly",
                  default=False, help="test the model without training")

(options, args) = parser.parse_args()

class ProgressMonitor(learn.monitors.BaseMonitor):
    def __init__(self):
        print('[Monitor] Init')
    def begin(self, max_steps):
        print('[Monitor] Starting run.')
    def end(self):
        print('[Monitor] Completed run.')
    def step_begin(self, step):
        print('[Monitor] Step %d...' % step)
        return []
    def step_end(self, step, outputs):
        pass

def char_rnn_model(x, y):
  """Character level recurrent neural network model to predict classes."""

  # restore saved model if provided
  y = tf.one_hot(y, 15, 1, 0)
  byte_list = learn.ops.one_hot_matrix(x, 128)
  byte_list = tf.unpack(byte_list, axis=1)

  cell = tf.nn.rnn_cell.GRUCell(HIDDEN_SIZE)
  #cell = tf.nn.rnn_cell.BasicLSTMCell(HIDDEN_SIZE)
  #cell = tf.nn.rnn_cell.LSTMCell(HIDDEN_SIZE)
  _, encoding = tf.nn.rnn(cell, byte_list, dtype=tf.float32)

  prediction, loss = learn.models.logistic_regression(encoding, y)

  train_op = tf.contrib.layers.optimize_loss(
      loss, tf.contrib.framework.get_global_step(),
      optimizer='Adam', learning_rate=0.01)

  return {'class': tf.argmax(prediction, 1), 'prob': prediction}, loss, train_op


def main(unused_argv):

  # Prepare training and testing data
  dbpedia = learn.datasets.load_dataset(
      'dbpedia', test_with_fake_data=FLAGS.test_with_fake_data)
  x_train = pandas.DataFrame(dbpedia.train.data)[1]
  y_train = pandas.Series(dbpedia.train.target)
  x_test = pandas.DataFrame(dbpedia.test.data)[1]
  y_test = pandas.Series(dbpedia.test.target)

  # Process vocabulary
  char_processor = learn.preprocessing.ByteProcessor(MAX_DOCUMENT_LENGTH)
  x_train = np.array(list(char_processor.fit_transform(x_train)))
  x_test = np.array(list(char_processor.transform(x_test)))

  # Build model
  classifier = learn.Estimator(model_fn=char_rnn_model, model_dir=options.model_dir)

  # Train and predict
  monitor = ProgressMonitor()
  if not options.testonly:
    classifier.fit(x_train, y_train, max_steps=10, batch_size=10000, monitors=[monitor])
  y_predicted = classifier.predict(x_test, batch_size=10000)
  score = metrics.accuracy_score(y_test, y_predicted['class'])
  print('Accuracy: {0:f}'.format(score))


if __name__ == '__main__':
  tf.app.run()

The error:

[Monitor] Init
Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 454, in apply_op
    as_ref=input_arg.is_ref)
  File "/usr/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 628, in convert_to_tensor
    ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
  File "/usr/lib/python3.5/site-packages/tensorflow/python/framework/constant_op.py", line 180, in _constant_tensor_conversion_function
    return constant(v, dtype=dtype, name=name)
  File "/usr/lib/python3.5/site-packages/tensorflow/python/framework/constant_op.py", line 163, in constant
    tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape))
  File "/usr/lib/python3.5/site-packages/tensorflow/python/framework/tensor_util.py", line 346, in make_tensor_proto
    raise ValueError("None values not supported.")
ValueError: None values not supported.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./text_classification_character_rnn.py", line 119, in <module>
    tf.app.run()
  File "/usr/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 30, in run
    sys.exit(main(sys.argv))
  File "./text_classification_character_rnn.py", line 113, in main
    y_predicted = classifier.predict(x_test, batch_size=10000)
  File "/usr/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 323, in predict
    as_iterable=as_iterable)
  File "/usr/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 592, in _infer_model
    predictions = self._get_predict_ops(features)
  File "/usr/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 824, in _get_predict_ops
    predictions, _, _ = self._call_model_fn(features, targets, ModeKeys.INFER)
  File "/usr/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 733, in _call_model_fn
    return self._model_fn(features, targets)
  File "./text_classification_character_rnn.py", line 73, in char_rnn_model
    y = tf.one_hot(y, 15, 1, 0)
  File "/usr/lib/python3.5/site-packages/tensorflow/python/ops/array_ops.py", line 2717, in one_hot
    name)
  File "/usr/lib/python3.5/site-packages/tensorflow/python/ops/gen_array_ops.py", line 1421, in _one_hot
    axis=axis, name=name)
  File "/usr/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 458, in apply_op
    as_ref=input_arg.is_ref).dtype.name
  File "/usr/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 628, in convert_to_tensor
    ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
  File "/usr/lib/python3.5/site-packages/tensorflow/python/framework/constant_op.py", line 180, in _constant_tensor_conversion_function
    return constant(v, dtype=dtype, name=name)
  File "/usr/lib/python3.5/site-packages/tensorflow/python/framework/constant_op.py", line 163, in constant
    tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape))
  File "/usr/lib/python3.5/site-packages/tensorflow/python/framework/tensor_util.py", line 346, in make_tensor_proto
    raise ValueError("None values not supported.")

As a workaround, I can call classifier.evaluate(x_train, y_train, batch_size=10000) before calling predict, and then it works fine. Maybe this is not a bug but simply an API misunderstanding. I don't see any indication that evaluate must be called before predict can be called.

yuanbyu

yuanbyu commented on Aug 24, 2016

@yuanbyu
Contributor

The original issue posted by liusiqi43@ should already be fixed at HEAD.

ozt-j

ozt-j commented on Sep 27, 2016

@ozt-j

the same issue.

python train_cifar.py
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcurand.so locally

Downloading cifar-10-binary.tar.gz 100.0%
Successfully downloaded cifar-10-binary.tar.gz 170052171 bytes.
Filling queue with 20000 CIFAR images before starting to train. This will take a few minutes.
Traceback (most recent call last):
File "train_cifar.py", line 311, in
tf.app.run()
File "/home/ozzie/anaconda2/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 30, in run
sys.exit(main(sys.argv[:1] + flags_passthrough))
File "train_cifar.py", line 307, in main
train(is_training, logits, images, labels)
File "/media/New_bt/ML/tensorflow-resnet/resnet_train.py", line 33, in train
loss_ = loss(logits, labels)
File "/media/New_bt/ML/tensorflow-resnet/resnet.py", line 148, in loss
cross_entropy = tf.nn.sparse_softmax_cross_entropy_with_logits(logits, labels)
File "/home/ozzie/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/nn_ops.py", line 745, in sparse_softmax_cross_entropy_with_logits
logits = ops.convert_to_tensor(logits)
File "/home/ozzie/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 657, in convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/home/ozzie/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.py", line 180, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "/home/ozzie/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.py", line 163, in constant
tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape))
File "/home/ozzie/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py", line 346, in make_tensor_proto
raise ValueError("None values not supported.")
ValueError: None values not supported.

Hippogriff

Hippogriff commented on Oct 2, 2016

@Hippogriff

Did anyone find solution to this problem?

finlay-liu

finlay-liu commented on Dec 25, 2016

@finlay-liu

I meet this bug too, it seems about the tf.Variable, you can try it with tf.Variable(0, trainable = False)

drpngx

drpngx commented on Jan 24, 2017

@drpngx
Contributor

@yuanbyu I think I saw something recently about that. Was that fixed at some point recently?

agniszczotka

agniszczotka commented on Mar 3, 2017

@agniszczotka

I met the same exception: ValueError: None values not supported.
It is impossible to use train model in the way:
nn = tf.contrib.learn.Estimator(model_fn=model_fn,model_dir='/path') predictions = nn.predict(x=prediction_set.data, as_iterable=True)

the hack to solve it is to run an evaluation before a prediction.
nn = tf.contrib.learn.Estimator(model_fn=model_fn,model_dir='/path') ev = nn.evaluate(x=test_set.data, y=test_set.target, steps=1) predictions = nn.predict(x=prediction_set.data, as_iterable=True)

efeiefei

efeiefei commented on Mar 8, 2017

@efeiefei

@agniszczotka
Great ! That solved my problem !
But I still do not know why ~

asimshankar

asimshankar commented on Apr 5, 2017

@asimshankar
Contributor

Automatically closing due to lack of recent activity. Please update the issue when new information becomes available, and we will reopen the issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @asimshankar@ozt-j@aselle@concretevitamin@liusiqi43

      Issue actions

        minimize raises "ValueError: None values not supported." error when tf.while_loop used inside fn() of tf.cond() Β· Issue #3208 Β· tensorflow/tensorflow