#include <mutable_op_resolver.h>
An OpResolver that is mutable, also used as the op in gen_op_registration.
A typical usage: MutableOpResolver resolver; resolver.AddBuiltin(BuiltinOperator_ADD, Register_ADD()); resolver.AddCustom("CustomOp", Register_CUSTOM_OP()); InterpreterBuilder(model, resolver)(&interpreter);
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.
|
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.
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.
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.
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
.
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.
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.
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.
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.
virtual const TfLiteRegistration * FindOp( tflite::BuiltinOperator op, int version ) const override
Finds the op registration for a builtin operator by enum code.
virtual const TfLiteRegistration * FindOp( const char *op, int version ) const override
Finds the op registration of a custom operator by op name.
virtual OpResolver::TfLiteDelegateCreators GetDelegateCreators() const final
virtual OpResolver::TfLiteOpaqueDelegateCreators GetOpaqueDelegateCreators() const final
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.