注銷使用 @dispatch_for_* 注冊的函數。
用法
tf.experimental.unregister_dispatch_for(
dispatch_target
)參數
-
dispatch_target注銷的函數。
拋出
-
ValueError如果dispatch_target未使用@dispatch_for,@dispatch_for_unary_elementwise_apis或@dispatch_for_binary_elementwise_apis注冊。
這主要用於測試目的。
例子:
# Define a type and register a dispatcher to override `tf.abs`:
class MyTensor(tf.experimental.ExtensionType):
value:tf.Tensor
@dispatch_for_api(tf.abs)
def my_abs(x:MyTensor):
return MyTensor(tf.abs(x.value))
tf.abs(MyTensor(5))
MyTensor(value=<tf.Tensor:shape=(), dtype=int32, numpy=5>)
# Unregister the dispatcher, so `tf.abs` no longer calls `my_abs`.
unregister_dispatch_for(my_abs)
tf.abs(MyTensor(5))
Traceback (most recent call last):
ValueError:Attempt to convert a value ... to a Tensor.
相關用法
- Python tf.experimental.dlpack.from_dlpack用法及代碼示例
- Python tf.experimental.numpy.iinfo用法及代碼示例
- Python tf.experimental.Optional.has_value用法及代碼示例
- Python tf.experimental.dispatch_for_unary_elementwise_apis用法及代碼示例
- Python tf.experimental.dispatch_for_api用法及代碼示例
- Python tf.experimental.tensorrt.Converter用法及代碼示例
- Python tf.experimental.ExtensionType用法及代碼示例
- Python tf.experimental.Optional.get_value用法及代碼示例
- Python tf.experimental.numpy.issubdtype用法及代碼示例
- Python tf.experimental.numpy.unicode_用法及代碼示例
- Python tf.experimental.dlpack.to_dlpack用法及代碼示例
- Python tf.experimental.async_scope用法及代碼示例
- Python tf.experimental.Optional.empty用法及代碼示例
- Python tf.experimental.numpy.float16.as_integer_ratio用法及代碼示例
- Python tf.experimental.numpy.float64.as_integer_ratio用法及代碼示例
- Python tf.experimental.dispatch_for_binary_elementwise_apis用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.experimental.unregister_dispatch_for。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
