Lines Matching refs:context
50 bool execute(IOperationExecutionContext* context, float func(float)) { in execute() argument
51 switch (context->getInputType(kInputTensor)) { in execute()
53 return compute<float, _Float16>(func, context->getInputBuffer<_Float16>(kInputTensor), in execute()
54 context->getInputShape(kInputTensor), in execute()
55 context->getOutputBuffer<_Float16>(kOutputTensor)); in execute()
57 return compute<float, float>(func, context->getInputBuffer<float>(kInputTensor), in execute()
58 context->getInputShape(kInputTensor), in execute()
59 context->getOutputBuffer<float>(kOutputTensor)); in execute()
67 bool executeAbs(IOperationExecutionContext* context) { in executeAbs() argument
68 switch (context->getInputType(kInputTensor)) { in executeAbs()
71 context->getInputBuffer<_Float16>(kInputTensor), in executeAbs()
72 context->getInputShape(kInputTensor), in executeAbs()
73 context->getOutputBuffer<_Float16>(kOutputTensor)); in executeAbs()
75 return compute<float, float>(std::abs, context->getInputBuffer<float>(kInputTensor), in executeAbs()
76 context->getInputShape(kInputTensor), in executeAbs()
77 context->getOutputBuffer<float>(kOutputTensor)); in executeAbs()
80 context->getInputBuffer<int32_t>(kInputTensor), in executeAbs()
81 context->getInputShape(kInputTensor), in executeAbs()
82 context->getOutputBuffer<int32_t>(kOutputTensor)); in executeAbs()
88 bool validate(const IOperationValidationContext* context) { in validate() argument
89 NN_RET_CHECK_EQ(context->getNumInputs(), kNumInputs); in validate()
90 NN_RET_CHECK_EQ(context->getNumOutputs(), kNumOutputs); in validate()
91 OperandType inputType = context->getInputType(kInputTensor); in validate()
95 NN_RET_CHECK(validateInputTypes(context, {inputType})); in validate()
96 NN_RET_CHECK(validateOutputTypes(context, {inputType})); in validate()
97 return validateHalVersion(context, HalVersion::V1_2); in validate()
100 bool validateAbs(const IOperationValidationContext* context) { in validateAbs() argument
101 NN_RET_CHECK_EQ(context->getNumInputs(), kNumInputs); in validateAbs()
102 NN_RET_CHECK_EQ(context->getNumOutputs(), kNumOutputs); in validateAbs()
103 OperandType inputType = context->getInputType(kInputTensor); in validateAbs()
107 NN_RET_CHECK(validateInputTypes(context, {inputType})); in validateAbs()
108 NN_RET_CHECK(validateOutputTypes(context, {inputType})); in validateAbs()
109 return validateHalVersion(context, (inputType == OperandType::TENSOR_INT32 ? HalVersion::V1_3 in validateAbs()
113 bool validateFloor(const IOperationValidationContext* context) { in validateFloor() argument
114 NN_RET_CHECK_EQ(context->getNumInputs(), kNumInputs); in validateFloor()
115 NN_RET_CHECK_EQ(context->getNumOutputs(), kNumOutputs); in validateFloor()
117 OperandType inputType = context->getInputType(kInputTensor); in validateFloor()
121 NN_RET_CHECK(validateInputTypes(context, {inputType})); in validateFloor()
122 NN_RET_CHECK(validateOutputTypes(context, {inputType})); in validateFloor()
124 const Shape& input = context->getInputShape(kInputTensor); in validateFloor()
130 context, in validateFloor()
134 bool prepare(IOperationExecutionContext* context) { in prepare() argument
135 Shape input = context->getInputShape(kInputTensor); in prepare()
136 Shape output = context->getOutputShape(kOutputTensor); in prepare()
138 return context->setOutputShape(kOutputTensor, output); in prepare()
141 bool prepareFloor(IOperationExecutionContext* context) { in prepareFloor() argument
142 Shape input = context->getInputShape(kInputTensor); in prepareFloor()
143 Shape output = context->getOutputShape(kOutputTensor); in prepareFloor()
146 return context->setOutputShape(kOutputTensor, output); in prepareFloor()
149 bool executeExp(IOperationExecutionContext* context) { in executeExp() argument
150 return execute(context, std::exp); in executeExp()
153 bool executeFloor(IOperationExecutionContext* context) { in executeFloor() argument
154 return execute(context, std::floor); in executeFloor()
157 bool executeLog(IOperationExecutionContext* context) { in executeLog() argument
158 return execute(context, std::log); in executeLog()
161 bool executeRsqrt(IOperationExecutionContext* context) { in executeRsqrt() argument
162 return execute(context, [](float x) { return 1.f / std::sqrt(x); }); in executeRsqrt()
165 bool executeSin(IOperationExecutionContext* context) { in executeSin() argument
166 return execute(context, std::sin); in executeSin()
169 bool executeSqrt(IOperationExecutionContext* context) { in executeSqrt() argument
170 return execute(context, std::sqrt); in executeSqrt()