从序列化的小批量中反序列化并连接 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。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
