Questions tagged «tf.keras»

4
警告:tensorflow:sample_weight模式从…强制为['…']
使用.fit_generator()或.fit()将字典传递class_weight=为参数来训练图像分类器。 我从未在TF1.x中遇到错误,但在2.1中,开始训练时得到以下输出: WARNING:tensorflow:sample_weight modes were coerced from ... to ['...'] 强制从...到['...']到底意味着什么? tensorflow的回购中此警告的来源在此处,注释为: 尝试将sample_weight_modes强制转换为目标结构。这隐含地依赖于模型展平其内部表示的输出这一事实。

2
自定义TensorFlow Keras优化器
假设我想编写一个符合tf.kerasAPI 的自定义优化器类(使用TensorFlow版本> = 2.0)。我对文档记录的执行方式与实现中的执行方式感到困惑。 有关tf.keras.optimizers.Optimizer 状态的文档, ### Write a customized optimizer. If you intend to create your own optimization algorithm, simply inherit from this class and override the following methods: - resource_apply_dense (update variable given gradient tensor is dense) - resource_apply_sparse (update variable given gradient tensor is sparse) - create_slots …

1
每10个时间段tensorflow.keras v2保存模型
我正在使用在tensorflow v2中定义为子模块的keras。我正在使用fit_generator()方法训练模型。我想每10个时间保存一次模型。我该如何实现? 在Keras(不是tf的子模块)中,我可以给出ModelCheckpoint(model_savepath,period=10)。但在TF V2,他们已经改变了这ModelCheckpoint(model_savepath, save_freq)地方save_freq可'epoch'在这种情况下,模型保存每个时间段。如果save_freq为整数,则在处理了许多样本后将保存模型。但我希望在10个时代之后。我该如何实现?

6
不支持TensorFlow 2.0的Keras。我们建议使用`tf.keras`,或降级为TensorFlow 1.14
我有一个关于tf.keras任何建议的错误(不支持TensorFlow 2.0的Keras。我们建议使用或将其降级为TensorFlow 1.14。)。 谢谢 import keras #For building the Neural Network layer by layer from keras.models import Sequential #To randomly initialize the weights to small numbers close to 0(But not 0) from keras.layers import Dense classifier=tf.keras.Sequential() classifier.add(Dense(output_dim = 6, init = 'uniform', activation = 'relu', input_dim = 11)) RuntimeError: It …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.