megengine.core.tensor.dtype.create_quantized_dtype

create_quantized_dtype(dtype_meta, scale, zp)[源代码]

Get quantized dtype with metadata attribute according to _metadata_dict.

Note that unsigned dtype must have zero_point and signed dtype must not have zero_point, to be consitent with tensor generated by calling compiled function from CompGraph.compile(inputs, outspec).

参数
  • dtype_meta (QuantDtypeMeta) – a QuantDtypeMeta indicating which dtype to return. the cname attribute cannot be None.

  • scale (float) – a number for scale to store in dtype’s metadata

  • zp (Optional[int]) – a number for zero_point to store in dtype’s metadata