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

Method Compute

en_ops/e_matadd.cc:48–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46 OP_REQUIRES(context, lib != NULL, errors::Unknown("Unable to load sgx.so!"));
47 }
48 void Compute(OpKernelContext *context) override
49 {
50 const Tensor &input1 = context->input(0);
51 auto input1_flat = input1.flat<float>();
52
53 const Tensor &input2 = context->input(1);
54 auto input2_flat = input2.flat<float>();
55
56 const TensorShape &input_shape = input1.shape();
57
58 Tensor *output = NULL;
59 OP_REQUIRES_OK(context, context->allocate_output(0, input_shape, &output));
60 auto output_flat = output->flat<float>();
61 int N = input1_flat.size() / times_;
62 int C = input2_flat.size();
63
64 unsigned long int eid_ = (eid_high_ << 32) + eid_low_;
65 typedef void (*function)(unsigned long int eid, float *input1, float *input2, int N, int C, float *output);
66 dlerror();
67 function matadd_kernel = (function)dlsym(lib, "matadd");
68 const char *dlsym_error = dlerror();
69 OP_REQUIRES(context, !dlsym_error, errors::Unknown("loading of matadd failed: ", dlsym_error));
70 matadd_kernel(eid_, (float *)input1_flat.data(), (float *)input2_flat.data(), N, C, (float *)output_flat.data());
71 };
72
73private:
74 void *lib;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected