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

Method Compute

en_ops/e_sort_de.cc:88–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86 OP_REQUIRES(context, lib != NULL, errors::Unknown("Unable to load sgx.so!"));
87 }
88 void Compute(OpKernelContext *context) override
89 {
90
91 const Tensor &grad = context->input(0);
92 const Tensor &input = context->input(1);
93
94 auto grad_flat = grad.flat<float>();
95 auto input_flat = input.flat<float>();
96
97 const TensorShape &input_shape = input.shape();
98
99 Tensor *output = NULL;
100 OP_REQUIRES_OK(context, context->allocate_output(0, input_shape, &output));
101 auto output_flat = output->flat<float>();
102
103 const int N = input_flat.size() / times_;
104 int M = input_shape.dim_size(0) / times_;
105 int C = input_shape.dim_size(1);
106 int L = input_shape.dim_size(2);
107
108 unsigned long int eid_ = (eid_high_ << 32) + eid_low_;
109 typedef void (*function)(unsigned long int eid, float *input, float *grad, int N, int M, int C, int L, float *output);
110 dlerror();
111 function sort_de_grad_kernel = (function)dlsym(lib, "sort_de_grad");
112 const char *dlsym_error = dlerror();
113 OP_REQUIRES(context, !dlsym_error, errors::Unknown("loading of sort_de_grad failed: ", dlsym_error));
114 sort_de_grad_kernel(eid_, (float *)input_flat.data(), (float *)grad_flat.data(), N, M, C, L, (float *)output_flat.data());
115 };
116
117private:
118 void *lib;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected