用法
numpy()返回
一个numpy array。 |
返回一个 numpyarray用这个值RaggedTensor。
要求这RaggedTensor是在即刻执行模式下构建的。
参差不齐的维度使用 numpy 进行编码arrays和dtype=object和rank=1,其中每个元素是单行。
例子
在以下示例中,返回的值由RaggedTensor.numpy()包含三个 numpyarray对象:每行一个(带有rank=1和dtype=int64), 和一个将它们组合起来 (withrank=1和dtype=object):
tf.ragged.constant([[1, 2, 3], [4, 5]], dtype=tf.int64).numpy()
array([array([1, 2, 3]), array([4, 5])], dtype=object)
统一维度使用多维 numpy 编码arrays。在以下示例中,返回的值由RaggedTensor.numpy()包含一个 numpyarray对象,与rank=2和dtype=int64:
tf.ragged.constant([[1, 2, 3], [4, 5, 6]], dtype=tf.int64).numpy()
array([[1, 2, 3], [4, 5, 6]])
相关用法
- Python tf.RaggedTensor.numpy用法及代码示例
- Python tf.RaggedTensor.nested_value_rowids用法及代码示例
- Python tf.RaggedTensor.nrows用法及代码示例
- Python tf.RaggedTensor.row_lengths用法及代码示例
- Python tf.RaggedTensor.__rmul__用法及代码示例
- Python tf.RaggedTensor.from_uniform_row_length用法及代码示例
- Python tf.RaggedTensor.__radd__用法及代码示例
- Python tf.RaggedTensor.__pow__用法及代码示例
- Python tf.RaggedTensor.__rand__用法及代码示例
- Python tf.RaggedTensor.get_shape用法及代码示例
- Python tf.RaggedTensor.__xor__用法及代码示例
- Python tf.RaggedTensor.__gt__用法及代码示例
- Python tf.RaggedTensor.__getitem__用法及代码示例
- Python tf.RaggedTensor.__rpow__用法及代码示例
- Python tf.RaggedTensor.row_limits用法及代码示例
- Python tf.RaggedTensor.__rxor__用法及代码示例
- Python tf.RaggedTensor.from_value_rowids用法及代码示例
- Python tf.RaggedTensor.from_nested_row_lengths用法及代码示例
- Python tf.RaggedTensor.to_tensor用法及代码示例
- Python tf.RaggedTensor.__ror__用法及代码示例
注:本文由纯净天空筛选整理自tensorflow.org大神的英文原创作品 tf.RaggedTensor.numpy。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
