code: def sparse_block_dot(W, h, inputIdx, b, outputIdx):
      """
      Compute the dot product (plus bias) of the specified pieces of vectors
      and matrices. See SparseBlockGemv to get more information.
  
      The parameter types are actually their expected shapes relative to
      each other.
  
      Parameters
      ----------
      W : iBlocks, oBlocks, iSize, oSize
          weight matrix
      h : batch, iWin, iSize
          input from lower layer (sparse)
      inputIdx : batch, iWin
          indexes of the input blocks
      b : oBlocks, oSize
          bias vector
      outputIdx : batch, oWin
          indexes of the output blocks
  
      Returns
      -------
      (batch, oWin, oSize)
          dot(W[i, j], h[i]) + b[j] but b[j] is only added once
  
      Notes
      -----
      - `batch` is the number of examples in a minibatch (batch size).
      - `iBlocks` is the total number of blocks in the input (from lower layer).
      - `iSize` is the size of each of these input blocks.
      - `iWin` is the number of blocks that will be used as inputs. Which blocks
         will be used is specified in `inputIdx`.
      - `oBlocks` is the number or possible output blocks.
      - `oSize` is the size of each of these output blocks.
      - `oWin` is the number of output blocks that will actually be computed.
         Which blocks will be computed is specified in `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
      )
  
file_path: Theano/theano/tensor/nnet/blocksparse.py
imports: from __future__ import absolute_import, print_function, division
  import numpy
  import theano
  from theano import Op, Apply
  from theano.tensor import discrete_dtypes
  from theano.gradient import grad_undefined
label_desc: Use image node_id 1 for calling a global function with example usage: sparse_block_dot(W, h, inputIdx, b, outputIdx) and returns: SparseBlockGemv