小编Hee*_*ony的帖子

InvalidArgumentError:您必须使用 dtype float 和 shape 为占位符张量“Placeholder”提供值

我在 Pycharm 中编写了以下代码,该代码在 Tensorflow 中执行完全连接层 (FCL)。占位符发生无效参数错误。所以我在占位符中输入了所有dtypeshape、 和,但我仍然收到invalid argument errorname

\n\n

我想通过FCL模型制作新的Signal(1, 222)。
\n输入信号(1, 222) => 输出信号(1, 222)

\n\n
    \n
  • maxPredict:查找输出信号中具有最高值的索引。
  • \n
  • calculate Y:获取maxPredict对应的频率数组值。
  • \n
  • loss:使用真实Y之间的差值并计算Y作为损失。
  • \n
  • loss= tf.abs(trueY - 计算Y)`
  • \n
\n\n

代码(发生错误)
\nx = tf.placeholder(dtype=tf.float32, shape=[1, 222], name=\'inputX\')

\n\n

错误

\n\n
\n

InvalidArgumentError(请参阅上面的回溯):您必须为占位符张量 \'inputX\' 提供一个值,dtype float 和形状 [1,222] \n tensorflow.python.framework.errors_impl.InvalidArgumentError:您必须为占位符张量提供一个值 \ 'inputX\' 的 dtype float 和 shape [1,222]\n [[{{node inputX}} = Placeholderdtype=DT_FLOAT, shape=[1,222], _device="/job:localhost/replica:0/task:0/device :CPU:0"]]\n 在处理上述异常的过程中,又发生了一个异常:

\n …

python pycharm deep-learning tensorflow

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

如何在 Tensorflow 中使用多个输入来应用 tf.map_fn

我尝试使用 Pycharm 中的 Tensorflow 使用 tf.map_fn 获得多个输入的转折点。
但是,当我尝试执行此操作时,
出现错误: TypeError: testzz() Missing 1 requiredpositional argument: 'data'

我怎么解决这个问题?或者如何获取 idxCut 的大小以使用 for 循环?

开发内容。

  • 查找数据中与阈值对应的索引(idxCut)。
  • 检查idxCut对应的数据是否为TPR。

我想使用 for 循环在数据中找到有关 idxCut 的 TPR(转折点比率)。
我使用for循环来获取idx,idx-1和idx + 1之间的TPR。
我想找到数据[idx]高于其他数据[idx-1,idx+1]。

    def testtt(data):
        ### Cut-off Threshold
        newData = data[5:num_input - 5]   # shape = [1, 100]
        idxCut = tf.where(newData > cutoff) + 5
        idxCut = tf.squeeze(idxCut)   
        # The size of idxCut is always variable. shape = [1, 10] or shape = [1, 27] or etc

        tq = …
Run Code Online (Sandbox Code Playgroud)

python deep-learning tensorflow turning-point tensor

3
推荐指数
1
解决办法
1556
查看次数