Commit 01cf38ee authored by Adam Procter's avatar Adam Procter

Comment edits

parent 19e6dfcf
...@@ -87,7 +87,7 @@ void pass::DynElimination::construct_transpose() ...@@ -87,7 +87,7 @@ void pass::DynElimination::construct_transpose()
// v // v
// Reshape (non-transposing, to handle shrinks) // Reshape (non-transposing, to handle shrinks)
// | // |
// vconst // v
// Reverse (to emulate backwards stride) // Reverse (to emulate backwards stride)
// //
// (The Reshape, Reverse, or both may be omitted if they would just be identities.) // (The Reshape, Reverse, or both may be omitted if they would just be identities.)
...@@ -172,7 +172,7 @@ static SlicePlan make_plan(const Shape& input_shape, ...@@ -172,7 +172,7 @@ static SlicePlan make_plan(const Shape& input_shape,
p.reshape_out_shape = Shape(num_new_axes + num_real_axes + ellipsis_size - num_shrink_axes); p.reshape_out_shape = Shape(num_new_axes + num_real_axes + ellipsis_size - num_shrink_axes);
p.reverse_axes = AxisSet{}; p.reverse_axes = AxisSet{};
// Begin a maddeningly delicate loop to desugar the original slice specs. // Begin a maddeningly delicate loop to desugar the original slice.
// //
// * i_in is iterating over the axes of the input shape, which are also the axes of // * i_in is iterating over the axes of the input shape, which are also the axes of
// p.reshape_in_shape. // p.reshape_in_shape.
...@@ -199,16 +199,15 @@ static SlicePlan make_plan(const Shape& input_shape, ...@@ -199,16 +199,15 @@ static SlicePlan make_plan(const Shape& input_shape,
for (size_t i = 0; i < num_slice_indices; i++) for (size_t i = 0; i < num_slice_indices; i++)
{ {
// If this is a "newaxis", we throw a 1 into the final shape, but it // If this is a "newaxis", then reshape_out_shape will have a 1 here,
// will not be present in the intermediate shape and does not // but reshape_in_shape will not.
// correspond to anything in the original shape.
if (new_axis_mask.count(i)) if (new_axis_mask.count(i))
{ {
p.reshape_out_shape[i_out] = 1; p.reshape_out_shape[i_out] = 1;
i_out++; i_out++;
} }
// If this is a "shrunken" axis, the intermediate shape will have a // If this is a "shrunken" axis, then reshape_in_shape will have a 1
// "1" here, but nothing will be there in the final shape. // here, but reshape_out_shape will not.
else if (shrink_axis_mask.count(i)) else if (shrink_axis_mask.count(i))
{ {
int64_t begin = begins[i]; int64_t begin = begins[i];
...@@ -228,8 +227,7 @@ static SlicePlan make_plan(const Shape& input_shape, ...@@ -228,8 +227,7 @@ static SlicePlan make_plan(const Shape& input_shape,
p.reshape_in_shape[i_in] = 1; p.reshape_in_shape[i_in] = 1;
i_in++; i_in++;
} }
// If this is the ellipsis, expand it (see expand_ellipsis above for // If this is the ellipsis, expand it.
// details).
else if (ellipsis_mask.count(i)) else if (ellipsis_mask.count(i))
{ {
expand_ellipsis(); expand_ellipsis();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment