| 43 | OP_REQUIRES(context, lib != NULL, errors::Unknown("Unable to load sgx.so!")); |
| 44 | } |
| 45 | void Compute(OpKernelContext *context) override |
| 46 | { |
| 47 | const Tensor &input = context->input(0); |
| 48 | auto input_flat = input.flat<float>(); |
| 49 | |
| 50 | const TensorShape &input_shape = input.shape(); |
| 51 | |
| 52 | Tensor *output = NULL; |
| 53 | OP_REQUIRES_OK(context, context->allocate_output(0, input_shape, &output)); |
| 54 | auto output_flat = output->flat<float>(); |
| 55 | int N = input_flat.size() / times_; |
| 56 | |
| 57 | unsigned long int eid_ = (eid_high_ << 32) + eid_low_; |
| 58 | typedef void (*function)(unsigned long int eid, float *input, int N, float *output); |
| 59 | dlerror(); |
| 60 | function exp_kernel = (function)dlsym(lib, "exp1"); |
| 61 | const char *dlsym_error = dlerror(); |
| 62 | OP_REQUIRES(context, !dlsym_error, errors::Unknown("loading of exp failed: ", dlsym_error)); |
| 63 | exp_kernel(eid_, (float *)input_flat.data(), N, (float *)output_flat.data()); |
| 64 | }; |
| 65 | |
| 66 | private: |
| 67 | void *lib; |
nothing calls this directly
no outgoing calls
no test coverage detected