code: def mdot(*args, **kwargs):
      """
      Product of several matrices.
  
      Computes the matrix product of several arrays of shapes.
  
      Parameters
      ----------
      a_gpu, b_gpu, ... : pycuda.gpuarray.GPUArray
          Arrays to multiply.
      handle : int
          CUBLAS context. If no context is specified, the default handle from
          `skcuda.misc._global_cublas_handle` is used.
  
      Returns
      -------
      c_gpu : pycuda.gpuarray.GPUArray
          Matrix product of `a_gpu`, `b_gpu`, etc.
  
      Notes
      -----
      The input matrices must all contain elements of the same data type.
  
      Examples
      --------
      >>> import pycuda.gpuarray as gpuarray
      >>> import pycuda.autoinit
      >>> import numpy as np
      >>> import skcuda.linalg as linalg
      >>> linalg.init()
      >>> a = np.asarray(np.random.rand(4, 2), np.float32)
      >>> b = np.asarray(np.random.rand(2, 2), np.float32)
      >>> c = np.asarray(np.random.rand(2, 2), np.float32)
      >>> a_gpu = gpuarray.to_gpu(a)
      >>> b_gpu = gpuarray.to_gpu(b)
      >>> c_gpu = gpuarray.to_gpu(c)
      >>> d_gpu = linalg.mdot(a_gpu, b_gpu, c_gpu)
      >>> np.allclose(np.dot(a, np.dot(b, c)), d_gpu.get())
      True
  
      """
  
      if " handle" in kwargs and kwargs["handle"] is not None:
          handle = kwargs["handle"]
      else:
          handle = misc._global_cublas_handle
  
      # Free the temporary matrix allocated when computing the dot
      # product:
      out_gpu = args[0]
      for next_gpu in args[1:]:
          temp_gpu = dot(out_gpu, next_gpu, handle=handle)
          out_gpu.gpudata.free()
          del out_gpu
          out_gpu = temp_gpu
          del temp_gpu
      return out_gpu
  
imports: from __future__ import absolute_import, division
  from pprint import pprint
  from string import Template
  from pycuda.tools import context_dependent_memoize
  from pycuda.compiler import SourceModule
  from pycuda.reduction import ReductionKernel
  from pycuda import cumath
  import pycuda.gpuarray
  import pycuda.driver
  import pycuda.elementwise
  import pycuda.tools
  import numpy
  from .None import cublas
  from .None import cudart
  from .None import misc
  from .None import cusolver
  import sys
  from .misc import init, shutdown, add_matvec, div_matvec, mult_matvec
  from .None import install_headers
label_desc: Use image node_id 7 for calling a global function with example usage: mdot() and returns: out_gpu