| 39 | OP_REQUIRES(context, lib != NULL, errors::Unknown("Unable to load sgx.so!")); |
| 40 | } |
| 41 | void Compute(OpKernelContext *context) override |
| 42 | { |
| 43 | Tensor *output = NULL; |
| 44 | TensorShape output_shape; |
| 45 | output_shape.AddDim(input_dim_); |
| 46 | output_shape.AddDim(output_dim_); |
| 47 | OP_REQUIRES_OK(context, context->allocate_output(0, output_shape, &output)); |
| 48 | auto output_flat = output->flat<float>(); |
| 49 | unsigned long int eid_ = (eid_high_ << 32) + eid_low_; |
| 50 | typedef void (*function)(unsigned long int eid, float *output, int M, int C); |
| 51 | dlerror(); |
| 52 | function emb_init_kernel = (function)dlsym(lib, "emb_init"); |
| 53 | const char *dlsym_error = dlerror(); |
| 54 | OP_REQUIRES(context, !dlsym_error, errors::Unknown("loading of emb_init failed: ", dlsym_error)); |
| 55 | emb_init_kernel(eid_, (float *)output_flat.data(), input_dim_, output_dim_); |
| 56 | }; |
| 57 | |
| 58 | private: |
| 59 | void *lib; |
nothing calls this directly
no outgoing calls
no test coverage detected