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

Method set_dim

tensorflow/core/framework/tensor_shape.cc:498–521  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

496
497template <class Shape>
498void TensorShapeBase<Shape>::set_dim(int d, int64 size) {
499 CHECK_GE(d, 0);
500 CHECK_LT(d, dims());
501 CHECK_GE(size, 0);
502 if (tag() == REP16 && size < kMaxRep16) {
503 as16()->dims_[d] =
504 kIsPartial && size < 0 ? kUnknownRep16 : static_cast<uint16>(size);
505 } else if (tag() == REP32 && size < kMaxRep32) {
506 as32()->dims_[d] =
507 kIsPartial && size < 0 ? kUnknownRep32 : static_cast<uint32>(size);
508 } else if (tag() == REP_OUT_OF_LINE) {
509 (*as64()->dims_)[d] = size;
510 } else {
511 // Must upgrade
512 gtl::InlinedVector<int64, 8> vals;
513 AppendTo(*this, &vals);
514 vals[d] = size;
515 ClearAllButDataType();
516 for (auto dval : vals) {
517 AddDim(dval);
518 }
519 }
520 TF_CHECK_OK(RecomputeNumElements());
521}
522
523template <class Shape>
524Status TensorShapeBase<Shape>::SetDimWithStatus(int d, int64 size) {

Callers 15

ComputeMethod · 0.45
ComputeMethod · 0.45
ComputeMethod · 0.45
CompileMethod · 0.45
CompileMethod · 0.45
CompileMethod · 0.45
CompileMethod · 0.45
CompileMethod · 0.45
CompileMethod · 0.45
GetEngineMethod · 0.45
SliceMethod · 0.45
ConcatFunction · 0.45

Calls 2

dimsFunction · 0.85
AppendToFunction · 0.85

Tested by 2

MakeGraphFunction · 0.36
RunGatherMethod · 0.36