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

Method ComputeRelative

tensorflow/core/framework/tensor_slice.cc:226–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224}
225
226void TensorSlice::ComputeRelative(const TensorSlice& sub,
227 TensorSlice* relative) const {
228 DCHECK_EQ(dims(), sub.dims());
229 relative->SetFullSlice(dims());
230 for (int d = 0; d < dims(); ++d) {
231 if (IsFullAt(d)) {
232 relative->set_start(d, sub.start(d));
233 relative->set_length(d, sub.length(d));
234 } else {
235 // Otherwise the relative start is the difference between the start of
236 // sub and the start of base
237 relative->set_start(d, sub.start(d) - start(d));
238 relative->set_length(d, sub.length(d));
239 }
240 }
241}
242
243void TensorSlice::UpdateToCover(const TensorSlice& other) {
244 DCHECK_EQ(dims(), other.dims());

Callers 2

TESTFunction · 0.80

Calls 8

dimsFunction · 0.85
startFunction · 0.85
SetFullSliceMethod · 0.80
set_startMethod · 0.80
set_lengthMethod · 0.80
dimsMethod · 0.45
startMethod · 0.45
lengthMethod · 0.45

Tested by 1

TESTFunction · 0.64