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

Method Compute

en_ops/e_where_equal.cc:52–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50 OP_REQUIRES(context, lib != NULL, errors::Unknown("Unable to load sgx.so!"));
51 }
52 void Compute(OpKernelContext *context) override
53 {
54 const Tensor &input1 = context->input(0);
55 auto input1_flat = input1.flat<float>();
56
57 const Tensor &input2 = context->input(1);
58 auto input2_flat = input2.flat<float>();
59
60 const Tensor &cond1 = context->input(2);
61 auto cond1_flat = cond1.flat<float>();
62
63 const Tensor &cond2 = context->input(3);
64 auto cond2_flat = cond2.flat<float>();
65
66 const TensorShape &input_shape = input1.shape();
67
68 Tensor *output = NULL;
69 OP_REQUIRES_OK(context, context->allocate_output(0, input_shape, &output));
70 auto output_flat = output->flat<float>();
71 int N = input1_flat.size() / times_;
72 int n1 = 1;
73 int n2 = 1;
74 if (cond1_flat.size() > 1)
75 {
76 n1 = cond1_flat.size() / times_;
77 }
78 if (cond2_flat.size() > 1)
79 {
80 n2 = cond2_flat.size() / times_;
81 }
82
83 unsigned long int eid_ = (eid_high_ << 32) + eid_low_;
84 typedef void (*function)(unsigned long int eid, float *input1, float *input2, float *cond1, float *cond2, int N, int n1, int n2, float *output);
85 dlerror();
86 function where_equal_kernel = (function)dlsym(lib, "where_equal");
87 const char *dlsym_error = dlerror();
88 OP_REQUIRES(context, !dlsym_error, errors::Unknown("loading of where_equal failed: ", dlsym_error));
89 where_equal_kernel(eid_, (float *)input1_flat.data(), (float *)input2_flat.data(), (float *)cond1_flat.data(), (float *)cond2_flat.data(), N, n1, n2, (float *)output_flat.data());
90 };
91
92private:
93 void *lib;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected