def test_model_conversion(self):
    from neural_compressor.experimental import ModelConversion, common
    from neural_compressor.conf.config import Conf
    conversion = ModelConversion()
    conversion.source = 'qat'
    conversion.destination = 'default'
    conversion.model = self._qat_temp_path
    q_model = conversion.fit()
    q_model.save(self._quantized_temp_path)
    conf = Conf('fake_yaml.yaml')
    conversion = ModelConversion(conf)
    conversion.source = 'qat'
    conversion.destination = 'default'
    conversion.model = self._qat_temp_path
    q_model = conversion.fit()
    conversion = ModelConversion('fake_yaml.yaml')
    conversion.source = 'qat'
    conversion.destination = 'default'
    conversion.model = self._qat_temp_path
    q_model = conversion.fit()
    graph = tf.compat.v1.Graph()
    with graph.as_default():
        with tf.compat.v1.Session() as sess:
            meta_graph = tf.compat.v1.saved_model.loader.load(sess, [tf.compat.v1.saved_model.tag_constants.SERVING], self._quantized_temp_path)
            print(meta_graph.graph_def.node)
            for i in meta_graph.graph_def.node:
                if ('MatMul' in i.op):
                    self.assertTrue(('QuantizedMatMul' in i.op))
                if ('MaxPool' in i.op):
                    self.assertTrue(('QuantizedMaxPool' in i.op))
                if ('Conv2D' in i.op):
                    self.assertTrue(('QuantizedConv2D' in i.op))
def test_model_conversion(self):
    from neural_compressor.experimental import ModelConversion, common
    from neural_compressor.conf.config import Conf
    conversion = ModelConversion()
    conversion.source = 'qat'
    conversion.destination = 'default'
    conversion.model = self._qat_temp_path
    q_model = conversion.fit()
    q_model.save(self._quantized_temp_path)
    conf = Conf('fake_yaml.yaml')
    conversion = ModelConversion(conf)
    conversion.source = 'qat'
    conversion.destination = 'default'
    conversion.model = self._qat_temp_path
    q_model = conversion.fit()
    conversion = ModelConversion('fake_yaml.yaml')
    conversion.source = 'qat'
    conversion.destination = 'default'
    conversion.model = self._qat_temp_path
    q_model = conversion.fit()
    graph = tf.compat.v1.Graph()
    with graph.as_default():
        with tf.compat.v1.Session() as sess:
            meta_graph = tf.compat.v1.saved_model.loader.load(sess, [tf.compat.v1.saved_model.tag_constants.SERVING], self._quantized_temp_path)
            print(meta_graph.graph_def.node)
            for i in meta_graph.graph_def.node:
                if ('MatMul' in i.op):
                    self.assertTrue(('QuantizedMatMul' in i.op))
                if ('MaxPool' in i.op):
                    self.assertTrue(('QuantizedMaxPool' in i.op))
                if ('Conv2D' in i.op):
                    self.assertTrue(('QuantizedConv2D' in i.op))