tf.experimental.unregister_dispatch_for
Stay organized with collections
Save and categorize content based on your preferences.
Unregisters a function that was registered with @dispatch_for_*
.
tf.experimental.unregister_dispatch_for(
dispatch_target
)
This is primarily intended for testing purposes.
Example:
# Define a type and register a dispatcher to override `tf.abs`:
class MyTensor(tf.experimental.ExtensionType):
value: tf.Tensor
@tf.experimental.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.
Args |
dispatch_target
|
The function to unregister.
|
Raises |
ValueError
|
If dispatch_target was not registered using @dispatch_for ,
@dispatch_for_unary_elementwise_apis , or
@dispatch_for_binary_elementwise_apis .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-01-23 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-01-23 UTC."],[],[]]