Daniel Konegen / MNIST_example

Dependencies:   mbed-os

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers memory_helpers.h Source File

memory_helpers.h

00001 /* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
00002 
00003 Licensed under the Apache License, Version 2.0 (the "License");
00004 you may not use this file except in compliance with the License.
00005 You may obtain a copy of the License at
00006 
00007     http://www.apache.org/licenses/LICENSE-2.0
00008 
00009 Unless required by applicable law or agreed to in writing, software
00010 distributed under the License is distributed on an "AS IS" BASIS,
00011 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00012 See the License for the specific language governing permissions and
00013 limitations under the License.
00014 ==============================================================================*/
00015 #ifndef TENSORFLOW_LITE_EXPERIMENTAL_MICRO_MEMORY_HELPERS_H_
00016 #define TENSORFLOW_LITE_EXPERIMENTAL_MICRO_MEMORY_HELPERS_H_
00017 
00018 #include "tensorflow/lite/c/c_api_internal.h"
00019 #include "tensorflow/lite/core/api/error_reporter.h"
00020 #include "tensorflow/lite/schema/schema_generated.h"
00021 
00022 namespace tflite {
00023 
00024 // Returns the next pointer address aligned to the given alignment.
00025 uint8_t* AlignPointerUp(uint8_t* data, size_t alignment);
00026 
00027 // Returns the previous pointer address aligned to the given alignment.
00028 uint8_t* AlignPointerDown(uint8_t* data, size_t alignment);
00029 
00030 // Returns an increased size that's a multiple of alignment.
00031 size_t AlignSizeUp(size_t size, size_t alignment);
00032 
00033 // Returns size in bytes for a given TfLiteType.
00034 TfLiteStatus TfLiteTypeSizeOf(TfLiteType type, size_t* size,
00035                               ErrorReporter* reporter);
00036 
00037 // How many bytes are needed to hold a tensor's contents.
00038 TfLiteStatus BytesRequiredForTensor(const tflite::Tensor& flatbuffer_tensor,
00039                                     size_t* bytes, size_t* type_size,
00040                                     ErrorReporter* error_reporter);
00041 
00042 }  // namespace tflite
00043 
00044 #endif  // TENSORFLOW_LITE_EXPERIMENTAL_MICRO_MEMORY_HELPERS_H_