將稀疏表示轉換為密集張量。 (已棄用)
用法
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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
