license import { buffer , Rank , TensorBuffer } from '@tensorflow/tfjs-core' ; export function stridedSliceImpl < R extends Rank > ( outShape , xBuf , strides , begin ) { const outBuf = buffer ( outShape , xBuf . dtype ) ; for ( let i = 0 ; i < outBuf . size ; i ++ ) { const loc = outBuf . indexToLoc ( i ) ; const newLoc = new Array ( loc . length ) ; for ( let j = 0 ; j < newLoc . length ; j ++ ) { newLoc [ j ] = loc [ j ] * strides [ j ] + begin [ j ] ; } outBuf . set ( xBuf . get ( ... newLoc ) , ... loc ) ; } return outBuf as TensorBuffer < R > ; }