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

Method Compute

tensorflow/core/kernels/variable_ops.cc:92–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90 }
91
92 void Compute(OpKernelContext* context) override {
93 Status s;
94 ResourceMgr* rm = context->resource_manager();
95 OP_REQUIRES(context, rm, errors::Internal("No per-step resource manager."));
96 auto* tmp_var = new TmpVar;
97 OP_REQUIRES(context, tmp_var,
98 errors::ResourceExhausted("Could not allocate TmpVar."));
99 tmp_var->name = var_name_;
100 s = context->allocate_temp(dtype_, shape_, &tmp_var->val);
101 if (!s.ok()) tmp_var->Unref();
102 OP_REQUIRES_OK(context, s);
103 OP_REQUIRES_OK(context,
104 context->step_container()->Create(rm, var_name_, tmp_var));
105 context->set_output_ref(0, &tmp_var->mu, &tmp_var->val);
106 if (context->track_allocations()) {
107 context->record_persistent_memory_allocation(
108 tmp_var->val.AllocatedBytes());
109 }
110 }
111
112 private:
113 // Refcounted temporary variable resource.

Callers

nothing calls this directly

Calls 12

InternalFunction · 0.85
ResourceExhaustedFunction · 0.85
step_containerMethod · 0.80
set_output_refMethod · 0.80
track_allocationsMethod · 0.80
resource_managerMethod · 0.45
allocate_tempMethod · 0.45
okMethod · 0.45
UnrefMethod · 0.45
CreateMethod · 0.45
AllocatedBytesMethod · 0.45

Tested by

no test coverage detected