def inner(a, b):
 a_ndim = a.ndim
 b_ndim = b.ndim
 if ((a_ndim == 0) or (b_ndim == 0)):
  return cupy.multiply(a, b)
 a_axis = (a_ndim - 1)
 b_axis = (b_ndim - 1)
 if (a.shape[(-1)] != b.shape[(-1)]):
  raise ValueError('Axis dimension mismatch')
 if a_axis:
  a = cupy.rollaxis(a, a_axis, 0)
 if b_axis:
  b = cupy.rollaxis(b, b_axis, 0)
 ret_shape = (a.shape[1:] + b.shape[1:])
 k = a.shape[0]
 n = (a.size // k)
 m = (b.size // k)
 return core.tensordot_core(a, b, None, n, m, k, ret_shape)

def inner ( a , b ) : a_ndim = a . ndim b_ndim = b . ndim if ( ( a_ndim == 0 ) or ( b_ndim == 0 ) ) : return cupy . multiply ( a , b ) a_axis = ( a_ndim - 1 ) b_axis = ( b_ndim - 1 ) if ( a . shape [ ( - 1 ) ] != b . shape [ ( - 1 ) ] ) : raise ValueError ( 'Axis dimension mismatch' ) if a_axis : a = cupy . rollaxis ( a , a_axis , 0 ) if b_axis : b = cupy . rollaxis ( b , b_axis , 0 ) ret_shape = ( a . shape [ 1 : ] + b . shape [ 1 : ] ) k = a . shape [ 0 ] n = ( a . size // k ) m = ( b . size // k ) return core . tensordot_core ( a , b , None , n , m , k , ret_shape )
returns the inner product of two arrays .