Examples/tensorflow/quantization/qat.py
def train(self, sess: tf.Session, update_ops_name: List[str] = None):
        """
        Trains the session graph. The implementation provided here is just an example,
        provide your own implementation if needed.

        :param sess: The sess graph to train.
        :param update_ops_name: list of name of update ops (mostly BatchNorms' moving averages).
                                tf.GraphKeys.UPDATE_OPS collections is always used
                                in addition to this list
        """

        # Your code goes here instead of the example from below

        trainer = ImageNetTrainer(self._config.tfrecord_dir, training_inputs=['keras_learning_phase:0'],
                                  data_inputs=['input_1:0'], validation_inputs=['labels:0'],
                                  image_size=image_net_config.dataset['image_size'],
                                  batch_size=image_net_config.train['batch_size'],
                                  num_epochs=self._config.epochs, format_bgr=True)

        trainer.train(sess, update_ops_name=update_ops_name, learning_rate=self._config.learning_rate,
                      decay_steps=self._config.decay_steps)

        save_model_to_meta(sess, meta_path=os.path.join(self._config.logdir, 'QAT_model'))

        Trains the session graph. The implementation provided here is just an example,
        provide your own implementation if needed.

        :param sess: The sess graph to train.
        :param update_ops_name: list of name of update ops (mostly BatchNorms' moving averages).
                                tf.GraphKeys.UPDATE_OPS collections is always used
                                in addition to this list
        
Trains the session graph. The implementation provided here is just an example,
provide your own implementation if needed.
Trains the session graph . The implementation provided here is just an example provide your own implementation if needed .
def train(self, sess: tf.Session, update_ops_name: List[str] = None):
        trainer = ImageNetTrainer(self._config.tfrecord_dir, training_inputs=['keras_learning_phase:0'],
                                  data_inputs=['input_1:0'], validation_inputs=['labels:0'],
                                  image_size=image_net_config.dataset['image_size'],
                                  batch_size=image_net_config.train['batch_size'],
                                  num_epochs=self._config.epochs, format_bgr=True)
        trainer.train(sess, update_ops_name=update_ops_name, learning_rate=self._config.learning_rate,
                      decay_steps=self._config.decay_steps)
        save_model_to_meta(sess, meta_path=os.path.join(self._config.logdir, 'QAT_model'))
def train ( self , sess : tf . Session , update_ops_name : List [ str ] = None ) : trainer = ImageNetTrainer ( self . _config . tfrecord_dir , training_inputs = [ 'keras_learning_phase:0' ] , data_inputs = [ 'input_1:0' ] , validation_inputs = [ 'labels:0' ] , image_size = image_net_config . dataset [ 'image_size' ] , batch_size = image_net_config . train [ 'batch_size' ] , num_epochs = self . _config . epochs , format_bgr = True ) trainer . train ( sess , update_ops_name = update_ops_name , learning_rate = self . _config . learning_rate , decay_steps = self . _config . decay_steps ) save_model_to_meta ( sess , meta_path = os . path . join ( self . _config . logdir , 'QAT_model' ) )
Trains the session graph.
Trains the session graph .
"""
        Trains the session graph. The implementation provided here is just an example,
        provide your own implementation if needed.

        :param sess: The sess graph to train.
        :param update_ops_name: list of name of update ops (mostly BatchNorms' moving averages).
                                tf.GraphKeys.UPDATE_OPS collections is always used
                                in addition to this list
        """ # Your code goes here instead of the example from below
self
sess
tf.Session
The sess graph to train.
The sess graph to train .
update_ops_name
List[str]
list of name of update ops (mostly BatchNorms' moving averages).
tf.GraphKeys.UPDATE_OPS collections is always used
in addition to this list
list of name of update ops ( mostly BatchNorms ' moving averages ) . tf . GraphKeys . UPDATE_OPS collections is always used in addition to this list