Lines Matching refs:context
76 bool validate(const IOperationValidationContext* context) { in validate() argument
77 NN_RET_CHECK_EQ(context->getNumInputs(), kNumInputs); in validate()
78 NN_RET_CHECK_EQ(context->getNumOutputs(), kNumOutputs); in validate()
80 const OperandType inputType = context->getInputType(kInputTensor); in validate()
82 NN_RET_CHECK(validateHalVersion(context, HalVersion::V1_1)); in validate()
84 NN_RET_CHECK(validateHalVersion(context, HalVersion::V1_2)); in validate()
86 NN_RET_CHECK(validateHalVersion(context, HalVersion::V1_3)); in validate()
90 const Shape& input = context->getInputShape(kInputTensor); in validate()
94 return validateInputTypes(context, {inputType, OperandType::TENSOR_INT32}) && in validate()
95 validateOutputTypes(context, {inputType}); in validate()
98 bool prepare(IOperationExecutionContext* context) { in prepare() argument
100 NN_RET_CHECK(!context->isOmittedInput(kInputTensor)); in prepare()
101 NN_RET_CHECK(!context->isOmittedOutput(kOutputTensor)); in prepare()
103 const Shape& input = context->getInputShape(kInputTensor); in prepare()
105 Shape output = context->getOutputShape(kOutputTensor); in prepare()
111 if (context->isOmittedInput(kPermTensor)) { in prepare()
115 const Shape& permShape = context->getInputShape(kPermTensor); in prepare()
116 const int32_t* permData = context->getInputBuffer<int32_t>(kPermTensor); in prepare()
133 return context->setOutputShape(kOutputTensor, output); in prepare()
136 bool execute(IOperationExecutionContext* context) { in execute() argument
138 if (getNumberOfElements(context->getOutputShape(kOutputTensor)) == 0) return true; in execute()
140 switch (context->getInputType(kInputTensor)) { in execute()
142 return transposeGeneric(context->getInputBuffer<float>(kInputTensor), in execute()
143 context->getInputShape(kInputTensor), in execute()
144 context->getInputBuffer<int32_t>(kPermTensor), in execute()
145 context->getInputShape(kPermTensor), in execute()
146 context->getOutputBuffer<float>(kOutputTensor), in execute()
147 context->getOutputShape(kOutputTensor)); in execute()
149 return transposeGeneric(context->getInputBuffer<_Float16>(kInputTensor), in execute()
150 context->getInputShape(kInputTensor), in execute()
151 context->getInputBuffer<int32_t>(kPermTensor), in execute()
152 context->getInputShape(kPermTensor), in execute()
153 context->getOutputBuffer<_Float16>(kOutputTensor), in execute()
154 context->getOutputShape(kOutputTensor)); in execute()
156 return transposeGeneric(context->getInputBuffer<uint8_t>(kInputTensor), in execute()
157 context->getInputShape(kInputTensor), in execute()
158 context->getInputBuffer<int32_t>(kPermTensor), in execute()
159 context->getInputShape(kPermTensor), in execute()
160 context->getOutputBuffer<uint8_t>(kOutputTensor), in execute()
161 context->getOutputShape(kOutputTensor)); in execute()
163 return transposeGeneric(context->getInputBuffer<int8_t>(kInputTensor), in execute()
164 context->getInputShape(kInputTensor), in execute()
165 context->getInputBuffer<int32_t>(kPermTensor), in execute()
166 context->getInputShape(kPermTensor), in execute()
167 context->getOutputBuffer<int8_t>(kOutputTensor), in execute()
168 context->getOutputShape(kOutputTensor)); in execute()