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

Method Compute

en_ops/e_reduce_max_one.cc:52–78  ·  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 &input = context->input(0);
55 auto input_flat = input.flat<float>();
56
57 const TensorShape &input_shape = input.shape();
58
59 TensorShape output_shape;
60 output_shape.AddDim(input_shape.dim_size(0));
61 output_shape.AddDim(input_shape.dim_size(2));
62
63 Tensor *output = NULL;
64 OP_REQUIRES_OK(context, context->allocate_output(0, output_shape, &output));
65 auto output_flat = output->flat<float>();
66 int N = input_flat.size() / times_;
67 int M = input_shape.dim_size(0) / times_;
68 int C = input_shape.dim_size(1);
69 int L = input_shape.dim_size(2);
70
71 unsigned long int eid_ = (eid_high_ << 32) + eid_low_;
72 typedef void (*function)(unsigned long int eid, float *input, int N, int M, int C, int L, float *output);
73 dlerror();
74 function reducemax_one_kernel = (function)dlsym(lib, "reducemax_one");
75 const char *dlsym_error = dlerror();
76 OP_REQUIRES(context, !dlsym_error, errors::Unknown("loading of reducemax_one failed: ", dlsym_error));
77 reducemax_one_kernel(eid_, (float *)input_flat.data(), N, M, C, L, (float *)output_flat.data());
78 };
79
80private:
81 void *lib;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected