Caffe2 - C++ API
A deep learning, cross platform ML framework
Data Structures | Typedefs | Enumerations | Functions
NeuralNetworks.h File Reference
#include <stddef.h>
#include <stdint.h>
#include <sys/cdefs.h>

Go to the source code of this file.

Data Structures

struct  ANeuralNetworksOperandType
 ANeuralNetworksOperandType describes the type of an operand. More...
 

Typedefs

typedef struct ANeuralNetworksMemory ANeuralNetworksMemory
 ANeuralNetworksMemory is an opaque type that represents memory. More...
 
typedef struct ANeuralNetworksModel ANeuralNetworksModel
 ANeuralNetworksModel is an opaque type that contains a description of the mathematical operations that constitute the model. More...
 
typedef struct ANeuralNetworksCompilation ANeuralNetworksCompilation
 ANeuralNetworksCompilation is an opaque type that can be used to compile a machine learning model. More...
 
typedef struct ANeuralNetworksExecution ANeuralNetworksExecution
 ANeuralNetworksExecution is an opaque type that can be used to apply a machine learning model to a set of inputs. More...
 
typedef struct ANeuralNetworksOperandType ANeuralNetworksOperandType
 ANeuralNetworksOperandType describes the type of an operand. More...
 
typedef int32_t ANeuralNetworksOperationType
 
typedef struct ANeuralNetworksEvent ANeuralNetworksEvent
 ANeuralNetworksEvent is an opaque type that represents an event that will be signaled once an execution completes.
 

Enumerations

enum  OperandCode {
  ANEURALNETWORKS_FLOAT32 = 0, ANEURALNETWORKS_INT32 = 1, ANEURALNETWORKS_UINT32 = 2, ANEURALNETWORKS_TENSOR_FLOAT32 = 3,
  ANEURALNETWORKS_TENSOR_INT32 = 4, ANEURALNETWORKS_TENSOR_QUANT8_ASYMM = 5
}
 Operand types. More...
 
enum  OperationCode {
  ANEURALNETWORKS_ADD = 0, ANEURALNETWORKS_AVERAGE_POOL_2D = 1, ANEURALNETWORKS_CONCATENATION = 2, ANEURALNETWORKS_CONV_2D = 3,
  ANEURALNETWORKS_DEPTHWISE_CONV_2D = 4, ANEURALNETWORKS_DEPTH_TO_SPACE = 5, ANEURALNETWORKS_DEQUANTIZE = 6, ANEURALNETWORKS_EMBEDDING_LOOKUP = 7,
  ANEURALNETWORKS_FLOOR = 8, ANEURALNETWORKS_FULLY_CONNECTED = 9, ANEURALNETWORKS_HASHTABLE_LOOKUP = 10, ANEURALNETWORKS_L2_NORMALIZATION = 11,
  ANEURALNETWORKS_L2_POOL_2D = 12, ANEURALNETWORKS_LOCAL_RESPONSE_NORMALIZATION = 13, ANEURALNETWORKS_LOGISTIC = 14, ANEURALNETWORKS_LSH_PROJECTION = 15,
  ANEURALNETWORKS_LSTM = 16, ANEURALNETWORKS_MAX_POOL_2D = 17, ANEURALNETWORKS_MUL = 18, ANEURALNETWORKS_RELU = 19,
  ANEURALNETWORKS_RELU1 = 20, ANEURALNETWORKS_RELU6 = 21, ANEURALNETWORKS_RESHAPE = 22, ANEURALNETWORKS_RESIZE_BILINEAR = 23,
  ANEURALNETWORKS_RNN = 24, ANEURALNETWORKS_SOFTMAX = 25, ANEURALNETWORKS_SPACE_TO_DEPTH = 26, ANEURALNETWORKS_SVDF = 27,
  ANEURALNETWORKS_TANH = 28
}
 Operation types. More...
 
enum  FuseCode { ANEURALNETWORKS_FUSED_NONE = 0, ANEURALNETWORKS_FUSED_RELU = 1, ANEURALNETWORKS_FUSED_RELU1 = 2, ANEURALNETWORKS_FUSED_RELU6 = 3 }
 Fused activation function types. More...
 
enum  PaddingCode { ANEURALNETWORKS_PADDING_SAME = 1, ANEURALNETWORKS_PADDING_VALID = 2 }
 Implicit padding algorithms. More...
 
enum  PreferenceCode { ANEURALNETWORKS_PREFER_LOW_POWER = 0, ANEURALNETWORKS_PREFER_FAST_SINGLE_ANSWER = 1, ANEURALNETWORKS_PREFER_SUSTAINED_SPEED = 2 }
 Execution preferences. More...
 
enum  ResultCode {
  ANEURALNETWORKS_NO_ERROR = 0, ANEURALNETWORKS_OUT_OF_MEMORY = 1, ANEURALNETWORKS_INCOMPLETE = 2, ANEURALNETWORKS_UNEXPECTED_NULL = 3,
  ANEURALNETWORKS_BAD_DATA = 4, ANEURALNETWORKS_OP_FAILED = 5, ANEURALNETWORKS_UNMAPPABLE = 5, ANEURALNETWORKS_BAD_STATE = 6
}
 Result codes.
 
enum  { ANEURALNETWORKS_MAX_SIZE_OF_IMMEDIATELY_COPIED_VALUES = 128 }
 For ANeuralNetworksModel_setOperandValue, values with a length smaller or equal to this will be immediately copied into the model. More...
 

Functions

int ANeuralNetworksMemory_createFromFd (size_t size, int protect, int fd, size_t offset, ANeuralNetworksMemory **memory)
 Creates a shared memory object from a file descriptor. More...
 
void ANeuralNetworksMemory_free (ANeuralNetworksMemory *memory)
 Delete a memory object. More...
 
int ANeuralNetworksModel_create (ANeuralNetworksModel **model)
 Create an empty ANeuralNetworksModel. More...
 
void ANeuralNetworksModel_free (ANeuralNetworksModel *model)
 Destroy a model. More...
 
int ANeuralNetworksModel_finish (ANeuralNetworksModel *model)
 Indicate that we have finished modifying a model. More...
 
int ANeuralNetworksModel_addOperand (ANeuralNetworksModel *model, const ANeuralNetworksOperandType *type)
 Add an operand to a model. More...
 
int ANeuralNetworksModel_setOperandValue (ANeuralNetworksModel *model, int32_t index, const void *buffer, size_t length)
 Sets an operand to a constant value. More...
 
int ANeuralNetworksModel_setOperandValueFromMemory (ANeuralNetworksModel *model, int32_t index, const ANeuralNetworksMemory *memory, size_t offset, size_t length)
 Sets an operand to a value stored in a memory object. More...
 
int ANeuralNetworksModel_addOperation (ANeuralNetworksModel *model, ANeuralNetworksOperationType type, uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, const uint32_t *outputs)
 Add an operation to a model. More...
 
int ANeuralNetworksModel_identifyInputsAndOutputs (ANeuralNetworksModel *model, uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, const uint32_t *outputs)
 Specfifies which operands will be the model's inputs and outputs. More...
 
int ANeuralNetworksCompilation_create (ANeuralNetworksModel *model, ANeuralNetworksCompilation **compilation)
 Create a ANeuralNetworksCompilation to compile the given model. More...
 
void ANeuralNetworksCompilation_free (ANeuralNetworksCompilation *compilation)
 Destroy a compilation. More...
 
int ANeuralNetworksCompilation_setPreference (ANeuralNetworksCompilation *compilation, int32_t preference)
 Sets the execution preference. More...
 
int ANeuralNetworksCompilation_finish (ANeuralNetworksCompilation *compilation)
 Indicate that we have finished modifying a compilation. More...
 
int ANeuralNetworksExecution_create (ANeuralNetworksCompilation *compilation, ANeuralNetworksExecution **execution)
 Create a ANeuralNetworksExecution to apply the given compilation. More...
 
void ANeuralNetworksExecution_free (ANeuralNetworksExecution *execution)
 Destroy an execution. More...
 
int ANeuralNetworksExecution_setInput (ANeuralNetworksExecution *execution, int32_t index, const ANeuralNetworksOperandType *type, const void *buffer, size_t length)
 Associate a user buffer with an input of the model of the ANeuralNetworksExecution. More...
 
int ANeuralNetworksExecution_setInputFromMemory (ANeuralNetworksExecution *execution, int32_t index, const ANeuralNetworksOperandType *type, const ANeuralNetworksMemory *memory, size_t offset, size_t length)
 Associate part of a memory object with an input of the model of the ANeuralNetworksExecution. More...
 
int ANeuralNetworksExecution_setOutput (ANeuralNetworksExecution *execution, int32_t index, const ANeuralNetworksOperandType *type, void *buffer, size_t length)
 Associate a user buffer with an output of the model of the ANeuralNetworksExecution. More...
 
int ANeuralNetworksExecution_setOutputFromMemory (ANeuralNetworksExecution *execution, int32_t index, const ANeuralNetworksOperandType *type, const ANeuralNetworksMemory *memory, size_t offset, size_t length)
 Associate part of a memory object with an output of the model of the ANeuralNetworksExecution. More...
 
int ANeuralNetworksExecution_startCompute (ANeuralNetworksExecution *execution, ANeuralNetworksEvent **event)
 Schedule evaluation of the execution. More...
 
int ANeuralNetworksEvent_wait (ANeuralNetworksEvent *event)
 Waits until the execution completes. More...
 
void ANeuralNetworksEvent_free (ANeuralNetworksEvent *event)
 Destroys the event. More...