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


Python gen_array_ops._split方法代码示例

本文整理汇总了Python中tensorflow.python.ops.gen_array_ops._split方法的典型用法代码示例。如果您正苦于以下问题:Python gen_array_ops._split方法的具体用法?Python gen_array_ops._split怎么用?Python gen_array_ops._split使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tensorflow.python.ops.gen_array_ops的用法示例。


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

示例1: split

# 需要导入模块: from tensorflow.python.ops import gen_array_ops [as 别名]
# 或者: from tensorflow.python.ops.gen_array_ops import _split [as 别名]
def split(split_dim, num_split, value, name="split"):
  """Splits a tensor into `num_split` tensors along one dimension.

  Splits `value` along dimension `split_dim` into `num_split` smaller tensors.
  Requires that `num_split` evenly divide `value.shape[split_dim]`.

  For example:

  ```python
  # 'value' is a tensor with shape [5, 30]
  # Split 'value' into 3 tensors along dimension 1
  split0, split1, split2 = tf.split(1, 3, value)
  tf.shape(split0) ==> [5, 10]
  ```

  Note: If you are splitting along an axis by the length of that axis, consider
  using unpack, e.g.

  ```python
  num_items = t.get_shape()[axis].value
  [tf.squeeze(s, [axis]) for s in tf.split(axis, num_items, t)]
  ```

  can be rewritten as

  ```python
  tf.unpack(t, axis=axis)
  ```

  Args:
    split_dim: A 0-D `int32` `Tensor`. The dimension along which to split.
      Must be in the range `[0, rank(value))`.
    num_split: A Python integer. The number of ways to split.
    value: The `Tensor` to split.
    name: A name for the operation (optional).

  Returns:
    `num_split` `Tensor` objects resulting from splitting `value`.
  """
  return gen_array_ops._split(split_dim=split_dim,
                              num_split=num_split,
                              value=value,
                              name=name) 
开发者ID:tobegit3hub,项目名称:deep_image_model,代码行数:45,代码来源:array_ops.py


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