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

Method Seek

tensorflow/core/lib/io/inputbuffer.cc:176–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174}
175
176Status InputBuffer::Seek(int64 position) {
177 if (position < 0) {
178 return errors::InvalidArgument("Seeking to a negative position: ",
179 position);
180 }
181 // Position of the buffer within file.
182 const int64 bufpos = file_pos_ - static_cast<int64>(limit_ - buf_);
183 if (position >= bufpos && position < file_pos_) {
184 // Seeks to somewhere inside the buffer.
185 pos_ = buf_ + (position - bufpos);
186 DCHECK(pos_ >= buf_ && pos_ < limit_);
187 } else {
188 // Seeks to somewhere outside. Discards the buffered data.
189 pos_ = limit_ = buf_;
190 file_pos_ = position;
191 }
192 return Status::OK();
193}
194
195} // namespace io
196} // namespace tensorflow

Callers 12

TransformMethod · 0.45
seekMethod · 0.45
TESTFunction · 0.45
InternalGetMethod · 0.45
ApproximateOffsetOfMethod · 0.45
TestRandomAccessMethod · 0.45
TEST_FFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
BuildV2VarMapsMethod · 0.45
WriteRestVariablesFunction · 0.45

Calls 1

InvalidArgumentFunction · 0.85

Tested by 6

TESTFunction · 0.36
TestRandomAccessMethod · 0.36
TEST_FFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36