code: def dot(x, y):
      """Compute dot product between a 2-D tensor and a 1-D tensor.
  
      If x is a `[M x N]` matrix, then y is a `M`-vector.
  
      If x is a `M`-vector, then y is a `[M x N]` matrix.
  
      Args:
        x: tf.Tensor.
          A 1-D or 2-D tensor (see above).
        y: tf.Tensor.
          A 1-D or 2-D tensor (see above).
  
      Returns:
        tf.Tensor.
        A 1-D tensor of length `N`.
  
      Raises:
        InvalidArgumentError.
        If the inputs have Inf or NaN values.
      """
      x = tf.convert_to_tensor(x)
      y = tf.convert_to_tensor(y)
      dependencies = [
          tf.verify_tensor_all_finite(x, msg=""),
          tf.verify_tensor_all_finite(y, msg=""),
      ]
      x = control_flow_ops.with_dependencies(dependencies, x)
      y = control_flow_ops.with_dependencies(dependencies, y)
  
      if len(x.shape) == 1:
          vec = x
          mat = y
          return tf.reshape(
              tf.matmul(tf.expand_dims(vec, 0), mat), [-1]
          )
      else:
          mat = x
          vec = y
          return tf.reshape(
              tf.matmul(mat, tf.expand_dims(vec, 1)), [-1]
          )
  
file_path: edward/edward/util/tensorflow.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow
  from tensorflow.python.ops import control_flow_ops
label_desc: Use image node_id 1 for calling a global function with example usage: dot(x, y) and returns: tf, tf