斷言 x
在 ranks
中有排名。
用法
tf.compat.v1.assert_rank_in(
x, ranks, data=None, summarize=None, message=None, name=None
)
參數
-
x
數字Tensor
。 -
ranks
標量Tensor
對象的可迭代。 -
data
如果條件為 False,則打印出的張量。默認為錯誤消息和x
的前幾個條目。 -
summarize
打印每個張量的這麽多條目。 -
message
默認消息的前綴字符串。 -
name
此操作的名稱(可選)。默認為"assert_rank_in"。
返回
-
操作提高
InvalidArgumentError
除非x
的排名在ranks
中。如果靜態檢查確定x
具有匹配的排名,則返回no_op
。
拋出
-
ValueError
如果靜態檢查確定x
排名不匹配。
將依賴項添加到操作的示例:
with tf.control_dependencies([tf.compat.v1.assert_rank_in(x, (2, 4))]):
output = tf.reduce_sum(x)
相關用法
- Python tf.compat.v1.assert_rank_at_least用法及代碼示例
- Python tf.compat.v1.assert_rank用法及代碼示例
- 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_in。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。