static */
| 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) { |
nothing calls this directly
no test coverage detected