将稀疏表示转换为密集张量。 (已弃用)
用法
tf.compat.v1.sparse_to_dense(
sparse_indices, output_shape, sparse_values, default_value=0,
validate_indices=True, name=None
)参数
-
sparse_indicesint32或int64类型的 0-D、1-D 或 2-DTensor。sparse_indices[i]包含将放置sparse_values[i]的完整索引。 -
output_shape与sparse_indices类型相同的一维Tensor。密集输出张量的形状。 -
sparse_values0-D 或 1-DTensor。与sparse_indices的每一行对应的值,或用于所有稀疏索引的标量值。 -
default_value与sparse_values类型相同的 0-DTensor。为sparse_indices中未指定的索引设置的值。默认为零。 -
validate_indices一个布尔值。如果为 True,则检查索引以确保它们按字典顺序排序并且没有重复。 -
name操作的名称(可选)。
返回
-
密集的
Tensor形状output_shape。具有与sparse_values相同的类型。
警告:此函数已弃用。它将在未来的版本中删除。更新说明:创建 tf.sparse.SparseTensor 并改用 tf.sparse.to_dense。
构建一个形状为 output_shape 的数组 dense,使得
# If sparse_indices is scalar
dense[i] = (i == sparse_indices ? sparse_values:default_value)
# If sparse_indices is a vector, then for each i
dense[sparse_indices[i]] = sparse_values[i]
# If sparse_indices is an n by d matrix, then for each i in [0, n)
dense[sparse_indices[i][0], ..., sparse_indices[i][d-1]] = sparse_values[i]
dense 中的所有其他值都设置为 default_value 。如果sparse_values 是标量,则所有稀疏索引都设置为此单个值。
索引应按字典顺序排序,索引不得包含任何重复。如果 validate_indices 为 True,则在执行期间检查这些属性。
相关用法
- Python tf.compat.v1.sparse_segment_sum用法及代码示例
- Python tf.compat.v1.sparse_split用法及代码示例
- Python tf.compat.v1.sparse_reduce_max用法及代码示例
- Python tf.compat.v1.sparse_merge用法及代码示例
- Python tf.compat.v1.sparse_concat用法及代码示例
- Python tf.compat.v1.sparse_placeholder用法及代码示例
- Python tf.compat.v1.sparse_add用法及代码示例
- Python tf.compat.v1.sparse_reduce_sum用法及代码示例
- Python tf.compat.v1.space_to_batch用法及代码示例
- Python tf.compat.v1.space_to_depth用法及代码示例
- Python tf.compat.v1.strings.length用法及代码示例
- Python tf.compat.v1.scatter_min用法及代码示例
- Python tf.compat.v1.summary.merge用法及代码示例
- Python tf.compat.v1.size用法及代码示例
- Python tf.compat.v1.scatter_add用法及代码示例
- Python tf.compat.v1.summary.FileWriter用法及代码示例
- Python tf.compat.v1.scatter_div用法及代码示例
- Python tf.compat.v1.string_split用法及代码示例
- Python tf.compat.v1.squeeze用法及代码示例
- Python tf.compat.v1.set_random_seed用法及代码示例
注:本文由纯净天空筛选整理自tensorflow.org大神的英文原创作品 tf.compat.v1.sparse_to_dense。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
