我试图在我的网络结构中使用ResidualWrapper和HighwayWrapper,但是我得到了形状不匹配错误。 所以我试过的是: import tensorflow as tf
from tensorflow.contrib import rnn
tf.reset_default_graph()
a = tf.placeholder(tf.float32,[2,5,10])
with tf.variable_scope('encoder') as scope:
model = tf.nn.dynamic_rnn(tf.nn.rnn_cell.Res
完全错误是
WARNING:tensorflow:Model was constructed with shape (None, None, 6) for input KerasTensor(type_spec=TensorSpec(shape=(None, None, 6), dtype=tf.float32, name='dense_input'), name='dense_input', description="created by layer 'dense_input'"), but it was called on a
我试图在一个更大的神经网络系统中添加2层字符级CNN,但是我得到了输入维度的ValueError。
我想要实现的是通过替换字符(根据大写,或数字或字母)并将它们输入CNN来获得输入单词的正字法表示。我知道LSTM/RNN可以实现这一点,但是需求表明使用CNN,所以使用另一个NN不是可选的。
大多数示例自然使用图像数据集(MNIST等)。但不是文本数据集。所以我很困惑,也不知道如何“重塑”角色嵌入,这样才能成为CNN的有效输入。
下面是我试图运行的代码的一部分:
# ...
# shape = (batch size, max length of sentence, max length of
我尝试使用tensorflow作为后端来构建一个自定义的Keras regularize。执行下面这段代码会给我一个异常:
import tensorflow as tf
from tensorflow import keras
inputs = keras.Input(shape=(10,))
x = keras.backend.conv1d(inputs, tf.constant([-1,1]), padding = 'same', dilation_rate=None)
x = keras.backend.conv1d(inputs, tf.consta
我试着用TensorFlow构建了一个相当特殊的网络,我差不多成功了。不幸的是,我偶然发现了一个错误,我无法修复这个错误,甚至无法找到正确的开始位置。据我所知,在定义损失函数之前,网络是成功建立的。然后,错误消息会指出一些不兼容的形状:
ValueError: Shapes (1, 17, 17, 44) and (1, 16, 16, 44) are not compatible
问题是,错误并没有说明问题发生在哪一个张量或哪行代码上。我已经打印了我能想到的所有形状,但我甚至找不到任何形状的东西(1,17,17,44)。
from tensorflow.python.framework im
我正在从Keras模型创建一个Tensorflow Estimator。目前,估计器被创建,模型被训练,模型被评估没有问题。然而,在最后一次评估中,由于我使用了FinalExporter接口,模型被导出,并且我得到了一个尺寸不匹配错误: INFO:tensorflow:Performing the final export in the end of training.
INFO:tensorflow:Calling model_fn.
Traceback (most recent call last):
File "/home/austinguo/.../lib/python3
我是Tensorflow的新手,我尝试使用tensorflow对图像(大小为12x22)进行文本识别。训练模型似乎还可以,但当预测时,就会有错误:
File "C:\Python\Python36\lib\site-packages\tensorflow\python\keras\engine\training_utils.py", line 316, in standardize_input_data
'with shape ' + str(data_shape))
ValueError: Error when checking input: ex
我试图通过示例来学习Keras,并在Kaggle上找到了这段代码。我如何通过TensorFlow后端在Keras上实现这个功能?
mona@pascal:~/computer_vision/kaggle_distracted_driver$ python run_keras_simple.py
/usr/local/lib/python2.7/dist-packages/sklearn/cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the m
我正在尝试创建一个tensorflow文本多类分类模型。我主要是从这里复制代码:
在tensorflow中,一切看起来都很好,但是当我试图将保存h5模型转换为Tensorflow Lite时,我得到了以下错误:
ValueError: None is only supported in the 1st dimension. Tensor 'embedding_input' has invalid shape '[None, None]'.
这就是我的代码的样子:
vocab_size = 15000 # of words in dictionary
model