File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -766,6 +766,14 @@ impl<D: DynDimension> Vector<D, u32> {
766766 self . iter ( ) . map ( |v| * v as usize ) . sum ( )
767767 }
768768}
769+ impl < D : DynDimension > Vector < D , usize > {
770+ pub fn hmul ( & self ) -> usize {
771+ self . iter ( ) . product ( )
772+ }
773+ pub fn hadd ( & self ) -> usize {
774+ self . iter ( ) . sum ( )
775+ }
776+ }
769777
770778//impl<D: Dimension, T: CoordinateType> Vector<D, Coordinate<T>> {
771779// pub fn to_ndarray_dim(self) -> D::NDArrayDim {
Original file line number Diff line number Diff line change @@ -351,8 +351,8 @@ pub async fn save_embedded_tensor<'cref, 'inv>(
351351 . then_req ( ctx, |( chunk_handle, chunk_id) | {
352352 let chunk_info = md. chunk_info ( chunk_id) ;
353353
354- let begin = chunk_info. begin ( ) ;
355- let start_offset = ( * begin * stride) . hadd ( ) ;
354+ let begin = chunk_info. begin ( ) . map ( |v| v . raw as usize ) ;
355+ let start_offset = ( begin * stride) . hadd ( ) ;
356356
357357 let start_ptr =
358358 unsafe { out_file_ptr. offset ( start_offset. try_into ( ) . unwrap ( ) ) } ;
You can’t perform that action at this time.
0 commit comments