
TensorFlow2.0
仁义礼智信达
喜欢学习和分享
展开
-
Module: tf.summary用法
Module: tf.summary:用于编写摘要数据的操作,用于分析和可视化。该tf.summary模块提供用于编写摘要数据的API。可以在TensorBoard(TensorFlow随附的可视化工具包)中可视化此数据。急切执行的示例用法,TF 2.0中的默认用法:writer = tf.summary.create_file_writer("/tmp/mylogs")with writer.as_default(): for step in range(100): # o原创 2020-08-28 16:02:34 · 2298 阅读 · 0 评论 -
tf.compat.v1.summary.merge_all()用法
tf.compat.v1.summary.merge_all():合并默认图中收集的所有摘要。tf.compat.v1.summary.merge_all( key=tf.GraphKeys.SUMMARIES, scope=None, name=None)Args:key:GraphKey用于收集摘要。默认为GraphKeys.SUMMARIESscope:用于筛选摘要操作的可选范围,使用re.matchReturns:如果未收集任何摘要,则返回无。否则,返回Ten..原创 2020-08-28 11:02:42 · 2454 阅读 · 10 评论 -
tf.summary.scalar用法
tf.summary.scalar:写一个标量摘要。tf.summary.scalar( name, data, step=None, description=None)Arguments:name:此摘要的名称。用于TensorBoard的summary标记将是此名称的任何活动名称范围的前缀。data:实数标量值,可转换为float32张量。step:此摘要的显式int64可广播单调阶跃值。如果省略,则默认为tf.summary.experimental.get_step(原创 2020-08-28 10:50:59 · 1459 阅读 · 0 评论 -
tf.name_scope用法
tf.name_scope:用于定义Python op的上下文管理器。tf.name_scope( name)此上下文管理器将推送名称范围,这将使在其中添加的所有操作的名称带有前缀。例如,定义一个新的Python opmy_op:def my_op(a, b, c, name=None): with tf.name_scope("MyOp") as scope: a = tf.convert_to_tensor(a, name="a") b = tf.co.原创 2020-08-28 09:57:33 · 7601 阅读 · 2 评论 -
tf.estimator用法
estimator:估算器tf.estimator-----一种高级TensorFlow API。估算器封装以下操作:训练 评价 预测 出口服务可以使用其提供的预制估算器(pre-made Estimators),也可以编写自己的自定义估算器(custom Estimators)。所有Estimators(无论是预制的还是自定义的)都是基于tf.estimator.Estimator类的类。估算器功能估算器具有以下优点:开发者可以在本地主机或分布式多服务器环境上运行基于Esti.原创 2020-08-27 10:06:48 · 1419 阅读 · 0 评论 -
tf.compat.v1.placeholder用法
目的:为将始终馈入的张量插入占位符。tf.compat.v1.placeholder( dtype, shape=None, name=None)关键点:如果评估,该张量将产生错误。 它的值必须使用feed_dict可选参数馈入到Session.run(),Tensor.eval()或Operation.run()。示例程序:x = tf.compat.v1.placeholder(tf.float32, shape=(1024, 1024))y = tf.matmul(x,原创 2020-08-26 16:57:58 · 6579 阅读 · 0 评论 -
TensorFlow2.0常见问题解决
AttributeError: module 'tensorflow_core.compat.v1' has no attribute 'contrib'lstm_cell = tf.contrib.rnn.core_rnn_cell.BasicLSTMCell(lstm_size)#报错解决方法:lstm_cell =tf.nn.rnn_cell.BasicLSTMCel...原创 2020-04-23 12:48:18 · 1487 阅读 · 1 评论