def create_models(models_dir, dtype, shape, no_batch=True): model_version = 1 if FLAGS.graphdef: create_tf_modelconfig(False, models_dir, model_version, 8, dtype, shape) create_tf_modelfile(False, models_dir, model_version, 8, dtype, shape) if no_batch: create_tf_modelconfig(False, models_dir, model_version, 0, dtype, shape) create_tf_modelfile(False, models_dir, model_version, 0, dtype, shape) if FLAGS.savedmodel: create_tf_modelconfig(True, models_dir, model_version, 8, dtype, shape) create_tf_modelfile(True, models_dir, model_version, 8, dtype, shape) if no_batch: create_tf_modelconfig(True, models_dir, model_version, 0, dtype, shape) create_tf_modelfile(True, models_dir, model_version, 0, dtype, shape) if FLAGS.netdef: create_netdef_modelconfig(models_dir, model_version, 8, dtype, shape) create_netdef_modelfile(models_dir, model_version, 8, dtype, shape) if no_batch: create_netdef_modelconfig(models_dir, model_version, 0, dtype, shape) create_netdef_modelfile(models_dir, model_version, 0, dtype, shape) if FLAGS.tensorrt: create_plan_modelconfig(models_dir, model_version, 8, dtype, shape + [1, 1]) create_plan_modelfile(models_dir, model_version, 8, dtype, shape + [1, 1]) if no_batch: create_plan_modelconfig(models_dir, model_version, 0, dtype, shape + [1, 1]) create_plan_modelfile(models_dir, model_version, 0, dtype, shape + [1, 1]) if FLAGS.onnx: create_onnx_modelconfig(models_dir, model_version, 8, dtype, shape) create_onnx_modelfile(models_dir, model_version, 8, dtype, shape) if no_batch: create_onnx_modelconfig(models_dir, model_version, 0, dtype, shape) create_onnx_modelfile(models_dir, model_version, 0, dtype, shape) if FLAGS.ensemble: for pair in emu.platform_types_and_validation(): if pair[0] == "plan": shape = shape + [1, 1] if not pair[1](dtype, dtype, dtype, shape, shape, shape): continue emu.create_sequence_ensemble_modelconfig( pair[0], models_dir, 8, model_version, shape, dtype) emu.create_sequence_ensemble_modelfile( pair[0], models_dir, 8, model_version, shape, dtype) if no_batch: emu.create_sequence_ensemble_modelconfig( pair[0], models_dir, 0, model_version, shape, dtype) emu.create_sequence_ensemble_modelfile( pair[0], models_dir, 0, model_version, shape, dtype)
def create_models(models_dir, dtype, shape, no_batch=True): model_version = 1 if FLAGS.graphdef: create_tf_modelconfig(False, models_dir, model_version, 8, dtype, shape) create_tf_modelfile(False, models_dir, model_version, 8, dtype, shape) if no_batch: create_tf_modelconfig(False, models_dir, model_version, 0, dtype, shape) create_tf_modelfile(False, models_dir, model_version, 0, dtype, shape) if FLAGS.savedmodel: create_tf_modelconfig(True, models_dir, model_version, 8, dtype, shape) create_tf_modelfile(True, models_dir, model_version, 8, dtype, shape) if no_batch: create_tf_modelconfig(True, models_dir, model_version, 0, dtype, shape) create_tf_modelfile(True, models_dir, model_version, 0, dtype, shape) if FLAGS.tensorrt: suffix = [] if dtype == np.int8: suffix = [1, 1] create_plan_modelconfig(models_dir, model_version, 8, dtype, shape + suffix) create_plan_modelfile(models_dir, model_version, 8, dtype, shape + suffix) if no_batch: create_plan_modelconfig(models_dir, model_version, 0, dtype, shape + suffix) create_plan_modelfile(models_dir, model_version, 0, dtype, shape + suffix) if FLAGS.onnx: create_onnx_modelconfig(models_dir, model_version, 8, dtype, shape) create_onnx_modelfile(models_dir, model_version, 8, dtype, shape) if no_batch: create_onnx_modelconfig(models_dir, model_version, 0, dtype, shape) create_onnx_modelfile(models_dir, model_version, 0, dtype, shape) if FLAGS.libtorch: create_libtorch_modelconfig(models_dir, model_version, 8, dtype, shape) create_libtorch_modelfile(models_dir, model_version, 8, dtype, shape) if no_batch: create_libtorch_modelconfig(models_dir, model_version, 0, dtype, shape) create_libtorch_modelfile(models_dir, model_version, 0, dtype, shape) if FLAGS.ensemble: for pair in emu.platform_types_and_validation(): config_shape = shape if pair[0] == "plan" and dtype == np.int8: config_shape = shape + [1, 1] if not pair[1](dtype, dtype, dtype, config_shape, config_shape, config_shape): continue emu.create_sequence_ensemble_modelconfig(pair[0], models_dir, 8, model_version, config_shape, dtype) emu.create_sequence_ensemble_modelfile(pair[0], models_dir, 8, model_version, config_shape, dtype) if no_batch: emu.create_sequence_ensemble_modelconfig( pair[0], models_dir, 0, model_version, config_shape, dtype) emu.create_sequence_ensemble_modelfile(pair[0], models_dir, 0, model_version, config_shape, dtype)