license import { NamedTensorMap } from '../tensor_types' ; import { ENGINE } from '../engine' ; import { BroadcastArgs , BroadcastArgsInputs } from '../kernel_names' ; import { Tensor } from '../tensor' ; import { convertToTensor } from '../tensor_util_env' ; import { Rank , TensorLike } from '../types' ; import { op } from './operation' ; param s0 param s1 doc function broadcastArgs_ < R extends Rank > ( s0 , s1 ) { const shape1Input = convertToTensor ( s0 , 's0' , 'broadcastArgs' , 'int32' ) ; const shape2Input = convertToTensor ( s1 , 's1' , 'broadcastArgs' , 'int32' ) ; if ( shape1Input . rank !== 1 ) { throw new Error ( 'broadcastArgs(): first input must be a vector (rank=1). ' + `Has rank ${ shape1Input . rank }` ) ; } if ( shape2Input . rank !== 1 ) { throw new Error ( 'broadcastArgs(): second input must be a vector (rank=1). ' + `Has rank ${ shape2Input . rank }` ) ; } const inputs = { s0 : shape1Input , s1 : shape2Input } ; return ENGINE . runKernel ( BroadcastArgs , inputs as { } as NamedTensorMap ) ; } export const broadcastArgs = op ( { broadcastArgs_ } ) ;