用默认值填充输入 2-D SparseTensor 中的空行。
用法
tf.sparse.fill_empty_rows(
sp_input, default_value, name=None
)参数
-
sp_input形状为[N, M]的SparseTensor。 -
default_value为空行填充的值,类型与sp_input.相同 -
name返回张量的名称前缀(可选)
返回
-
sp_ordered_output形状为[N, M]的SparseTensor,所有空行都用default_value填充。 -
empty_row_indicator一个长度为N的布尔向量,指示每个输入行是否为空。
抛出
-
TypeError如果sp_input不是SparseTensor。
此操作在索引 [row, 0] 处为输入中尚无值的任何行添加具有指定 default_value 的条目。
例如,假设 sp_input 具有形状 [5, 6] 和非空值:
[0, 1]:a
[0, 3]:b
[2, 0]:c
[3, 1]:d
第 1 行和第 4 行为空,因此输出的形状为 [5, 6],其值:
[0, 1]:a
[0, 3]:b
[1, 0]:default_value
[2, 0]:c
[3, 1]:d
[4, 0]:default_value
请注意,输入末尾可能有空列,对此操作没有影响。
输出 SparseTensor 将按行优先顺序排列,并具有与输入相同的形状。
此操作还返回一个指示向量,使得
empty_row_indicator[i] = True iff row i was an empty row.
相关用法
- Python tf.sparse.from_dense用法及代码示例
- Python tf.sparse.cross用法及代码示例
- Python tf.sparse.mask用法及代码示例
- Python tf.sparse.split用法及代码示例
- Python tf.sparse.to_dense用法及代码示例
- Python tf.sparse.expand_dims用法及代码示例
- Python tf.sparse.maximum用法及代码示例
- Python tf.sparse.bincount用法及代码示例
- Python tf.sparse.concat用法及代码示例
- Python tf.sparse.transpose用法及代码示例
- Python tf.sparse.reduce_sum用法及代码示例
- Python tf.sparse.softmax用法及代码示例
- Python tf.sparse.to_indicator用法及代码示例
- Python tf.sparse.retain用法及代码示例
- Python tf.sparse.minimum用法及代码示例
- Python tf.sparse.segment_sum用法及代码示例
- Python tf.sparse.reduce_max用法及代码示例
- Python tf.sparse.slice用法及代码示例
- Python tf.sparse.cross_hashed用法及代码示例
- Python tf.sparse.reorder用法及代码示例
注:本文由纯净天空筛选整理自tensorflow.org大神的英文原创作品 tf.sparse.fill_empty_rows。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
