message: Improve shape function of tf.sparse_reduce_sum
  This fix tries to address the issue raised in 23114 where
  the shape function of tf.sparse_reduce_sum did not
  infer the shape even if the input shape were known.
  This fix improves the shape function.
  This fix fixes 23114.
diff: @@ -423,7 +423,46 @@ REGISTER_OP("SparseReduceSum")
  .Attr("keep_dims: bool = False")
  .Output("output: T")
  .Attr("T: numbertype")
  - .SetShapeFn(shape_inference::UnknownShape);
  + .SetShapeFn([](InferenceContext* c) {
  + bool keep_dims = false;
  + TF_RETURN_IF_ERROR(c->GetAttr("keep_dims", &keep_dims));
  +
  + const Tensor* shape_tensor = c->input_tensor(2);
  + const Tensor* axes_tensor = c->input_tensor(3);
  + if (shape_tensor != nullptr && axes_tensor != nullptr) {
  + auto shape_vec = shape_tensor->flat<int64>();
  + auto axes_vec = axes_tensor->flat<int32>();
  +
  + int64 ndims = shape_vec.size();
  + std::unordered_set<int64> axes;
  + for (int i = 0; i < axes_vec.size(); i++) {
  + axes.insert((axes_vec(i) + ndims) % ndims);
  + }
  +
  + std::vector<DimensionHandle> dims;
  + if (keep_dims) {
  + dims.reserve(ndims);
  + for (int d = 0; d < ndims; ++d) {
  + if (axes.find(d) == axes.end()) {
  + dims.push_back(c->MakeDim(shape_vec(d)));
  + } else {
  + dims.push_back(c->MakeDim(1));
  + }
  + }
  + } else {
  + for (int d = 0; d < ndims; ++d) {
  + if (axes.find(d) == axes.end()) {
  + dims.push_back(c->MakeDim(shape_vec(d)));
  + }
  + }
  +
  + }
  +
  + c->set_output(0, c->MakeShape(dims));
  + return Status::OK();
  + }
  + return shape_inference::UnknownShape(c);
  + });
  REGISTER_OP("SparseReduceSumSparse")
  .Input("input_indices: int64")
  