class_docstr: Quantization tests for dynamic Int8 - Int8 matrix multiplications
class_docstr_tok: ["Quantization","tests","for","dynamic","Int8","-","Int8","matrix","multiplications"]
code: def _test_predictions(
      self,
      np_preds,
      coreml_preds,
      SNR=30,
      PSNR=40,
  ):
      np_preds = np_preds.flatten()
      coreml_preds = coreml_preds.flatten()
  
      noise = np_preds - coreml_preds
      noise_var = np.sum(noise**2) / len(noise) + 1e-7
      signal_energy = np.sum(np_preds**2) / len(np_preds)
      max_signal_energy = np.amax(np_preds**2)
      snr = 10 * np.log10(signal_energy / noise_var)
      psnr = 10 * np.log10(max_signal_energy / noise_var)
      self.assertGreaterEqual(snr, SNR)
      self.assertGreaterEqual(psnr, PSNR)
  
imports: import itertools
  import unittest
  import numpy
  import pytest
  import coremltools
  import coremltools.models.datatypes
  from coremltools import ComputeUnit
  from coremltools.models import _QUANTIZATION_MODE_LINEAR_QUANTIZATION, neural_network
  from coremltools.models.neural_network import quantization_utils
  from coremltools.models.neural_network.quantization_utils import MatrixMultiplyLayerSelector, _quantize_spec_weights, activate_int8_int8_matrix_multiplications
label_desc: Use image node_id 2 for calling the DynamicQuantizedInt8Int8MatMul obj's underlying member method code with example usage: obj._test_predictions(np_preds, coreml_preds, SNR, PSNR) without return types