File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -66,22 +66,25 @@ std::vector<int> get_unidirectional_broadcasting_shape(const std::vector<int> &s
6666}
6767
6868std::vector<int > get_slice_shape (const std::vector<int > &shape,
69- std::vector<int > &start,
70- std::vector<int > &end,
71- std::vector<int > axes,
72- std::vector<int > step)
69+ const std::vector<int > &start,
70+ const std::vector<int > &end,
71+ const std::vector<int > & axes,
72+ const std::vector<int > & step)
7373{
7474 std::vector<int > output_shape = std::vector<int >(shape);
7575 int dim = shape.size ();
7676
7777 for (int i = 0 ; i < start.size (); i++) {
7878 int axis = i;
79+ int step_i = 1 ;
7980 if (!axes.empty ()) {
8081 axis = (axes[i] + dim) % dim;
8182 }
8283 int start_i = start[i];
8384 int end_i = end[i];
84- int step_i = step[i];
85+ if (!step.empty ()) {
86+ step_i = step[i];
87+ }
8588
8689 if (step_i < 0 ) {
8790 start_i = -start_i - 1 ;
Original file line number Diff line number Diff line change @@ -40,10 +40,10 @@ std::vector<int> get_unidirectional_broadcasting_shape(const std::vector<int> &s
4040 * @return Shape after slice
4141 */
4242std::vector<int > get_slice_shape (const std::vector<int > &shape,
43- std::vector<int > &start,
44- std::vector<int > &end,
45- std::vector<int > axes = {},
46- std::vector<int > step = {});
43+ const std::vector<int > &start,
44+ const std::vector<int > &end,
45+ const std::vector<int > & axes = {},
46+ const std::vector<int > & step = {});
4747
4848} // namespace base
4949} // namespace dl
You can’t perform that action at this time.
0 commit comments