斷言 x
的排名等於 rank
。
用法
tf.compat.v1.assert_rank(
x, rank, data=None, summarize=None, message=None, name=None
)
參數
-
x
數字Tensor
。 -
rank
標量整數Tensor
。 -
data
如果條件為 False,則打印出的張量。默認為錯誤消息和x
的形狀。 -
summarize
打印每個張量的這麽多條目。 -
message
默認消息的前綴字符串。 -
name
此操作的名稱(可選)。默認為"assert_rank"。
返回
-
除非
x
已指定排名,否則操作會提高InvalidArgumentError
。如果靜態檢查確定x
的排名正確,則返回no_op
。
拋出
-
ValueError
如果靜態檢查確定x
排名錯誤。
將依賴項添加到操作的示例:
with tf.control_dependencies([tf.compat.v1.assert_rank(x, 2)]):
output = tf.reduce_sum(x)
相關用法
- Python tf.compat.v1.assert_rank_at_least用法及代碼示例
- Python tf.compat.v1.assert_rank_in用法及代碼示例
- Python tf.compat.v1.assert_none_equal用法及代碼示例
- Python tf.compat.v1.assert_near用法及代碼示例
- Python tf.compat.v1.assert_negative用法及代碼示例
- Python tf.compat.v1.assert_less_equal用法及代碼示例
- Python tf.compat.v1.assert_non_positive用法及代碼示例
- Python tf.compat.v1.assert_integer用法及代碼示例
- Python tf.compat.v1.assert_greater用法及代碼示例
- Python tf.compat.v1.assert_non_negative用法及代碼示例
- Python tf.compat.v1.assert_less用法及代碼示例
- Python tf.compat.v1.assert_greater_equal用法及代碼示例
- Python tf.compat.v1.assert_positive用法及代碼示例
- Python tf.compat.v1.assert_equal用法及代碼示例
- Python tf.compat.v1.assign_add用法及代碼示例
- Python tf.compat.v1.assign用法及代碼示例
- Python tf.compat.v1.assign_sub用法及代碼示例
- Python tf.compat.v1.autograph.to_graph用法及代碼示例
- Python tf.compat.v1.arg_max用法及代碼示例
- Python tf.compat.v1.arg_min用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.compat.v1.assert_rank。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。