当前位置: 首页>>代码示例>>Python>>正文


Python graph_util.tensor_shape_from_node_def_name函数代码示例

本文整理汇总了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;未经允许,请勿转载。