• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python graph_util.tensor_shape_from_node_def_name函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tensorflow.python.client.graph_util.tensor_shape_from_node_def_name函数的典型用法代码示例。如果您正苦于以下问题:Python tensor_shape_from_node_def_name函数的具体用法?Python tensor_shape_from_node_def_name怎么用?Python tensor_shape_from_node_def_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了tensor_shape_from_node_def_name函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _calc_depthwise_conv_flops

def _calc_depthwise_conv_flops(graph, node):
  """Calculates the compute resources needed for DepthwiseConv2dNative."""
  input_shape = graph_util.tensor_shape_from_node_def_name(graph, node.input[0])
  input_shape.assert_is_fully_defined()
  filter_shape = graph_util.tensor_shape_from_node_def_name(graph,
                                                            node.input[1])
  filter_shape.assert_is_fully_defined()
  output_shape = graph_util.tensor_shape_from_node_def_name(graph, node.name)
  output_shape.assert_is_fully_defined()
  filter_height = int(filter_shape[0])
  filter_width = int(filter_shape[1])
  output_count = np.prod(output_shape.as_list())
  return ops.OpStats("flops", (output_count * filter_height * filter_width * 2))
开发者ID:ThomasWollmann,项目名称:tensorflow,代码行数:13,代码来源:nn_ops.py


示例2: _calc_mat_mul_flops

def _calc_mat_mul_flops(graph, node):
  """Calculates the compute resources needed for MatMul."""
  transpose_a = node.attr["transpose_a"].b
  a_shape = graph_util.tensor_shape_from_node_def_name(graph, node.input[0])
  a_shape.assert_is_fully_defined()
  if transpose_a:
    k = int(a_shape[0])
  else:
    k = int(a_shape[1])
  output_shape = graph_util.tensor_shape_from_node_def_name(graph, node.name)
  output_shape.assert_is_fully_defined()
  output_count = np.prod(output_shape.as_list())
  return ops.OpStats("flops", (k * output_count * 2))
开发者ID:13331151,项目名称:tensorflow,代码行数:13,代码来源:math_ops.py


示例3: _calc_conv_weight_params

def _calc_conv_weight_params(graph, node):
    """Calculates the on-disk size of the weights for Conv2D."""
    input_shape = graph_util.tensor_shape_from_node_def_name(graph, node.input[0])
    input_shape.assert_is_fully_defined()
    filter_shape = graph_util.tensor_shape_from_node_def_name(graph, node.input[1])
    filter_shape.assert_is_fully_defined()
    output_shape = graph_util.tensor_shape_from_node_def_name(graph, node.name)
    output_shape.assert_is_fully_defined()
    filter_height = int(filter_shape[0])
    filter_width = int(filter_shape[1])
    filter_in_depth = int(filter_shape[2])
    filter_out_depth = int(filter_shape[3])
    return ops.OpStats("weight_parameters", (filter_height * filter_width * filter_in_depth * filter_out_depth))
开发者ID:surround-io,项目名称:tensorflow,代码行数:13,代码来源:nn_ops.py


示例4: _calc_mat_mul_weight_parameters

def _calc_mat_mul_weight_parameters(graph, node):
    """Calculates the on-disk size of the weights for MatMul."""
    # We assume here that the weights are always in the second input to the op,
    # which is generally true by convention for fully-connected layers, but not
    # enforced or checked.
    weights_shape = graph_util.tensor_shape_from_node_def_name(graph, node.input[1])
    weights_shape.assert_is_fully_defined()
    return ops.OpStats("weight_parameters", (int(weights_shape[1]) * int(weights_shape[0])))
开发者ID:sambrego,项目名称:tensorflow,代码行数:8,代码来源:math_ops.py


示例5: _calc_dilation2d_weight_params

def _calc_dilation2d_weight_params(graph, node):
  """Calculates the on-disk size of the weights for Dilation2D."""
  filter_shape = graph_util.tensor_shape_from_node_def_name(graph,
                                                            node.input[1])
  filter_shape.assert_is_fully_defined()
  filter_height = int(filter_shape[0])
  filter_width = int(filter_shape[1])
  filter_depth = int(filter_shape[2])
  return ops.OpStats("weight_parameters",
                     (filter_height * filter_width * filter_depth))
开发者ID:AngleFork,项目名称:tensorflow,代码行数:10,代码来源:nn_ops.py


示例6: _calc_bias_add_weight_params

def _calc_bias_add_weight_params(graph, node):
  """Calculates the on-disk weight parameters for BiasAdd."""
  bias_shape = graph_util.tensor_shape_from_node_def_name(graph, node.input[1])
  bias_shape.assert_is_fully_defined()
  bias_count = np.prod(bias_shape.as_list())
  return ops.OpStats("weight_parameters", bias_count)
开发者ID:ThomasWollmann,项目名称:tensorflow,代码行数:6,代码来源:nn_ops.py


示例7: _calc_bias_add_flops

def _calc_bias_add_flops(graph, node):
  """Calculates the computing needed for BiasAdd."""
  input_shape = graph_util.tensor_shape_from_node_def_name(graph, node.input[0])
  input_shape.assert_is_fully_defined()
  input_count = np.prod(input_shape.as_list())
  return ops.OpStats("flops", input_count)
开发者ID:ThomasWollmann,项目名称:tensorflow,代码行数:6,代码来源:nn_ops.py



注:本文中的tensorflow.python.client.graph_util.tensor_shape_from_node_def_name函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python compat.forward_compatibility_horizon函数代码示例发布时间:2022-05-27
下一篇:
Python device_lib.list_local_devices函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap