message: [Grappler] Fix bug in RemoveStackStridedSliceSameAxis optimizer
diff: @@ -3112,21 +3112,6 @@ class RemoveStackStridedSliceSameAxis : public ArithmeticOptimizerStage {
  }
  protected:
  - bool GetConstantAsInt64(const NodeDef& node, DataType dtype,
  - std::vector<int64>* values) {
  - if (dtype == DT_INT32) {
  - std::vector<int32> values_int32;
  - if (!ValuesFromConstNode(node, &values_int32)) {
  - return false;
  - }
  - std::copy(values_int32.begin(), values_int32.end(),
  - std::inserter(*values, values->begin()));
  - return true;
  - } else {
  - return ValuesFromConstNode(node, values);
  - }
  - }
  -
  Status CheckInputs(const NodeDef* node, const NodeDef* pack,
  PartialTensorShape* pack_output_shape, int* pack_axis,
  bool* return_early) {
  @@ -3141,12 +3126,11 @@ class RemoveStackStridedSliceSameAxis : public ArithmeticOptimizerStage {
  return Status::OK();
  }
  *pack_output_shape = slice_properties[0].shape();
  - const int pack_input_rank = pack_output_shape->dims() - 1;
  + const int pack_output_rank = pack_output_shape->dims();
  if (*pack_axis < 0) {
  - // The ndims of any input into Pack op is its output ndims - 1.
  - *pack_axis += pack_input_rank;
  + *pack_axis += pack_output_rank;
  }
  - if (*pack_axis < 0 || *pack_axis >= pack_input_rank) {
  + if (*pack_axis < 0 || *pack_axis >= pack_output_rank) {
  return errors::InvalidArgument(
  "Pack node (", pack->name(),
  ") axis attribute is out of bounds: ", pack->attr().at("axis").i());
  