Default values for TfLiteHexagonDelegateOptions
This CL introduces TfLiteHexagonDelegateOptionsDefault() method that returns an instance of TfLiteHexagonDelegateOptions with default values. Without an API for defaults, every new field added will break consumers of hexagon delegate, as they will be filled with garbage values. This is also similar to TfLite GPU delegate API. PiperOrigin-RevId: 309453808 Change-Id: I12275991b34f175e2d1abbe40068287238f44684
This commit is contained in:
parent
1fd3d693a9
commit
6232075ca8
@ -221,6 +221,11 @@ TfLiteDelegate* TfLiteHexagonDelegateCreate(
|
||||
return tflite::CreateDelegate(options);
|
||||
}
|
||||
|
||||
TfLiteHexagonDelegateOptions TfLiteHexagonDelegateOptionsDefault() {
|
||||
TfLiteHexagonDelegateOptions result{0};
|
||||
return result;
|
||||
}
|
||||
|
||||
void TfLiteHexagonDelegateDelete(TfLiteDelegate* delegate) { delete delegate; }
|
||||
|
||||
void TfLiteHexagonInit() { tflite::HexagonDelegateKernel::InitState(); }
|
||||
|
@ -34,6 +34,8 @@ limitations under the License.
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
// Use TfLiteHexagonDelegateOptionsDefault() for Default options.
|
||||
struct TFL_CAPI_EXPORT TfLiteHexagonDelegateOptions {
|
||||
// This corresponds to the debug level in the hexagon SDK. 0 (default)
|
||||
// means no debug.
|
||||
@ -107,6 +109,10 @@ struct TFL_CAPI_EXPORT TfLiteHexagonDelegateOptions {
|
||||
TfLiteDelegate* TFL_CAPI_EXPORT
|
||||
TfLiteHexagonDelegateCreate(const TfLiteHexagonDelegateOptions* options);
|
||||
|
||||
// Returns TfLiteHexagonDelegateOptions populated with default values.
|
||||
TFL_CAPI_EXPORT TfLiteHexagonDelegateOptions
|
||||
TfLiteHexagonDelegateOptionsDefault();
|
||||
|
||||
// Do any needed cleanup and delete 'delegate'.
|
||||
void TFL_CAPI_EXPORT TfLiteHexagonDelegateDelete(TfLiteDelegate* delegate);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user