diff options
author | Won Jeon <won.jeon@arm.com> | 2023-06-10 00:20:04 +0000 |
---|---|---|
committer | Eric Kunze <eric.kunze@arm.com> | 2023-06-29 15:47:40 +0000 |
commit | 78155c63024c33d31e3b66e8e198fd5f93837df1 (patch) | |
tree | fcc16affd189eea6d1f4647d8fb4f6ea71a39ff2 /reference_model/src/operators.cc | |
parent | eb74106e1bc52127e5631736e10e8f8b0b7a1d07 (diff) | |
download | reference_model-78155c63024c33d31e3b66e8e198fd5f93837df1.tar.gz |
Add support for ERF operator to reference model
Signed-off-by: Won Jeon <won.jeon@arm.com>
Change-Id: Ib42b867287b83a183a0d0fb1f1eb29974f58fae4
Diffstat (limited to 'reference_model/src/operators.cc')
-rw-r--r-- | reference_model/src/operators.cc | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/reference_model/src/operators.cc b/reference_model/src/operators.cc index a0b5013..5796129 100644 --- a/reference_model/src/operators.cc +++ b/reference_model/src/operators.cc @@ -580,6 +580,37 @@ extern "C" return tosa_status_valid; } + tosa_status_t tosa_run_erf(tosa_tensor_t client_input, tosa_tensor_t client_output) + { + // Create operator attributes + TosaNoneAttribute attr; + + // Create tensors + tosa::TosaSerializationTensor* input = translate_client_tensor(client_input, "input"); + tosa::TosaSerializationTensor* output = translate_client_tensor(client_output, "output"); + + // Create operator + auto op = new tosa::TosaSerializationOperator(tosa::Op::Op_ERF, tosa::Attribute::Attribute_NONE, &attr, + { input->GetName() }, { output->GetName() }); + + // Create a tosa single-op basic block + tosa::TosaSerializationBasicBlock block("erf", "main", { op }, { input, output }, { input->GetName() }, + { output->GetName() }); + + // Setup model + TosaReference::ModelRunnerImpl runner; + TOSA_RETURN_ON_GRAPH_STATUS_ERROR(runner.initialize(block)); + TOSA_RETURN_ON_ERROR(runner.setInput(input->GetName(), client_input.data, client_input.size)); + + // Execute + TOSA_RETURN_ON_GRAPH_STATUS_ERROR(runner.run()); + + // Extract outputs + TOSA_RETURN_ON_ERROR(runner.getOutput(output->GetName(), client_output.data, client_output.size)); + + return tosa_status_valid; + } + tosa_status_t tosa_run_add(tosa_tensor_t client_input1, tosa_tensor_t client_input2, tosa_tensor_t client_output) { // Create operator attributes @@ -2324,4 +2355,4 @@ extern "C" return tosa_status_valid; } -} // extern "C"
\ No newline at end of file +} // extern "C" |