從序列化的小批量中反序列化並連接 SparseTensors。
用法
tf.io.deserialize_many_sparse(
serialized_sparse, dtype, rank=None, name=None
)參數
-
serialized_sparse2-DTensor類型string形狀[N, 3]。序列化和打包的SparseTensor對象。 -
dtype序列化的SparseTensor對象的dtype。 -
rank(可選)Python int,SparseTensor對象的等級。 -
name返回張量的名稱前綴(可選)
返回
-
A
SparseTensor代表反序列化的SparseTensors,沿SparseTensors 的第一維。所有序列化的
SparseTensor必須具有相同的等級和類型。
輸入 serialized_sparse 必須是形狀為 [N x 3] 的字符串矩陣,其中 N 是小批量大小,行對應於 serialize_sparse 的打包輸出。原始SparseTensor 對象的等級必須全部匹配。創建最終的SparseTensor 時,它的排名比傳入的SparseTensor 對象的排名高一級(它們已沿新的行維度連接)。
輸出SparseTensor 對象的所有維度的形狀值,但第一個是輸入SparseTensor 對象對應維度的形狀值的最大值。它的第一個形狀值是 N ,即小批量大小。
假設輸入SparseTensor 對象的索引按標準字典順序排序。如果不是這種情況,則在此步驟之後運行sparse.reorder 以恢複索引順序。
例如,如果序列化輸入是一個 [2, 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.io.decode_json_example用法及代碼示例
- Python tf.io.decode_gif用法及代碼示例
- Python tf.io.decode_raw用法及代碼示例
- Python tf.io.decode_proto用法及代碼示例
- Python tf.io.gfile.GFile.close用法及代碼示例
- Python tf.io.gfile.join用法及代碼示例
- Python tf.io.parse_example用法及代碼示例
- Python tf.io.gfile.exists用法及代碼示例
- Python tf.io.serialize_tensor用法及代碼示例
- Python tf.io.gfile.GFile用法及代碼示例
- Python tf.io.SparseFeature用法及代碼示例
- Python tf.io.gfile.copy用法及代碼示例
- Python tf.io.gfile.glob用法及代碼示例
- Python tf.io.TFRecordWriter用法及代碼示例
- Python tf.io.RaggedFeature用法及代碼示例
- Python tf.io.read_file用法及代碼示例
- Python tf.io.write_graph用法及代碼示例
- Python tf.io.TFRecordOptions.get_compression_type_string用法及代碼示例
- Python tf.image.random_brightness用法及代碼示例
- Python tf.image.pad_to_bounding_box用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.io.deserialize_many_sparse。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
