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

Function FusedBatchNormExShape

tensorflow/core/framework/common_shape_fns.cc:1173–1196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1171}
1172
1173Status FusedBatchNormExShape(shape_inference::InferenceContext* c) {
1174 TF_RETURN_IF_ERROR(FusedBatchNormV3Shape(c));
1175
1176 string data_format_str;
1177 TF_RETURN_IF_ERROR(c->GetAttr("data_format", &data_format_str));
1178 TensorFormat data_format;
1179 if (!FormatFromString(data_format_str, &data_format)) {
1180 return errors::InvalidArgument("Invalid data format string: ",
1181 data_format_str);
1182 }
1183 ShapeHandle x;
1184 TF_RETURN_IF_ERROR(c->WithRank(c->input(0), 4, &x));
1185
1186 int channel_dim_index = GetTensorFeatureDimIndex(4, data_format);
1187 DimensionHandle channel_dim = c->Dim(x, channel_dim_index);
1188
1189 // This is a cuDNN implementation constraint.
1190 if (c->ValueKnown(channel_dim) && c->Value(channel_dim) % 4 != 0) {
1191 return errors::InvalidArgument(
1192 "_FusedBatchNormEx channel dimension must be divisible by 4.");
1193 }
1194
1195 return Status::OK();
1196}
1197
1198Status FusedBatchNormGradShape(shape_inference::InferenceContext* c) {
1199 string data_format_str;

Callers

nothing calls this directly

Calls 10

FusedBatchNormV3ShapeFunction · 0.85
FormatFromStringFunction · 0.85
InvalidArgumentFunction · 0.85
GetTensorFeatureDimIndexFunction · 0.85
ValueKnownMethod · 0.80
GetAttrMethod · 0.45
WithRankMethod · 0.45
inputMethod · 0.45
DimMethod · 0.45
ValueMethod · 0.45

Tested by

no test coverage detected