Loading neuralnetworks/1.0/IDevice.hal +23 −9 Original line number Diff line number Diff line Loading @@ -14,8 +14,6 @@ * limitations under the License. */ /* This HAL is a work in progress */ package android.hardware.neuralnetworks@1.0; import IEvent; Loading @@ -28,7 +26,10 @@ interface IDevice { /** * Gets the capabilities of a driver. * * @return status ErrorStatus::NONE if successful. * @return status Error status of the call, must be: * - NONE if successful * - DEVICE_UNAVAILABLE if driver is offline or busy * - GENERAL_FAILURE if there is an unspecified error * @return capabilities Capabilities of the driver. */ getCapabilities() generates (ErrorStatus status, Capabilities capabilities); Loading @@ -43,7 +44,11 @@ interface IDevice { * * @param model A model whose operations--and their corresponding * operands--are to be verified by the driver. * @return status ErrorStatus::NONE if successful. * @return status Error status of the call, must be: * - NONE if successful * - DEVICE_UNAVAILABLE if driver is offline or busy * - GENERAL_FAILURE if there is an unspecified error * - INVALID_ARGUMENT when provided model is invalid * @return supportedOperations A list of supported operations, where true * indicates the operation is supported and * false indicates the operation is not Loading @@ -60,7 +65,7 @@ interface IDevice { * prepareModel is used to make any necessary transformations or alternative * representations to a model for execution, possible including * transformations on the constant data, optimization on the model's graph, * or compilation into the device's native binary. * or compilation into the device's native binary format. * * The only information that may be unknown to the model at this stage is * the shape of the tensors, which may only be known at execution time. Loading @@ -68,7 +73,12 @@ interface IDevice { * @param model The model to be prepared for execution. * @param event A synchronization callback that must be signaled once the * execution has finished. * @return status ErrorStatus::NONE if successful. * @return status Error status of the call, must be: * - NONE if preparation task is successfully launched * - DEVICE_UNAVAILABLE if driver is offline or busy * - GENERAL_FAILURE if there is an unspecified error * - INVALID_ARGUMENT when one of the input arguments is * invalid * @return preparedModel A handle to the resultant prepared model. */ prepareModel(Model model, IEvent event) Loading @@ -77,7 +87,11 @@ interface IDevice { /** * Returns the current status of a driver. * * @return status Status of the driver. * @return status Status of the driver, one of: * - DeviceStatus::AVAILABLE * - DeviceStatus::BUSY * - DeviceStatus::OFFLINE * - DeviceStatus::UNKNOWN */ getStatus() generates (DeviceStatus status); }; neuralnetworks/1.0/IEvent.hal +5 −3 Original line number Diff line number Diff line Loading @@ -14,8 +14,6 @@ * limitations under the License. */ /* This HAL is a work in progress */ package android.hardware.neuralnetworks@1.0; /** Loading @@ -37,7 +35,11 @@ interface IEvent { * the work) to mark the event as completed so that any threads requiring * the corresponding output can continue executing. * * @param status ErrorStatus::NONE if successful. * @param status Error status returned from the asynchronous task, must be: * - NONE if asynchronous task was successful * - DEVICE_UNAVAILABLE if driver is offline or busy * - GENERAL_FAILURE if the asynchronous task resulted in an * unspecified error */ oneway notify(ErrorStatus status); }; neuralnetworks/1.0/IPreparedModel.hal +8 −3 Original line number Diff line number Diff line Loading @@ -36,11 +36,16 @@ interface IPreparedModel { * * @param request The input and output information on which the prepared * model is to be executed. * prepared model. * @param event A callback used for synchronization that must be signaled * once the execution has finished. * @return status ErrorStatus::NONE if the asynchronous task was * successfully launched. * @return status Error status of the call, must be: * - NONE if task is successfully launched * - DEVICE_UNAVAILABLE if driver is offline or busy * - GENERAL_FAILURE if there is an unspecified error * - OUTPUT_INSUFFICIENT_SIZE if provided output buffer is * not large enough to store the resultant values * - INVALID_ARGUMENT when one of the input arguments is * invalid */ execute(Request request, IEvent event) generates (ErrorStatus status); }; neuralnetworks/1.0/types.hal +11 −3 Original line number Diff line number Diff line Loading @@ -218,7 +218,7 @@ enum OperationType : int32_t { * * Inputs: * 0: A 4-D tensor, of shape [batches, height, width, depth_in], specifying the input. * 1: A 4-D tensor, of shape [depth_out, filter_height, filter_width, depth_in], * 1: A 4-D tensor, of shape [1, filter_height, filter_width, depth_out], * specifying the filter. * 2: A 1-D tensor, of shape [depth_out], specifying the bias. * For input tensor of {@link OperandType::TENSOR_FLOAT32} type, the bias should Loading Loading @@ -1105,14 +1105,16 @@ struct Operand { /** * Quantized scale of the operand. * * Only applicable if the operand is of type TENSOR_QUANT8_ASYMM. * Only applicable if the operand is of type TENSOR_QUANT8_ASYMM or * TENSOR_INT32. */ float scale; /** * Quantized zero-point offset of the operand. * * Only applicable if the operand is of type TENSOR_QUANT8_ASYMM. * Only applicable if the operand is of type TENSOR_QUANT8_ASYMM or * TENSOR_INT32. */ int32_t zeroPoint; Loading Loading @@ -1195,12 +1197,18 @@ struct Model { /** * A byte buffer containing operand data that were copied into the model. * * An operand's value must be located here if and only if Operand::lifetime * equals OperandLifeTime::CONSTANT_COPY. */ vec<uint8_t> operandValues; /** * A collection of shared memory pools containing operand data that were * registered by the model. * * An operand's value must be located here if and only if Operand::lifetime * equals OperandLifeTime::CONSTANT_REFERENCE. */ vec<memory> pools; }; Loading Loading
neuralnetworks/1.0/IDevice.hal +23 −9 Original line number Diff line number Diff line Loading @@ -14,8 +14,6 @@ * limitations under the License. */ /* This HAL is a work in progress */ package android.hardware.neuralnetworks@1.0; import IEvent; Loading @@ -28,7 +26,10 @@ interface IDevice { /** * Gets the capabilities of a driver. * * @return status ErrorStatus::NONE if successful. * @return status Error status of the call, must be: * - NONE if successful * - DEVICE_UNAVAILABLE if driver is offline or busy * - GENERAL_FAILURE if there is an unspecified error * @return capabilities Capabilities of the driver. */ getCapabilities() generates (ErrorStatus status, Capabilities capabilities); Loading @@ -43,7 +44,11 @@ interface IDevice { * * @param model A model whose operations--and their corresponding * operands--are to be verified by the driver. * @return status ErrorStatus::NONE if successful. * @return status Error status of the call, must be: * - NONE if successful * - DEVICE_UNAVAILABLE if driver is offline or busy * - GENERAL_FAILURE if there is an unspecified error * - INVALID_ARGUMENT when provided model is invalid * @return supportedOperations A list of supported operations, where true * indicates the operation is supported and * false indicates the operation is not Loading @@ -60,7 +65,7 @@ interface IDevice { * prepareModel is used to make any necessary transformations or alternative * representations to a model for execution, possible including * transformations on the constant data, optimization on the model's graph, * or compilation into the device's native binary. * or compilation into the device's native binary format. * * The only information that may be unknown to the model at this stage is * the shape of the tensors, which may only be known at execution time. Loading @@ -68,7 +73,12 @@ interface IDevice { * @param model The model to be prepared for execution. * @param event A synchronization callback that must be signaled once the * execution has finished. * @return status ErrorStatus::NONE if successful. * @return status Error status of the call, must be: * - NONE if preparation task is successfully launched * - DEVICE_UNAVAILABLE if driver is offline or busy * - GENERAL_FAILURE if there is an unspecified error * - INVALID_ARGUMENT when one of the input arguments is * invalid * @return preparedModel A handle to the resultant prepared model. */ prepareModel(Model model, IEvent event) Loading @@ -77,7 +87,11 @@ interface IDevice { /** * Returns the current status of a driver. * * @return status Status of the driver. * @return status Status of the driver, one of: * - DeviceStatus::AVAILABLE * - DeviceStatus::BUSY * - DeviceStatus::OFFLINE * - DeviceStatus::UNKNOWN */ getStatus() generates (DeviceStatus status); };
neuralnetworks/1.0/IEvent.hal +5 −3 Original line number Diff line number Diff line Loading @@ -14,8 +14,6 @@ * limitations under the License. */ /* This HAL is a work in progress */ package android.hardware.neuralnetworks@1.0; /** Loading @@ -37,7 +35,11 @@ interface IEvent { * the work) to mark the event as completed so that any threads requiring * the corresponding output can continue executing. * * @param status ErrorStatus::NONE if successful. * @param status Error status returned from the asynchronous task, must be: * - NONE if asynchronous task was successful * - DEVICE_UNAVAILABLE if driver is offline or busy * - GENERAL_FAILURE if the asynchronous task resulted in an * unspecified error */ oneway notify(ErrorStatus status); };
neuralnetworks/1.0/IPreparedModel.hal +8 −3 Original line number Diff line number Diff line Loading @@ -36,11 +36,16 @@ interface IPreparedModel { * * @param request The input and output information on which the prepared * model is to be executed. * prepared model. * @param event A callback used for synchronization that must be signaled * once the execution has finished. * @return status ErrorStatus::NONE if the asynchronous task was * successfully launched. * @return status Error status of the call, must be: * - NONE if task is successfully launched * - DEVICE_UNAVAILABLE if driver is offline or busy * - GENERAL_FAILURE if there is an unspecified error * - OUTPUT_INSUFFICIENT_SIZE if provided output buffer is * not large enough to store the resultant values * - INVALID_ARGUMENT when one of the input arguments is * invalid */ execute(Request request, IEvent event) generates (ErrorStatus status); };
neuralnetworks/1.0/types.hal +11 −3 Original line number Diff line number Diff line Loading @@ -218,7 +218,7 @@ enum OperationType : int32_t { * * Inputs: * 0: A 4-D tensor, of shape [batches, height, width, depth_in], specifying the input. * 1: A 4-D tensor, of shape [depth_out, filter_height, filter_width, depth_in], * 1: A 4-D tensor, of shape [1, filter_height, filter_width, depth_out], * specifying the filter. * 2: A 1-D tensor, of shape [depth_out], specifying the bias. * For input tensor of {@link OperandType::TENSOR_FLOAT32} type, the bias should Loading Loading @@ -1105,14 +1105,16 @@ struct Operand { /** * Quantized scale of the operand. * * Only applicable if the operand is of type TENSOR_QUANT8_ASYMM. * Only applicable if the operand is of type TENSOR_QUANT8_ASYMM or * TENSOR_INT32. */ float scale; /** * Quantized zero-point offset of the operand. * * Only applicable if the operand is of type TENSOR_QUANT8_ASYMM. * Only applicable if the operand is of type TENSOR_QUANT8_ASYMM or * TENSOR_INT32. */ int32_t zeroPoint; Loading Loading @@ -1195,12 +1197,18 @@ struct Model { /** * A byte buffer containing operand data that were copied into the model. * * An operand's value must be located here if and only if Operand::lifetime * equals OperandLifeTime::CONSTANT_COPY. */ vec<uint8_t> operandValues; /** * A collection of shared memory pools containing operand data that were * registered by the model. * * An operand's value must be located here if and only if Operand::lifetime * equals OperandLifeTime::CONSTANT_REFERENCE. */ vec<memory> pools; }; Loading