# tf.experimental.unregister_dispatch_for

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.9.3/tensorflow/python/util/dispatch.py#L469-L525) |

Unregisters a function that was registered with `@dispatch_for_*`.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.experimental.unregister_dispatch_for`](https://www.tensorflow.org/api_docs/python/tf/experimental/unregister_dispatch_for)

<br />

    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
    @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.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `dispatch_target` | The function to unregister. |

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | If `dispatch_target` was not registered using `@dispatch_for`, `@dispatch_for_unary_elementwise_apis`, or `@dispatch_for_binary_elementwise_apis`. |

<br />