|
19 | 19 | #include "tfe_auto_op.h"
|
20 | 20 | #include "tfe_utils.h"
|
21 | 21 | #include "utils.h"
|
| 22 | +#include "../deps/tensorflow/include/tensorflow/c/c_api.h" |
22 | 23 |
|
23 | 24 | namespace tfnodejs {
|
24 | 25 |
|
@@ -251,4 +252,34 @@ napi_value TFJSBackend::ExecuteOp(napi_env env, napi_value op_name_value,
|
251 | 252 | return output_tensor_infos;
|
252 | 253 | }
|
253 | 254 |
|
| 255 | +napi_value TFJSBackend::ExecuteOpFastPath(napi_env env, |
| 256 | + napi_value op_name_value, |
| 257 | + napi_value input_tensor_ids, |
| 258 | + napi_value num_output_values) { |
| 259 | + napi_status nstatus; |
| 260 | + TF_AutoStatus tf_status; |
| 261 | + |
| 262 | + char op_name[NAPI_STRING_SIZE]; |
| 263 | + nstatus = napi_get_value_string_utf8(env, op_name_value, op_name, |
| 264 | + NAPI_STRING_SIZE, nullptr); |
| 265 | + ENSURE_NAPI_OK_RETVAL(env, nstatus, nullptr); |
| 266 | + |
| 267 | + // Crack open and look at the op registry. |
| 268 | + TF_Buffer* op_list_buffer = TF_GetAllOpList(); |
| 269 | + TF_ApiDefMap* api_def_map = TF_NewApiDefMap(op_list_buffer, tf_status.status); |
| 270 | + ENSURE_TF_OK_RETVAL(env, tf_status, nullptr); |
| 271 | + |
| 272 | + // // tensorflow::ApiDef api_def; |
| 273 | + // tensorflow::ApiDef api_def; |
| 274 | + // api_def.ParseFromArray(api_def_buffer->data, api_def_buffer->length); |
| 275 | + // fprintf(stderr, "apidef.name: %s\n", api_def.graph_op_name.c_str()); |
| 276 | + |
| 277 | + // For a test - don't return anything. |
| 278 | + napi_value output_tensor_infos; |
| 279 | + nstatus = napi_create_array_with_length(env, 0, &output_tensor_infos); |
| 280 | + ENSURE_NAPI_OK_RETVAL(env, nstatus, nullptr); |
| 281 | + |
| 282 | + return output_tensor_infos; |
| 283 | +} |
| 284 | + |
254 | 285 | } // namespace tfnodejs
|
0 commit comments