code: def blas_dot(a, b, c=None, alpha=1.0, beta=0):
      # convert non-contiguous tensor into contiguous to speed up
      if not iscontiguous(a):
          a = np.ascontiguousarray(a, dtype=np.float32)
      if not iscontiguous(b):
          b = np.ascontiguousarray(b, dtype=np.float32)
      if (
          (iscontiguous(a) and iscontiguous(b) and c is None)
          or (iscontiguous(a) and iscontiguous(b) and iscontiguous(c))
          and sys.version_info < (3, 4)
      ):
          m = a.shape[0]
          n = b.shape[1]
          k = a.shape[1]
          a_corder, transa = _force_corder(a)
          b_corder, transb = _force_corder(b)
  
          if c is None:
              c = np.zeros((m, n), dtype=np.float32)
  
          lda = k if transa is "n" else m
          ldb = n if transb is "n" else k
          ldc = n
  
          # TODO: cffi cast not compatible with f_contiguous array with py3.4
          _a = ffi.cast("float *", ffi.from_buffer(a))
          _b = ffi.cast("float *", ffi.from_buffer(b))
          _c = ffi.cast("float *", ffi.from_buffer(c))
          _transa = ffi.cast("char", transa)
          _transb = ffi.cast("char", transb)
          NervanaObject.be.mathlib.cmath_gemm(
              _transa,
              _transb,
              m,
              n,
              k,
              alpha,
              _a,
              lda,
              _b,
              ldb,
              beta,
              _c,
              ldc,
          )
      else:
          if beta == 0:
              np.dot(a, b, c)
              if alpha != 1:
                  np.multiply(c, alpha, c)
              return c
          if beta != 1:
              np.multiply(c, beta, c)
          tmp = np.empty(c.shape, dtype=c.dtype)
          np.dot(a, b, tmp)
          if alpha != 1:
              np.multiply(tmp, alpha, tmp)
          np.add(c, tmp, c)
      return c
  
imports: import sys
  import numpy
  from cffi import FFI
  from neon import NervanaObject
  from neon.transforms import Rectlinclip
label_desc: Use image node_id 21 for calling a global function with example usage: blas_dot(a, b, c, alpha, beta) and returns: c, c