在mask rcnn中训练自己的数据集到时候遇到
if dtype is None:
dtype = floatx()
tf_dtype = _convert_string_dtype(dtype)
return variable(tf.constant_initializer(0., dtype=tf_dtype)(shape),
dtype, name)
这该怎么改啊?
不知道你这个问题是否已经解决, 如果还没有解决的话:生成一个初始值全为1的tensor对象
该回答通过自己思路及引用到GPTᴼᴾᴱᴺᴬᴵ搜索,得到内容具体如下:
这个警告是因为 TensorFlow 2.x 中 tf.Variable 的构造函数中不再支持 dtype 参数。正确的方式是在传递张量时指定数据类型,或者在构造函数中使用 dtype 参数进行初始化。如果你的代码中使用了过期的 dtype 参数,可以将其替换为 tf.dtypes.as_dtype() 函数,如下所示:
if dtype is None:
dtype = floatx()
tf_dtype = tf.dtypes.as_dtype(dtype)
return variable(tf.constant_initializer(0., dtype=tf_dtype)(shape),
dtype=tf_dtype, name=name)
这样就可以避免这个警告了。但是在修改代码之前,建议先了解 TensorFlow 2.x 中 tf.Variable 的使用方式和最佳实践。
如果以上回答对您有所帮助,点击一下采纳该答案~谢谢