# tflite::MutableOpResolver

`#include <mutable_op_resolver.h>`

An OpResolver that is mutable, also used as the op in gen_op_registration.

## Summary

A typical usage: MutableOpResolver resolver; resolver.AddBuiltin(BuiltinOperator_ADD, Register_ADD()); resolver.AddCustom("CustomOp", Register_CUSTOM_OP()); InterpreterBuilder(model, resolver)(&interpreter);

### Inheritance

Inherits from: tflite::OpResolver

### Protected attributes
`delegate_creators_` | `TfLiteDelegateCreators` A vector of delegate creators to create optional delegates for resolving and handling ops in the flatbuffer model.
`may_directly_contain_user_defined_ops_ = false` | `bool` True if this OpResolver itself (as opposed to chained op resolvers registed with ChainOpResolver) may contain user defined ops.
`opaque_delegate_creators_` | `TfLiteOpaqueDelegateCreators` A vector of opaque delegate creators to create optional opaque delegates for resolving and handling ops in the flatbuffer model.

### Public functions
`AddAll(const MutableOpResolver & other)` | `void` Registers all operator versions supported by another MutableOpResolver.
`AddBuiltin(tflite::BuiltinOperator op, const TfLiteRegistration *registration, int version)` | `void` Registers the specified `version` of the specified builtin operator `op`.
`AddBuiltin(tflite::BuiltinOperator op, const TfLiteRegistration *registration, int min_version, int max_version)` | `void` Registers the specified version range (versions `min_version` to `max_version`, inclusive) of the specified builtin operator `op`.
`AddCustom(const char *name, const TfLiteRegistration *registration, int version)` | `void` Registers the specified `version` of the specified builtin operator `op`.
`AddCustom(const char *name, const TfLiteRegistration *registration, int min_version, int max_version)` | `void` Registers the specified version range (versions `min_version` to `max_version`, inclusive) of the specified custom operator `name`.
`FindOp(tflite::BuiltinOperator op, int version) const override` | `virtual const TfLiteRegistration *` Finds the op registration for a builtin operator by enum code.
`FindOp(const char *op, int version) const override` | `virtual const TfLiteRegistration *` Finds the op registration of a custom operator by op name.
`GetDelegateCreators() const final` | `virtual OpResolver::TfLiteDelegateCreators`
`GetOpaqueDelegateCreators() const final` | `virtual OpResolver::TfLiteOpaqueDelegateCreators`

### Protected functions
`ChainOpResolver(const OpResolver *other)` | `void` Registers all operator versions supported by another OpResolver, except any already registered in this MutableOpResolver.

## Protected attributes

### delegate_creators_

    TfLiteDelegateCreators delegate_creators_

A vector of delegate creators to create optional delegates for resolving and handling ops in the flatbuffer model.

This may be used in addition to the standard TfLiteRegistration lookup for graph resolution.

### may_directly_contain_user_defined_ops_

    bool may_directly_contain_user_defined_ops_ = false

True if this OpResolver itself (as opposed to chained op resolvers registed with ChainOpResolver) may contain user defined ops.

By "user defined" ops, we mean any op definitions other than those contained in tflite::ops::builtin::BuiltinOpResolver.

### opaque_delegate_creators_

    TfLiteOpaqueDelegateCreators opaque_delegate_creators_

A vector of opaque delegate creators to create optional opaque delegates for resolving and handling ops in the flatbuffer model.

This may be used in addition to the standard TfLiteRegistration lookup for graph resolution. This is used for TF Lite in Google Play Services.

## Public functions

### AddAll

    void AddAll(
      const MutableOpResolver & other
    )

Registers all operator versions supported by another MutableOpResolver.

Replaces any previous registrations for the same operator versions, except that registrations made with `AddBuiltin` or `AddCustom` always take precedence over registrations made with `ChainOpResolver`.

### AddBuiltin

    void AddBuiltin(
      tflite::BuiltinOperator op,
      const TfLiteRegistration *registration,
      int version
    )

Registers the specified `version` of the specified builtin operator `op`.

Replaces any previous registration for the same operator version.

### AddBuiltin

    void AddBuiltin(
      tflite::BuiltinOperator op,
      const TfLiteRegistration *registration,
      int min_version,
      int max_version
    )

Registers the specified version range (versions `min_version` to `max_version`, inclusive) of the specified builtin operator `op`.

Replaces any previous registration for the same operator version.

### AddCustom

    void AddCustom(
      const char *name,
      const TfLiteRegistration *registration,
      int version
    )

Registers the specified `version` of the specified builtin operator `op`.

Replaces any previous registration for the same operator version.

### AddCustom

    void AddCustom(
      const char *name,
      const TfLiteRegistration *registration,
      int min_version,
      int max_version
    )

Registers the specified version range (versions `min_version` to `max_version`, inclusive) of the specified custom operator `name`.

Replaces any previous registration for the same operator version.

### FindOp

    virtual const TfLiteRegistration * FindOp(
      tflite::BuiltinOperator op,
      int version
    ) const override

Finds the op registration for a builtin operator by enum code.

### FindOp

    virtual const TfLiteRegistration * FindOp(
      const char *op,
      int version
    ) const override

Finds the op registration of a custom operator by op name.

### GetDelegateCreators

    virtual OpResolver::TfLiteDelegateCreators GetDelegateCreators() const final

### GetOpaqueDelegateCreators

    virtual OpResolver::TfLiteOpaqueDelegateCreators GetOpaqueDelegateCreators() const final

## Protected functions

### ChainOpResolver

    void ChainOpResolver(
      const OpResolver *other
    )

Registers all operator versions supported by another OpResolver, except any already registered in this MutableOpResolver.

`other` must point to an OpResolver whose lifetime is at least as long as the lifetime of the MutableOpResolver pointed to by `this`. The OpResolver pointed to by `other` should not be modified during the lifetime of this MutableOpResolver.