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

Method Register

tensorflow/core/util/tensor_slice_set.cc:33–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31TensorSliceSet::~TensorSliceSet() {}
32
33Status TensorSliceSet::Register(const TensorSlice& slice, const string& tag) {
34 TensorShape result_shape;
35 TF_RETURN_IF_ERROR(slice.SliceTensorShape(shape_, &result_shape));
36 string str = slice.DebugString();
37
38 if (slices_.empty()) {
39 slices_hull_ = slice;
40 } else {
41 // We check if there is any intersection between this slice and any of the
42 // registered slices.
43 if (slices_hull_.Overlaps(slice)) {
44 for (const auto& x : slices_) {
45 if (slice.Overlaps(x.second.slice)) {
46 return errors::Internal("Overlapping slices: existing slice = ",
47 x.first, ", new slice = ", str);
48 }
49 }
50 }
51 // No overlap: we can now insert the slice
52 slices_hull_.UpdateToCover(slice);
53 }
54
55 TensorSliceSet::SliceInfo info = {slice, tag, result_shape.num_elements()};
56 slices_.insert(std::make_pair(str, info));
57 return Status::OK();
58}
59
60bool TensorSliceSet::QueryMeta(
61 const TensorSlice& slice,

Callers 3

TESTFunction · 0.45
BM_RegisterOneByOneFunction · 0.45
RegisterTensorSliceFunction · 0.45

Calls 8

InternalFunction · 0.85
SliceTensorShapeMethod · 0.80
OverlapsMethod · 0.80
UpdateToCoverMethod · 0.80
DebugStringMethod · 0.45
emptyMethod · 0.45
num_elementsMethod · 0.45
insertMethod · 0.45

Tested by 2

TESTFunction · 0.36
BM_RegisterOneByOneFunction · 0.36