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

Method Compute

tensorflow/core/kernels/training_ops.cc:988–1008  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

986 }
987
988 void Compute(OpKernelContext* ctx) override {
989 Var* resource;
990 const bool sparse = false;
991 mutex* mu = GetTrainingVariableMutex<Device, T>(ctx, 0, sparse, &resource);
992 core::ScopedUnref scoped_unref(resource);
993 if (use_exclusive_lock_ && mu != nullptr) {
994 mutex_lock l1(*mu);
995 // Don't try to acquire a lock on the second ref as they share the same
996 // mutex.
997 //
998 // mutex_lock l2(*ctx->input_ref_mutex(1));
999 DoValidate(ctx);
1000 if (!ctx->status().ok()) return;
1001 DoCompute(ctx);
1002 } else {
1003 DoValidate(ctx);
1004 if (!ctx->status().ok()) return;
1005 DoCompute(ctx);
1006 }
1007 MaybeForwardRefInputToRefOutput(ctx, 0, 0);
1008 }
1009
1010 private:
1011 bool use_exclusive_lock_;

Callers

nothing calls this directly

Calls 4

DoComputeFunction · 0.85
okMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected