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