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

Method InferTransposeShape

tensorflow/compiler/xla/service/shape_inference.cc:2991–3006  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

2989}
2990
2991/* static */ StatusOr<Shape> ShapeInference::InferTransposeShape(
2992 const Shape& operand, absl::Span<const int64> dimensions) {
2993 TF_RETURN_IF_ERROR(ExpectArray(operand, "transpose"));
2994
2995 if (!IsPermutation(dimensions, operand.rank())) {
2996 return InvalidArgument(
2997 "Transpose dimensions [%s] are not a permutation of the operand "
2998 "dimensions (operand shape is %s).",
2999 StrJoin(dimensions, ","), ShapeUtil::HumanString(operand));
3000 }
3001
3002 // Permute(dimensions,input) computes output[dimensions[i]]=input[i]. However,
3003 // we need output[i]=input[dimensions[i]] which is
3004 // Permute(Inverse(dimensions),input).
3005 return ShapeUtil::PermuteDimensions(InversePermutation(dimensions), operand);
3006}
3007
3008/* static */ StatusOr<Shape> ShapeInference::InferClampShape(
3009 const Shape& min, const Shape& operand, const Shape& max) {

Callers

nothing calls this directly

Calls 5

ExpectArrayFunction · 0.85
IsPermutationFunction · 0.85
InvalidArgumentFunction · 0.85
InversePermutationFunction · 0.85
rankMethod · 0.45

Tested by

no test coverage detected