File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -2119,10 +2119,11 @@ def serialize(x, axis):
21192119 if axis is None :
21202120 return "|" .join (str (i ) for i in x .flatten ())
21212121
2122- # np.apply_along_axis does not work with str.join, so we
2123- # need to loop through the array directly. First move (possibly
2124- # multiple) axis of interest to trailing dim(s), then make a 2D
2125- # array we can loop through.
2122+ # np.apply_along_axis combined with str.join will truncate strings in
2123+ # some cases (https://github.com/numpy/numpy/issues/8352), so we need to
2124+ # loop through the array directly. First move (possibly multiple) axis
2125+ # of interest to trailing dim(s), then make a 2D array we can loop
2126+ # through.
21262127 work_array = np .moveaxis (x , axis , range (- len (axis ), 0 ))
21272128 out_shape = work_array .shape [: - len (axis )]
21282129 work_array = work_array .reshape (np .prod (out_shape , dtype = int ), - 1 )
You can’t perform that action at this time.
0 commit comments