File tree Expand file tree Collapse file tree 1 file changed +4
-20
lines changed Expand file tree Collapse file tree 1 file changed +4
-20
lines changed Original file line number Diff line number Diff line change @@ -2752,17 +2752,11 @@ where
27522752 A : ' a ,
27532753 S : Data ,
27542754 {
2755- let view_len = self . len_of ( axis) ;
2756- let view_stride = self . strides . axis ( axis) ;
2757- if view_len == 0 {
2755+ if self . len_of ( axis) == 0 {
27582756 let new_dim = self . dim . remove_axis ( axis) ;
27592757 Array :: from_shape_simple_fn ( new_dim, move || mapping ( ArrayView :: from ( & [ ] ) ) )
27602758 } else {
2761- // use the 0th subview as a map to each 1d array view extended from
2762- // the 0th element.
2763- self . index_axis ( axis, 0 ) . map ( |first_elt| unsafe {
2764- mapping ( ArrayView :: new_ ( first_elt, Ix1 ( view_len) , Ix1 ( view_stride) ) )
2765- } )
2759+ Zip :: from ( self . lanes ( axis) ) . map_collect ( mapping)
27662760 }
27672761 }
27682762
@@ -2783,21 +2777,11 @@ where
27832777 A : ' a ,
27842778 S : DataMut ,
27852779 {
2786- let view_len = self . len_of ( axis) ;
2787- let view_stride = self . strides . axis ( axis) ;
2788- if view_len == 0 {
2780+ if self . len_of ( axis) == 0 {
27892781 let new_dim = self . dim . remove_axis ( axis) ;
27902782 Array :: from_shape_simple_fn ( new_dim, move || mapping ( ArrayViewMut :: from ( & mut [ ] ) ) )
27912783 } else {
2792- // use the 0th subview as a map to each 1d array view extended from
2793- // the 0th element.
2794- self . index_axis_mut ( axis, 0 ) . map_mut ( |first_elt| unsafe {
2795- mapping ( ArrayViewMut :: new_ (
2796- first_elt,
2797- Ix1 ( view_len) ,
2798- Ix1 ( view_stride) ,
2799- ) )
2800- } )
2784+ Zip :: from ( self . lanes_mut ( axis) ) . map_collect ( mapping)
28012785 }
28022786 }
28032787
You can’t perform that action at this time.
0 commit comments