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

Method InferSoftmaxShape

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

static */

Source from the content-addressed store, hash-verified

1188}
1189
1190/* static */ StatusOr<Shape> ShapeInference::InferSoftmaxShape(
1191 const Shape& operand_shape, int64 feature_index) {
1192 TF_RETURN_IF_ERROR(
1193 ExpectArray(operand_shape, "operand softmax"));
1194 TF_RET_CHECK(ShapeUtil::ValidateShapeWithOptionalLayout(operand_shape) ==
1195 Status::OK());
1196 if (feature_index >= operand_shape.rank()) {
1197 return InvalidArgument(
1198 "Expected feature_index of softmax to be "
1199 "smaller than the rank of operand_shape; "
1200 "got feature_index %d, and rank %d.",
1201 feature_index, operand_shape.rank());
1202 }
1203
1204 if (feature_index < 0) {
1205 return InvalidArgument(
1206 "Expected feature_index of softmax to "
1207 "be a non-negative number, got %d.",
1208 feature_index);
1209 }
1210
1211 if (operand_shape.rank() < 1) {
1212 return InvalidArgument(
1213 "Expected the rank of operand to "
1214 "softmax to be at least 1; got %d.",
1215 operand_shape.rank());
1216 }
1217
1218 return operand_shape;
1219}
1220
1221/* static */ StatusOr<Shape> ShapeInference::InferBatchNormTrainingShape(
1222 const Shape& operand_shape, const Shape& scale_shape,

Callers

nothing calls this directly

Calls 3

ExpectArrayFunction · 0.85
InvalidArgumentFunction · 0.85
rankMethod · 0.45

Tested by

no test coverage detected