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

Method RemoveDimRange

tensorflow/core/framework/tensor_shape.cc:564–581  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

562
563template <class Shape>
564void TensorShapeBase<Shape>::RemoveDimRange(int begin, int end) {
565 if (unknown_rank()) return;
566 begin = begin < 0 ? dims() + begin + 1 : begin;
567 end = end < 0 ? dims() + end + 1 : end;
568 CHECK_GE(begin, 0);
569 CHECK_LE(begin, dims());
570 CHECK_GE(end, 0);
571 CHECK_LE(end, dims());
572 if (begin >= end) return;
573 gtl::InlinedVector<int64, 8> vals;
574 AppendTo(*this, &vals);
575 vals.erase(vals.begin() + begin, vals.begin() + end);
576 ClearAllButDataType();
577 for (auto dval : vals) {
578 AddDim(dval);
579 }
580 TF_CHECK_OK(RecomputeNumElements());
581}
582
583bool TensorShape::IsSameSize(const TensorShape& b) const {
584 if (b.dims() != dims()) return false;

Callers 3

CompileMethod · 0.80
XlaGatherFunction · 0.80
TESTFunction · 0.80

Calls 4

dimsFunction · 0.85
AppendToFunction · 0.85
eraseMethod · 0.45
beginMethod · 0.45

Tested by 1

TESTFunction · 0.64