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

Method Pad

tensorflow/core/framework/hash_table/tensible_variable.cc:117–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117void TensibleVariable::Pad(
118 int64 size, const std::function<void(Status)>& done) {
119 if (size == size_) {
120 done(Status::OK());
121 return;
122 }
123 if (size_ - size > segment_size_ || size_ < size) {
124 done(errors::FailedPrecondition(
125 "TensibleVariable Pad size should less than 1 segment ",
126 std::to_string(size_), " ", std::to_string(size)));
127 return;
128 }
129 generator_->GetNextTensor([this, size, done](Status st, const Tensor& tensor) {
130 if (!st.ok()) {
131 done(st);
132 return;
133 }
134 if (size_ - size > segment_size_ || size_ < size) {
135 done(errors::FailedPrecondition(
136 "TensibleVariable Pad size should less than 1 segment ",
137 std::to_string(size_), " ", std::to_string(size)));
138 return;
139 }
140 int64 pad = size_ - size;
141 memcpy(const_cast<char*>(
142 tensors_.back().tensor_data().data()) +
143 (segment_size_ - pad) * slice_size_,
144 tensor.tensor_data().data(), pad * slice_size_);
145 done(Status::OK());
146 });
147}
148
149void TensibleVariable::Clear() {
150 mutex_lock lock(structure_update_mu_);

Callers 2

RestoreHashTableFunction · 0.45

Calls 7

FailedPreconditionFunction · 0.85
to_stringFunction · 0.85
GetNextTensorMethod · 0.80
tensor_dataMethod · 0.80
okMethod · 0.45
dataMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected