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

Class Entry

tensorflow/core/common_runtime/entry.h:32–135  ·  view source on GitHub ↗

An Entry store a single input value for an individual kernel invocation in an executor. Either a tensor pointer (pass-by-reference) or a tensor (pass-by-value).

Source from the content-addressed store, hash-verified

30//
31// Either a tensor pointer (pass-by-reference) or a tensor (pass-by-value).
32struct Entry {
33 enum class State {
34 NO_VALUE = 0, // The default state for a newly-created Entry.
35 HAS_VALUE, // `this->val` is valid.
36 HAS_CONST_TENSOR, // `this->const_tensor` is valid.
37 HAS_REF_TENSOR, // `this->ref_tensor` is valid.
38 };
39
40 Entry() : state(State::NO_VALUE) {}
41 Entry(const Entry& other) : state(other.state), alloc_attr(other.alloc_attr) {
42 switch (state) {
43 case State::NO_VALUE:
44 break;
45 case State::HAS_VALUE:
46 val.Init(*other.val);
47 break;
48 case State::HAS_CONST_TENSOR:
49 const_tensor = other.const_tensor;
50 break;
51 case State::HAS_REF_TENSOR:
52 ref_tensor = other.ref_tensor;
53 break;
54 }
55 }
56
57 ~Entry() {
58 if (state == State::HAS_VALUE) val.Destroy();
59 }
60
61 Entry& operator=(const Entry& other) {
62 if (state == State::HAS_VALUE) {
63 val.Destroy();
64 }
65 state = other.state;
66 alloc_attr = other.alloc_attr;
67 switch (state) {
68 case State::NO_VALUE:
69 break;
70 case State::HAS_VALUE:
71 val.Init(*other.val);
72 break;
73 case State::HAS_CONST_TENSOR:
74 const_tensor = other.const_tensor;
75 break;
76 case State::HAS_REF_TENSOR:
77 ref_tensor = other.ref_tensor;
78 break;
79 }
80 return *this;
81 }
82
83 Entry& operator=(Entry&& other) {
84 if (state == State::HAS_VALUE) {
85 val.Destroy();
86 }
87 state = other.state;
88 alloc_attr = other.alloc_attr;
89 switch (state) {

Callers

nothing calls this directly

Calls 2

DestroyMethod · 0.45
InitMethod · 0.45

Tested by

no test coverage detected