反序列化 SparseTensor
對象。
用法
tf.raw_ops.DeserializeSparse(
serialized_sparse, dtype, name=None
)
參數
-
serialized_sparse
一個Tensor
。必須是以下類型之一:string
,variant
。序列化的SparseTensor
對象。最後一個維度必須有 3 列。 -
dtype
一個tf.DType
。序列化的SparseTensor
對象的dtype
。 -
name
操作的名稱(可選)。
返回
-
Tensor
對象的元組(sparse_indices、sparse_values、sparse_shape)。 -
sparse_indices
Tensor
類型為int64
。 -
sparse_values
Tensor
類型為dtype
。 -
sparse_shape
Tensor
類型為int64
。
輸入 serialized_sparse
的形狀必須為 [?, ?, ..., ?, 3]
,其中最後一個維度存儲序列化的 SparseTensor
對象,其他 N 個維度 (N >= 0) 對應於一個批次。原始SparseTensor
對象的等級必須全部匹配。當最後的SparseTensor
被創建時,它的rank是傳入的SparseTensor
對象的rank加上N;稀疏張量已沿新維度連接,每批一個。
原始尺寸的輸出SparseTensor
對象的形狀值是對應尺寸的輸入SparseTensor
對象的形狀值的最大值。新尺寸與批次的大小相匹配。
假設輸入SparseTensor
對象的索引按標準字典順序排序。如果不是這種情況,則在此步驟之後運行SparseReorder
以恢複索引順序。
例如,如果序列化輸入是一個 [2 x 3]
矩陣,表示兩個原始 SparseTensor
對象:
index = [ 0]
[10]
[20]
values = [1, 2, 3]
shape = [50]
和
index = [ 2]
[10]
values = [4, 5]
shape = [30]
那麽最終反序列化的SparseTensor
將是:
index = [0 0]
[0 10]
[0 20]
[1 2]
[1 10]
values = [1, 2, 3, 4, 5]
shape = [2 50]
相關用法
- Python tf.raw_ops.DeserializeManySparse用法及代碼示例
- Python tf.raw_ops.DecodeGif用法及代碼示例
- Python tf.raw_ops.DepthToSpace用法及代碼示例
- Python tf.raw_ops.DepthwiseConv2dNative用法及代碼示例
- Python tf.raw_ops.Dequantize用法及代碼示例
- Python tf.raw_ops.DecodeProtoV2用法及代碼示例
- Python tf.raw_ops.Dilation2D用法及代碼示例
- Python tf.raw_ops.DynamicPartition用法及代碼示例
- Python tf.raw_ops.DataFormatVecPermute用法及代碼示例
- Python tf.raw_ops.DiagPart用法及代碼示例
- Python tf.raw_ops.Diag用法及代碼示例
- Python tf.raw_ops.DynamicStitch用法及代碼示例
- Python tf.raw_ops.TPUReplicatedInput用法及代碼示例
- Python tf.raw_ops.Bitcast用法及代碼示例
- Python tf.raw_ops.SelfAdjointEigV2用法及代碼示例
- Python tf.raw_ops.BatchMatMul用法及代碼示例
- Python tf.raw_ops.OneHot用法及代碼示例
- Python tf.raw_ops.ResourceScatterNdSub用法及代碼示例
- Python tf.raw_ops.ReadVariableXlaSplitND用法及代碼示例
- Python tf.raw_ops.GatherV2用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.raw_ops.DeserializeSparse。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。