license import { env , TensorInfo } from '@tensorflow/tfjs-core' ; import { MathBackendWebGL } from '../backend_webgl' ; import { transposeImplCPU } from '../kernel_utils/shared' ; import { TransposeProgram } from '../transpose_gpu' ; import { TransposePackedProgram } from '../transpose_packed_gpu' ; export function transposeImpl ( x , perm , backend ) { const program = env ( ) . getBool ( 'WEBGL_PACK_ARRAY_OPERATIONS' ) ? new TransposePackedProgram ( x . shape , perm ) : new TransposeProgram ( x . shape , perm ) ; return backend . runWebGLProgram ( program , [ x ] , x . dtype ) ; } export { transposeImplCPU } ;