code: def ____gemm_code(check_ab, a_init, b_init):
      mod = "%"
      return (
          """
          const char * error_string = NULL;
  
          int type_num = PyArray_DESCR(_x)->type_num;
          int type_size = PyArray_DESCR(_x)->elsize; // in bytes
  
          npy_intp* Nx = PyArray_DIMS(_x);
          npy_intp* Ny = PyArray_DIMS(_y);
          npy_intp* Nz = PyArray_DIMS(_z);
  
          npy_intp* Sx = PyArray_STRIDES(_x);
          npy_intp* Sy = PyArray_STRIDES(_y);
          npy_intp* Sz = PyArray_STRIDES(_z);
  
          size_t sx_0, sx_1, sy_0, sy_1, sz_0, sz_1;
  
          int unit = 0;
  
          if (PyArray_NDIM(_x) != 2) goto _dot_execute_fallback;
          if (PyArray_NDIM(_y) != 2) goto _dot_execute_fallback;
          if (PyArray_NDIM(_z) != 2) goto _dot_execute_fallback;
  
          %(check_ab)s
  
          if ((PyArray_DESCR(_x)->type_num != NPY_DOUBLE)
              && (PyArray_DESCR(_x)->type_num != NPY_FLOAT))
              goto _dot_execute_fallback;
  
          if ((PyArray_DESCR(_y)->type_num != NPY_DOUBLE)
              && (PyArray_DESCR(_y)->type_num != NPY_FLOAT))
              goto _dot_execute_fallback;
  
          if ((PyArray_DESCR(_y)->type_num != NPY_DOUBLE)
              && (PyArray_DESCR(_y)->type_num != NPY_FLOAT))
              goto _dot_execute_fallback;
  
          if ((PyArray_DESCR(_x)->type_num != PyArray_DESCR(_y)->type_num)
              ||(PyArray_DESCR(_x)->type_num != PyArray_DESCR(_z)->type_num))
              goto _dot_execute_fallback;
  
  
          if ((Nx[0] != Nz[0]) || (Nx[1] != Ny[0]) || (Ny[1] != Nz[1]))
          {
              error_string = "Input dimensions do not agree";
              goto _dot_execute_fail;
          }
          if ((Sx[0] < 1) || (Sx[1] < 1) || (Sx[0] %(mod)s type_size) || (Sx[1] %(mod)s type_size)
             || (Sy[0] < 1) || (Sy[1] < 1) || (Sy[0] %(mod)s type_size) || (Sy[1] %(mod)s type_size)
             || (Sz[0] < 1) || (Sz[1] < 1) || (Sz[0] %(mod)s type_size) || (Sz[1] %(mod)s type_size))
          {
             goto _dot_execute_fallback;
          }
  
          /*
          encode the stride structure of _x,_y,_z into a single integer
          */
          unit |= ((Sx[1] == type_size) ? 0x0 : (Sx[0] == type_size) ? 0x1 : 0x2) << 0;
          unit |= ((Sy[1] == type_size) ? 0x0 : (Sy[0] == type_size) ? 0x1 : 0x2) << 4;
          unit |= ((Sz[1] == type_size) ? 0x0 : (Sz[0] == type_size) ? 0x1 : 0x2) << 8;
  
          /* create appropriate strides for malformed matrices that are row or column
           * vectors
           */
          sx_0 = (Nx[0] > 1) ? Sx[0]/type_size : Nx[1];
          sx_1 = (Nx[1] > 1) ? Sx[1]/type_size : Nx[0];
          sy_0 = (Ny[0] > 1) ? Sy[0]/type_size : Ny[1];
          sy_1 = (Ny[1] > 1) ? Sy[1]/type_size : Ny[0];
          sz_0 = (Nz[0] > 1) ? Sz[0]/type_size : Nz[1];
          sz_1 = (Nz[1] > 1) ? Sz[1]/type_size : Nz[0];
  
          switch (type_num)
          {
              case NPY_FLOAT:
              {
                  #define REAL float
                  float a = %(a_init)s;
                  float b = %(b_init)s;
  
                  float* x = (float*)PyArray_DATA(_x);
                  float* y = (float*)PyArray_DATA(_y);
                  float* z = (float*)PyArray_DATA(_z);
  
                  switch(unit)
                  {
                      case 0x000: cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, Nz[0], Nz[1], Nx[1], a, x, sx_0, y, sy_0, b, z, sz_0); break;
                      case 0x001: cblas_sgemm(CblasRowMajor, CblasTrans,   CblasNoTrans, Nz[0], Nz[1], Nx[1], a, x, sx_1, y, sy_0, b, z, sz_0); break;
                      case 0x010: cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasTrans,   Nz[0], Nz[1], Nx[1], a, x, sx_0, y, sy_1, b, z, sz_0); break;
                      case 0x011: cblas_sgemm(CblasRowMajor, CblasTrans,   CblasTrans,   Nz[0], Nz[1], Nx[1], a, x, sx_1, y, sy_1, b, z, sz_0); break;
                      case 0x100: cblas_sgemm(CblasColMajor, CblasTrans,   CblasTrans,   Nz[0], Nz[1], Nx[1], a, x, sx_0, y, sy_0, b, z, sz_1); break;
                      case 0x101: cblas_sgemm(CblasColMajor, CblasNoTrans, CblasTrans,   Nz[0], Nz[1], Nx[1], a, x, sx_1, y, sy_0, b, z, sz_1); break;
                      case 0x110: cblas_sgemm(CblasColMajor, CblasTrans,   CblasNoTrans, Nz[0], Nz[1], Nx[1], a, x, sx_0, y, sy_1, b, z, sz_1); break;
                      case 0x111: cblas_sgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, Nz[0], Nz[1], Nx[1], a, x, sx_1, y, sy_1, b, z, sz_1); break;
                      default: goto _dot_execute_fallback;
                  };
                  #undef REAL
              }
              break;
              case NPY_DOUBLE:
              {
                  #define REAL double
                  double a = %(a_init)s;
                  double b = %(b_init)s;
  
                  double* x = (double*)PyArray_DATA(_x);
                  double* y = (double*)PyArray_DATA(_y);
                  double* z = (double*)PyArray_DATA(_z);
                  switch(unit)
                  {
                      case 0x000: cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, Nz[0], Nz[1], Nx[1], a, x, sx_0, y, sy_0, b, z, sz_0); break;
                      case 0x001: cblas_dgemm(CblasRowMajor, CblasTrans,   CblasNoTrans, Nz[0], Nz[1], Nx[1], a, x, sx_1, y, sy_0, b, z, sz_0); break;
                      case 0x010: cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasTrans,   Nz[0], Nz[1], Nx[1], a, x, sx_0, y, sy_1, b, z, sz_0); break;
                      case 0x011: cblas_dgemm(CblasRowMajor, CblasTrans,   CblasTrans,   Nz[0], Nz[1], Nx[1], a, x, sx_1, y, sy_1, b, z, sz_0); break;
                      case 0x100: cblas_dgemm(CblasColMajor, CblasTrans,   CblasTrans,   Nz[0], Nz[1], Nx[1], a, x, sx_0, y, sy_0, b, z, sz_1); break;
                      case 0x101: cblas_dgemm(CblasColMajor, CblasNoTrans, CblasTrans,   Nz[0], Nz[1], Nx[1], a, x, sx_1, y, sy_0, b, z, sz_1); break;
                      case 0x110: cblas_dgemm(CblasColMajor, CblasTrans,   CblasNoTrans, Nz[0], Nz[1], Nx[1], a, x, sx_0, y, sy_1, b, z, sz_1); break;
                      case 0x111: cblas_dgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, Nz[0], Nz[1], Nx[1], a, x, sx_1, y, sy_1, b, z, sz_1); break;
                      default: goto _dot_execute_fallback;
                  };
                  #undef REAL
              }
              break;
          }
  
          return 0;  //success!
  
          _dot_execute_fallback:
          PyErr_SetString(PyExc_NotImplementedError,
              "dot->execute() fallback");
          return -1;
  
          _dot_execute_fail:
          if (error_string == NULL)
              PyErr_SetString(PyExc_ValueError,
                  "dot->execute() can't run on these inputs");
          return -1;
  
          /* v 1 */
      """
          % locals()
      )
  
file_path: pytensor/pytensor/tensor/blas_headers.py
imports: import logging
  import os
  import sys
  import textwrap
  from os.path import dirname
  from pytensor.configdefaults import config
  from pytensor.link.c.cmodule import GCC_compiler
label_desc: Use image node_id 7 for calling a global function with example usage: ____gemm_code(check_ab, a_init, b_init) and returns: unknown