def sparse_block_dot(W, h, inputIdx, b, outputIdx):
 assert (inputIdx.ndim == (h.ndim - 1))
 assert (outputIdx.ndim == inputIdx.ndim)
 if (h.ndim == 2):
  h = h.dimshuffle('x', 0, 1)
  inputIdx = inputIdx.dimshuffle('x', 0)
  outputIdx = outputIdx.dimshuffle('x', 0)
 return SparseBlockGemv()(b.take(outputIdx, axis=0), W, h, inputIdx, outputIdx)

def sparse_block_dot ( W , h , inputIdx , b , outputIdx ) : assert ( inputIdx . ndim == ( h . ndim - 1 ) ) assert ( outputIdx . ndim == inputIdx . ndim ) if ( h . ndim == 2 ) : h = h . dimshuffle ( 'x' , 0 , 1 ) inputIdx = inputIdx . dimshuffle ( 'x' , 0 ) outputIdx = outputIdx . dimshuffle ( 'x' , 0 ) return SparseBlockGemv ( ) ( b . take ( outputIdx , axis = 0 ) , W , h , inputIdx , outputIdx )
compute the dot product of the specified pieces of vectors and matrices .