code: def est_mm_prec(A, B, ntrials=1):
      A64 = np.float64(A)
      B64 = np.float64(B)
      gt = np.dot(A64, B64)
      max_err = -1.0
      for trial in range(ntrials):
          inds = np.random.permutation(A.shape[1])
          # this method gives better estimate of precision tolerances
          # but takes too long to run
          # for i in range(A.shape[0]):
          #    for j in range(B.shape[1]):
          #        c = np.sum(np.multiply(A[i,inds], B[inds,j]))
          #        max_err = max( max_err, np.abs(c-gt[i,j]))
  
          # need to scale this by 10 for comparison
          C = np.dot(A[:, inds], B[inds, :])
          dd = np.float32(gt - C)
          # just save the worst case from each iteration
          max_err = max(max_err, np.max(np.abs(dd)))
      # need to scale the np.dot results by 10 to
      # match the np.sum(np.multiply()) values
      max_err *= 10.0
      return max_err
  
file_path: neon/tests/test_linear_layer.py
imports: import itertools
  import numpy
  from neon import NervanaObject
  from neon.initializers.initializer import Uniform
  from neon.layers.layer import Linear
  from utils import allclose_with_out
label_desc: Use image node_id 5 for calling a global function with example usage: est_mm_prec(A, B, ntrials) and returns: max_err