0

I have a piece of code that try to get output as the dimension of input that has either 0 or 1 instead of values of [0,1]. I tried to get binary activation function to evaluate binary dataset.

    x = tf.placeholder("float", [None, COLUMN])
    Wh = tf.Variable(tf.random_normal([COLUMN, UNITS_OF_HIDDEN_LAYER], mean=0.0, stddev=0.05))
    h = tf.nn.sigmoid(tf.matmul(x, Wh))

    Wo = tf.Variable(tf.random_normal([UNITS_OF_HIDDEN_LAYER, COLUMN], mean=0.0, stddev=0.05))
    is_greater = tf.greater(tf.matmul(h, Wo), 0)
    y = tf.to_float(is_greater)


    # Objective functions
    y_ = tf.placeholder("float", [None, COLUMN])
    cost = tf.reduce_sum(tf.square(y_ - y)) / BATCH_SIZE

    lr = tf.placeholder(tf.float32)
    eps = tf.placeholder(tf.float32)
    delta = tf.placeholder(tf.float32)

But it throws an error. Can you please find the error?

Backend TkAgg is interactive backend. Turning interactive mode on.
Traceback (most recent call last):
  File "C:\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 490, in apply_op
    preferred_dtype=default_dtype)
  File "C:\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 741, in internal_convert_to_tensor
    ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
  File "C:\Anaconda3\lib\site-packages\tensorflow\python\framework\constant_op.py", line 113, in _constant_tensor_conversion_function
    return constant(v, dtype=dtype, name=name)
  File "C:\Anaconda3\lib\site-packages\tensorflow\python\framework\constant_op.py", line 102, in constant
    tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape))
  File "C:\Anaconda3\lib\site-packages\tensorflow\python\framework\tensor_util.py", line 364, in make_tensor_proto
    raise ValueError("None values not supported.")
ValueError: None values not supported.
user3104352
  • 1,100
  • 1
  • 16
  • 34
  • Is there any more traceback information available? In particular, which line of your code throws the error? – mrry Sep 25 '17 at 14:46
  • I am running into something similar. My guess is that tf.greater has an undefined gradient, i.e. None. – tom Nov 22 '17 at 18:57

0 Answers0