| 1142 | } |
| 1143 | |
| 1144 | void Compute(OpKernelContext* ctx) override { |
| 1145 | Var* var; |
| 1146 | const bool sparse = true; |
| 1147 | mutex* mu = GetTrainingVariableMutex<CPUDevice, T>(ctx, 0, sparse, &var); |
| 1148 | core::ScopedUnref scoped_unref(var); |
| 1149 | // mu_accum is actually the same mutex as mu_var since currently we use a |
| 1150 | // global mutex. |
| 1151 | // |
| 1152 | // mutex* mu_accum = ctx->input_ref_mutex(1); |
| 1153 | if (use_exclusive_lock_ && mu != nullptr) { |
| 1154 | mutex_lock ml(*mu); |
| 1155 | DoCompute(ctx); |
| 1156 | } else { |
| 1157 | DoCompute(ctx); |
| 1158 | } |
| 1159 | } |
| 1160 | |
| 1161 | void DoCompute(OpKernelContext* ctx) { |
| 1162 | Tensor var; |
nothing calls this directly
no test coverage detected