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

Method MergeWith

tensorflow/core/framework/tensor_shape.cc:776–805  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

774}
775
776Status PartialTensorShape::MergeWith(const PartialTensorShape& shape,
777 PartialTensorShape* result) const {
778 if (unknown_rank()) {
779 *result = shape;
780 return Status::OK();
781 }
782 if (shape.unknown_rank()) {
783 *result = *this;
784 return Status::OK();
785 }
786 const int dims_ = dims();
787 if (dims_ != shape.dims()) {
788 return errors::InvalidArgument(
789 "PartialTensorShape: Incompatible ranks during merge: ", dims_, " vs. ",
790 shape.dims());
791 }
792 CHECK(result != this);
793 result->Clear();
794 for (int i = 0; i < dims_; ++i) {
795 const int64 dim0 = dim_size(i);
796 const int64 dim1 = shape.dim_size(i);
797 if (dim0 >= 0 && dim1 >= 0 && dim0 != dim1) {
798 return errors::InvalidArgument(
799 "PartialTensorShape: Incompatible shapes during merge: ",
800 DebugString(), " vs. ", shape.DebugString());
801 }
802 result->AddDim(dim0 >= 0 ? dim0 : dim1);
803 }
804 return Status::OK();
805}
806
807bool PartialTensorShape::AsTensorShape(TensorShape* shape) const {
808 if (IsFullyDefined()) {

Callers 10

MergeInferredShapesFunction · 0.80
TESTFunction · 0.80
GetElementShapeFromInputFunction · 0.80
ComputeMethod · 0.80
ComputeMethod · 0.80
ComputeMethod · 0.80
ComputeMethod · 0.80
TensorListBinaryAddFunction · 0.80
SetElemShapeMethod · 0.80
MakeDatasetMethod · 0.80

Calls 9

dimsFunction · 0.85
InvalidArgumentFunction · 0.85
unknown_rankMethod · 0.80
DebugStringFunction · 0.70
dimsMethod · 0.45
ClearMethod · 0.45
dim_sizeMethod · 0.45
DebugStringMethod · 0.45
AddDimMethod · 0.45

Tested by 2

TESTFunction · 0.64
MakeDatasetMethod · 0.64