| 57 | |
| 58 | |
| 59 | class OperatorsTable: |
| 60 | def __init__(self): |
| 61 | self.project_dir = Path(__file__).resolve().parents[1] # ComputeLibrary directory |
| 62 | self.xml = "" |
| 63 | |
| 64 | def generate_operator_list(self): |
| 65 | operator_list_head_file = self.project_dir / "arm_compute" / "runtime" / "OperatorList.h" |
| 66 | neon_file_name_prefix = str(self.project_dir / "arm_compute" / "runtime" / "NEON" / "functions" / "NE") |
| 67 | cl_file_name_prefix = str(self.project_dir / "arm_compute" / "runtime" / "CL" / "functions" / "CL") |
| 68 | |
| 69 | logging.debug(operator_list_head_file) |
| 70 | |
| 71 | f = open(operator_list_head_file, 'r') |
| 72 | # Iterates over the lines of the file |
| 73 | state = States.INIT |
| 74 | operator_desc = "" |
| 75 | nn_op_list = [] |
| 76 | for line in f: |
| 77 | # /** ActivationLayer |
| 78 | # * |
| 79 | # * Description: |
| 80 | # * Function to simulate an activation layer with the specified activation function. |
| 81 | # * |
| 82 | # * Equivalent Android NNAPI Op: |
| 83 | # * ANEURALNETWORKS_ELU |
| 84 | # * ANEURALNETWORKS_HARD_SWISH |
| 85 | # * ANEURALNETWORKS_LOGISTIC |
| 86 | # * ANEURALNETWORKS_RELU |
| 87 | # * ANEURALNETWORKS_RELU1 |
| 88 | # * ANEURALNETWORKS_RELU6 |
| 89 | # * ANEURALNETWORKS_TANH |
| 90 | # * |
| 91 | # */ |
| 92 | # Check for "/**" of the start of the operator |
| 93 | r = re.search('^\s*/\*\*(.*)', line) |
| 94 | if r and state == States.INIT: |
| 95 | # Skip below ones |
| 96 | if re.search('.*\(not ported\)', line): |
| 97 | state = States.SKIP_OPERATOR |
| 98 | continue |
| 99 | if re.search('.*\(only CL\)', line): |
| 100 | state = States.SKIP_OPERATOR |
| 101 | continue |
| 102 | if re.search('.*\(no CL\)', line): |
| 103 | state = States.SKIP_OPERATOR |
| 104 | continue |
| 105 | if re.search('.*\(skip\)', line): |
| 106 | state = States.SKIP_OPERATOR |
| 107 | continue |
| 108 | # Check" */" |
| 109 | r = re.match('\s*\*/\s*$', line) |
| 110 | if r and state == States.SKIP_OPERATOR: |
| 111 | state = States.INIT |
| 112 | continue |
| 113 | # Check " *" |
| 114 | r = re.match('\s*\*\s*$', line) |
| 115 | if r and state == States.SKIP_OPERATOR: |
| 116 | continue |
no outgoing calls
no test coverage detected