code: def sg_flatten(tensor, opt):
      r
      dim = np.prod(tensor.get_shape().as_list()[1:])
      return tf.reshape(tensor, [-1, dim], name=opt.name)
docs: r"""Reshapes a tensor to `batch_size x -1`.
      
      See `tf.reshape()` in tensorflow.
  
      Args:
        tensor: A `Tensor` (automatically given by chain).
        opt:
          name: If provided, it replaces current tensor's name.
  
      Returns:
        A 2-D tensor.