openvino.runtime.serialize¶
- openvino.runtime.serialize(model: ov::Model, xml_path: str, bin_path: str = '', version: str = 'UNSPECIFIED') None ¶
Serialize given model into IR. The generated .xml and .bin files will be saved into provided paths. :param model: model which will be converted to IR representation :type model: openvino.runtime.Model :param xml_path: path where .xml file will be saved :type xml_path: str :param bin_path: path where .bin file will be saved (optional),
the same name as for xml_path will be used by default.
- Parameters
version – version of the generated IR (optional).
Supported versions are: - “UNSPECIFIED” (default) : Use the latest or model version - “IR_V10” : v10 IR - “IR_V11” : v11 IR
- Examples
Default IR version:
shape = [2, 2] parameter_a = ov.parameter(shape, dtype=np.float32, name="A") parameter_b = ov.parameter(shape, dtype=np.float32, name="B") parameter_c = ov.parameter(shape, dtype=np.float32, name="C") op = (parameter_a + parameter_b) * parameter_c model = Model(op, [parameter_a, parameter_b, parameter_c], "Model") # IR generated with default version serialize(model, xml_path="./serialized.xml", bin_path="./serialized.bin")
IR version 11:
parameter_a = ov.parameter(shape, dtype=np.float32, name="A") parameter_b = ov.parameter(shape, dtype=np.float32, name="B") parameter_c = ov.parameter(shape, dtype=np.float32, name="C") op = (parameter_a + parameter_b) * parameter_c model = Model(ops, [parameter_a, parameter_b, parameter_c], "Model") # IR generated with default version serialize(model, xml_path="./serialized.xml", bin_path="./serialized.bin", version="IR_V11")