本文整理匯總了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)