用法
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 編碼array
s。在以下示例中,返回的值由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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。