MCPcopy Create free account
hub / github.com/conflow-dev/ConFlow / Compute

Method Compute

en_ops/e_sigmoid.cc:44–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
65private:
66 void *lib;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected