10得票1回答
TF2 / Keras使用 [:, :, 0] 切片张量

在 TF 2.0 Beta 中,我正在尝试:x = tf.keras.layers.Input(shape=(240, 2), dtype=tf.float32) print(x.shape) # (None, 240, 2) a = x[:, :, 0] print(a.shape) # &...

23得票3回答
TF2.0:翻译模型:恢复保存的模型时出错:检查点(root)中存在未解决的对象.optimizer.iter: 属性。

我正在尝试恢复检查点并在不同的句子NMT Attention Model上进行预测。在恢复检查点和预测时,我会得到下面的警告信息以及一些无意义的结果: Unresolved object in checkpoint (root).optimizer.iter: attributes {...

12得票2回答
加载自定义层的模型时出现TypeError: __init__() got an unexpected keyword argument 'name'错误

我在Keras中制作了一个自定义图层,用于在馈送到ConvLSTM2D层之前重新整形CNN的输出class TemporalReshape(Layer): def __init__(self,batch_size,num_patches): super(Temporal...

11得票3回答
tensorflow/stream_executor/cuda/cuda_driver.cc:328] 调用 cuInit 失败:CUDA_ERROR_UNKNOWN:未知错误

我正在尝试在Tensorflow中使用GPU。我的Tensorflow版本是2.4.1,我正在使用Cuda版本11.2。这是nvidia-smi的输出。+----------------------------------------------------------------------...

11得票1回答
模块未找到错误:没有名为“tensorflow_hub”的模块。

我按照TensorFlow网站上的说明安装了tensorflow_hub,并在conda环境中完成了安装。$ pip install "tensorflow>=2.0.0" $ pip install --upgrade tensorflow-hub 我在anacon...

9得票4回答
将Tensorflow2中的图冻结为pb文件

我们通过图形冻结将许多TF1模型部署: tf.train.write_graph(self.session.graph_def, some_path) # get graph definitions with weights output_graph_def = tf.graph_util...

19得票2回答
Keras预测时间不一致

我试图估计我的Keras模型的预测时间,并意识到了一些奇怪的事情。除了通常相当快之外,有时该模型需要相当长的时间才能进行预测。而且不仅如此,这些时间也会随着模型运行的时间越来越长而增加。我添加了一个最小的工作示例来重现错误。import time import numpy as np from...

11得票5回答
当conda还不支持最新的Tensorflow(这里是2.2版本)时,我该如何在Windows上安装最新的Tensorflow?

我的Windows 8.1上已经安装了conda 4.8.3和Python 3.7.4。我在一个conda环境中安装了tf 2.0.0。如何升级到2.2.x版本? 或者,如何在conda环境中仅安装2.2.x版本? 编辑1:使用pip install --upgrade tensorflow命...

9得票5回答
断言错误:尝试导出引用未被跟踪的资源的函数。

我写了一个单元测试,以确保在训练过程中无法保存模型时仍能够保存。 @pytest.mark.usefixtures("maybe_run_functions_eagerly") def test_save_model(speech_model: Tuple[TransducerBase, S...

11得票2回答
在tensorflow 2中导入tensorflow模块速度缓慢。

相关内容: Import TensorFlow contrib module is slow in TensorFlow 1.2.1还有: What can cause the TensorFlow import to be so slow?我正在使用 SSD 导入 TensorFlow,我的...