Lines Matching refs:context

362 Result<Version> validate(OperationType opType, const IOperationValidationContext* context) {  in validate()  argument
363 NN_RET_CHECK_EQ(context->getNumInputs(), kNumInputs); in validate()
364 NN_RET_CHECK_EQ(context->getNumOutputs(), kNumOutputs); in validate()
365 auto inputType = context->getInputType(kInputTensor); in validate()
382 const Shape& input = context->getInputShape(kInputTensor); in validate()
386 NN_RET_CHECK(validateInputTypes(context, {inputType})); in validate()
387 NN_RET_CHECK(validateOutputTypes(context, {inputType})); in validate()
391 Result<Version> validateHardSwish(const IOperationValidationContext* context) { in validateHardSwish() argument
392 NN_RET_CHECK_EQ(context->getNumInputs(), kNumInputs); in validateHardSwish()
393 NN_RET_CHECK_EQ(context->getNumOutputs(), kNumOutputs); in validateHardSwish()
394 auto inputType = context->getInputType(kInputTensor); in validateHardSwish()
403 NN_RET_CHECK(validateInputTypes(context, {inputType})); in validateHardSwish()
404 NN_RET_CHECK(validateOutputTypes(context, {inputType})); in validateHardSwish()
409 bool prepare(OperationType opType, IOperationExecutionContext* context) { in prepare() argument
410 Shape input = context->getInputShape(kInputTensor); in prepare()
420 auto outputShape = context->getOutputShape(kOutputTensor); in prepare()
440 return context->setOutputShape(kOutputTensor, output); in prepare()
443 bool executeRelu(IOperationExecutionContext* context) { in executeRelu() argument
445 if (getNumberOfElements(context->getOutputShape(kOutputTensor)) == 0) return true; in executeRelu()
446 switch (context->getInputType(kInputTensor)) { in executeRelu()
448 return reluFloat(context->getInputBuffer<_Float16>(kInputTensor), in executeRelu()
449 context->getInputShape(kInputTensor), in executeRelu()
450 context->getOutputBuffer<_Float16>(kOutputTensor), in executeRelu()
451 context->getOutputShape(kOutputTensor)); in executeRelu()
453 return reluFloat(context->getInputBuffer<float>(kInputTensor), in executeRelu()
454 context->getInputShape(kInputTensor), in executeRelu()
455 context->getOutputBuffer<float>(kOutputTensor), in executeRelu()
456 context->getOutputShape(kOutputTensor)); in executeRelu()
458 return reluQuant8(context->getInputBuffer<uint8_t>(kInputTensor), in executeRelu()
459 context->getInputShape(kInputTensor), in executeRelu()
460 context->getOutputBuffer<uint8_t>(kOutputTensor), in executeRelu()
461 context->getOutputShape(kOutputTensor)); in executeRelu()
463 return reluQuant8Signed(context->getInputBuffer<int8_t>(kInputTensor), in executeRelu()
464 context->getInputShape(kInputTensor), in executeRelu()
465 context->getOutputBuffer<int8_t>(kOutputTensor), in executeRelu()
466 context->getOutputShape(kOutputTensor)); in executeRelu()
472 bool executeRelu1(IOperationExecutionContext* context) { in executeRelu1() argument
474 if (getNumberOfElements(context->getOutputShape(kOutputTensor)) == 0) return true; in executeRelu1()
475 switch (context->getInputType(kInputTensor)) { in executeRelu1()
477 return relu1Float(context->getInputBuffer<_Float16>(kInputTensor), in executeRelu1()
478 context->getInputShape(kInputTensor), in executeRelu1()
479 context->getOutputBuffer<_Float16>(kOutputTensor), in executeRelu1()
480 context->getOutputShape(kOutputTensor)); in executeRelu1()
482 return relu1Float(context->getInputBuffer<float>(kInputTensor), in executeRelu1()
483 context->getInputShape(kInputTensor), in executeRelu1()
484 context->getOutputBuffer<float>(kOutputTensor), in executeRelu1()
485 context->getOutputShape(kOutputTensor)); in executeRelu1()
487 return relu1Quant8(context->getInputBuffer<uint8_t>(kInputTensor), in executeRelu1()
488 context->getInputShape(kInputTensor), in executeRelu1()
489 context->getOutputBuffer<uint8_t>(kOutputTensor), in executeRelu1()
490 context->getOutputShape(kOutputTensor)); in executeRelu1()
492 return relu1Quant8Signed(context->getInputBuffer<int8_t>(kInputTensor), in executeRelu1()
493 context->getInputShape(kInputTensor), in executeRelu1()
494 context->getOutputBuffer<int8_t>(kOutputTensor), in executeRelu1()
495 context->getOutputShape(kOutputTensor)); in executeRelu1()
501 bool executeRelu6(IOperationExecutionContext* context) { in executeRelu6() argument
503 if (getNumberOfElements(context->getOutputShape(kOutputTensor)) == 0) return true; in executeRelu6()
504 switch (context->getInputType(kInputTensor)) { in executeRelu6()
506 return relu6Float(context->getInputBuffer<_Float16>(kInputTensor), in executeRelu6()
507 context->getInputShape(kInputTensor), in executeRelu6()
508 context->getOutputBuffer<_Float16>(kOutputTensor), in executeRelu6()
509 context->getOutputShape(kOutputTensor)); in executeRelu6()
511 return relu6Float(context->getInputBuffer<float>(kInputTensor), in executeRelu6()
512 context->getInputShape(kInputTensor), in executeRelu6()
513 context->getOutputBuffer<float>(kOutputTensor), in executeRelu6()
514 context->getOutputShape(kOutputTensor)); in executeRelu6()
516 return relu6Quant8(context->getInputBuffer<uint8_t>(kInputTensor), in executeRelu6()
517 context->getInputShape(kInputTensor), in executeRelu6()
518 context->getOutputBuffer<uint8_t>(kOutputTensor), in executeRelu6()
519 context->getOutputShape(kOutputTensor)); in executeRelu6()
521 return relu6Quant8Signed(context->getInputBuffer<int8_t>(kInputTensor), in executeRelu6()
522 context->getInputShape(kInputTensor), in executeRelu6()
523 context->getOutputBuffer<int8_t>(kOutputTensor), in executeRelu6()
524 context->getOutputShape(kOutputTensor)); in executeRelu6()
530 bool executeLogistic(IOperationExecutionContext* context) { in executeLogistic() argument
532 if (getNumberOfElements(context->getOutputShape(kOutputTensor)) == 0) return true; in executeLogistic()
533 switch (context->getInputType(kInputTensor)) { in executeLogistic()
535 return logisticFloat(context->getInputBuffer<_Float16>(kInputTensor), in executeLogistic()
536 context->getInputShape(kInputTensor), in executeLogistic()
537 context->getOutputBuffer<_Float16>(kOutputTensor), in executeLogistic()
538 context->getOutputShape(kOutputTensor)); in executeLogistic()
540 return logisticFloat(context->getInputBuffer<float>(kInputTensor), in executeLogistic()
541 context->getInputShape(kInputTensor), in executeLogistic()
542 context->getOutputBuffer<float>(kOutputTensor), in executeLogistic()
543 context->getOutputShape(kOutputTensor)); in executeLogistic()
545 return logisticQuant8(context->getInputBuffer<uint8_t>(kInputTensor), in executeLogistic()
546 context->getInputShape(kInputTensor), in executeLogistic()
547 context->getOutputBuffer<uint8_t>(kOutputTensor), in executeLogistic()
548 context->getOutputShape(kOutputTensor)); in executeLogistic()
550 return logisticQuant8Signed(context->getInputBuffer<int8_t>(kInputTensor), in executeLogistic()
551 context->getInputShape(kInputTensor), in executeLogistic()
552 context->getOutputBuffer<int8_t>(kOutputTensor), in executeLogistic()
553 context->getOutputShape(kOutputTensor)); in executeLogistic()
559 bool executeTanh(IOperationExecutionContext* context) { in executeTanh() argument
561 if (getNumberOfElements(context->getOutputShape(kOutputTensor)) == 0) return true; in executeTanh()
562 switch (context->getInputType(kInputTensor)) { in executeTanh()
564 return tanhFloat16(context->getInputBuffer<_Float16>(kInputTensor), in executeTanh()
565 context->getInputShape(kInputTensor), in executeTanh()
566 context->getOutputBuffer<_Float16>(kOutputTensor), in executeTanh()
567 context->getOutputShape(kOutputTensor)); in executeTanh()
569 return tanhFloat32(context->getInputBuffer<float>(kInputTensor), in executeTanh()
570 context->getInputShape(kInputTensor), in executeTanh()
571 context->getOutputBuffer<float>(kOutputTensor), in executeTanh()
572 context->getOutputShape(kOutputTensor)); in executeTanh()
574 return tanhQuant8(context->getInputBuffer<uint8_t>(kInputTensor), in executeTanh()
575 context->getInputShape(kInputTensor), in executeTanh()
576 context->getOutputBuffer<uint8_t>(kOutputTensor), in executeTanh()
577 context->getOutputShape(kOutputTensor)); in executeTanh()
579 return tanhQuant8Signed(context->getInputBuffer<int8_t>(kInputTensor), in executeTanh()
580 context->getInputShape(kInputTensor), in executeTanh()
581 context->getOutputBuffer<int8_t>(kOutputTensor), in executeTanh()
582 context->getOutputShape(kOutputTensor)); in executeTanh()
588 bool executeHardSwish(IOperationExecutionContext* context) { in executeHardSwish() argument
590 if (getNumberOfElements(context->getOutputShape(kOutputTensor)) == 0) return true; in executeHardSwish()
591 switch (context->getInputType(kInputTensor)) { in executeHardSwish()
593 const Shape& inputShape = context->getInputShape(kInputTensor); in executeHardSwish()
594 const Shape& outputShape = context->getOutputShape(kOutputTensor); in executeHardSwish()
597 convertFloat16ToFloat32(context->getInputBuffer<_Float16>(kInputTensor), &inputFloat); in executeHardSwish()
601 convertFloat32ToFloat16(outputFloat, context->getOutputBuffer<_Float16>(kOutputTensor)); in executeHardSwish()
606 convertShapeToTflshape(context->getInputShape(kInputTensor)), in executeHardSwish()
607 context->getInputBuffer<float>(kInputTensor), in executeHardSwish()
608 convertShapeToTflshape(context->getOutputShape(kOutputTensor)), in executeHardSwish()
609 context->getOutputBuffer<float>(kOutputTensor)); in executeHardSwish()
613 return hardSwishQuant(context->getInputBuffer<uint8_t>(kInputTensor), in executeHardSwish()
614 context->getInputShape(kInputTensor), in executeHardSwish()
615 context->getOutputBuffer<uint8_t>(kOutputTensor), in executeHardSwish()
616 context->getOutputShape(kOutputTensor)); in executeHardSwish()
618 return hardSwishQuant(context->getInputBuffer<int8_t>(kInputTensor), in executeHardSwish()
619 context->getInputShape(kInputTensor), in executeHardSwish()
620 context->getOutputBuffer<int8_t>(kOutputTensor), in executeHardSwish()
621 context->getOutputShape(kOutputTensor)); in executeHardSwish()