0

我有一段代码尝试将输出作为输入的维度,该维度具有 0 或 1 而不是 [0,1] 的值。我试图获得二进制激活函数来评估二进制数据集。

    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)

但它会引发错误。你能找到错误吗?

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.
4

0 回答 0