斷言條件 x > 0 保持元素。
用法
tf.compat.v1.assert_positive(
x, data=None, summarize=None, message=None, name=None
)參數
-
x數字Tensor。 -
data如果條件為 False,則打印出的張量。默認為錯誤消息和x的前幾個條目。 -
summarize打印每個張量的這麽多條目。 -
message默認消息的前綴字符串。 -
name此操作的名稱(可選)。默認為"assert_positive"。
返回
-
如果
x > 0為 False,則引發InvalidArgumentError的操作。
拋出
-
InvalidArgumentError如果可以立即執行檢查並且x > 0為 False。檢查可以在即刻執行期間立即執行,或者如果x是靜態已知的。
在圖形模式下運行時,您應該添加對此操作的依賴以確保它運行。將依賴項添加到操作的示例:
with tf.control_dependencies([tf.debugging.assert_positive(x, y)]):
output = tf.reduce_sum(x)
積極的意思是,對於 x 的每個元素 x[i] ,我們有 x[i] > 0 。如果x 為空,這很容易滿足。
eager模式兼容性
返回None。
相關用法
- 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_rank_at_least用法及代碼示例
- Python tf.compat.v1.assert_less用法及代碼示例
- Python tf.compat.v1.assert_rank_in用法及代碼示例
- Python tf.compat.v1.assert_greater_equal用法及代碼示例
- Python tf.compat.v1.assert_rank用法及代碼示例
- 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_positive。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
