MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Compute

Method Compute

tensorflow/core/framework/reader_op_kernel.h:50–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48 }
49
50 void Compute(OpKernelContext* context) override {
51 if (!IsCancellable()) {
52 ResourceOpKernel<ReaderInterface>::Compute(context);
53 } else {
54 // Install cancellation
55 CancellationManager* cm = context->cancellation_manager();
56 CancellationToken token = cm->get_cancellation_token();
57 bool already_cancelled =
58 !cm->RegisterCallback(token, [this]() { this->Cancel(); });
59
60 if (!already_cancelled) {
61 ResourceOpKernel<ReaderInterface>::Compute(context);
62 } else {
63 context->SetStatus(errors::Cancelled("read operation was cancelled"));
64 }
65 }
66 }
67
68 private:
69 virtual bool IsCancellable() const { return false; }

Callers

nothing calls this directly

Calls 7

CancelMethod · 0.95
CancelledFunction · 0.85
ComputeFunction · 0.50
cancellation_managerMethod · 0.45
RegisterCallbackMethod · 0.45
SetStatusMethod · 0.45

Tested by

no test coverage detected