summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiao Wang <miaowang@google.com>2019-05-07 14:22:59 -0700
committerMiao Wang <miaowang@google.com>2019-05-15 15:39:29 -0700
commite76f098e9c4dbaf52ec0253f487bede6abe7b62f (patch)
treef50f7875cdd77e40b63759d5b7cce87dadbb397f
parent7d3435f6c477cfe9d1954084808cfdc5f8dfb4ad (diff)
downloadml-e76f098e9c4dbaf52ec0253f487bede6abe7b62f.tar.gz
Update the documentation to specify required alignment for operands
in a memory pool. Bug: 131331435 Test: mm Change-Id: Ifa99830f8220cf083dd79f523b18d4fb882e2e93
-rw-r--r--nn/runtime/include/NeuralNetworks.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/nn/runtime/include/NeuralNetworks.h b/nn/runtime/include/NeuralNetworks.h
index c25e3518f..ead75f320 100644
--- a/nn/runtime/include/NeuralNetworks.h
+++ b/nn/runtime/include/NeuralNetworks.h
@@ -4928,8 +4928,8 @@ enum { ANEURALNETWORKS_BYTE_SIZE_OF_CACHE_TOKEN = 32 };
* runtime and drivers the tensors that define a model. See
* {@link ANeuralNetworksModel_setOperandValueFromMemory}. An application
* should typically create one shared memory object that contains every constant tensor
- * needed to define a model. {@link ANeuralNetworksMemory_createFromFd} can be
- * used to create shared memory from a file handle.
+ * needed to define a model. {@link ANeuralNetworksMemory_createFromFd} can be used to
+ * create shared memory from a file handle.
* {@link ANeuralNetworksMemory_createFromAHardwareBuffer} can be used to
* create shared memory from an AHardwareBuffer handle.
*
@@ -4937,6 +4937,13 @@ enum { ANEURALNETWORKS_BYTE_SIZE_OF_CACHE_TOKEN = 32 };
* an execution. See {@link ANeuralNetworksExecution_setInputFromMemory}
* and {@link ANeuralNetworksExecution_setOutputFromMemory}.
*
+ * When calling {@link ANeuralNetworksModel_setOperandValueFromMemory},
+ * {@link ANeuralNetworksExecution_setInputFromMemory} and
+ * {@link ANeuralNetworksExecution_setOutputFromMemory}, each operand in the shared
+ * memory object must be aligned on a boundary of a byte size that is a multiple
+ * of the element type byte size, e.g., a tensor with
+ * {@link ANEURALNETWORKS_TENSOR_FLOAT32} type must be aligned on 4-byte boundary.
+ *
* Available since API level 27.
*/
typedef struct ANeuralNetworksMemory ANeuralNetworksMemory;