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