本文整理汇总了Python中tensorflow.contrib.tfprof.model_analyzer.TRAINABLE_VARS_PARAMS_STAT_OPTIONS属性的典型用法代码示例。如果您正苦于以下问题:Python model_analyzer.TRAINABLE_VARS_PARAMS_STAT_OPTIONS属性的具体用法?Python model_analyzer.TRAINABLE_VARS_PARAMS_STAT_OPTIONS怎么用?Python model_analyzer.TRAINABLE_VARS_PARAMS_STAT_OPTIONS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类tensorflow.contrib.tfprof.model_analyzer
的用法示例。
在下文中一共展示了model_analyzer.TRAINABLE_VARS_PARAMS_STAT_OPTIONS属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_model_size_less_then1_gb
# 需要导入模块: from tensorflow.contrib.tfprof import model_analyzer [as 别名]
# 或者: from tensorflow.contrib.tfprof.model_analyzer import TRAINABLE_VARS_PARAMS_STAT_OPTIONS [as 别名]
def test_model_size_less_then1_gb(self):
# NOTE: Actual amount of memory occupied my TF during training will be at
# least 4X times bigger because of space need to store original weights,
# updates, gradients and variances. It also depends on the type of used
# optimizer.
ocr_model = self.create_model()
ocr_model.create_base(images=self.fake_images, labels_one_hot=None)
with self.test_session() as sess:
tfprof_root = model_analyzer.print_model_analysis(
sess.graph,
tfprof_options=model_analyzer.TRAINABLE_VARS_PARAMS_STAT_OPTIONS)
model_size_bytes = 4 * tfprof_root.total_parameters
self.assertLess(model_size_bytes, 1 * 2**30)
示例2: calculate_graph_metrics
# 需要导入模块: from tensorflow.contrib.tfprof import model_analyzer [as 别名]
# 或者: from tensorflow.contrib.tfprof.model_analyzer import TRAINABLE_VARS_PARAMS_STAT_OPTIONS [as 别名]
def calculate_graph_metrics():
param_stats = model_analyzer.print_model_analysis(
tf.get_default_graph(),
tfprof_options=model_analyzer.TRAINABLE_VARS_PARAMS_STAT_OPTIONS)
return param_stats.total_parameters