Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to using protogen's .pyi file generator #6096

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

kumar-ish
Copy link

@kumar-ish kumar-ish commented Apr 22, 2024

Description

Moves to using protogen's own pyi generator, as opposed to using the custom-made, potentially faulty one.

Motivation and Context

@kumar-ish kumar-ish requested a review from a team as a code owner April 22, 2024 08:09
Signed-off-by: Madhav Kumar <47245900+kumar-ish@users.noreply.github.com>
@justinchuby justinchuby added the run release CIs Use this label to trigger release tests in CI label Apr 22, 2024
Copy link

codecov bot commented Apr 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 57.04%. Comparing base (83194ed) to head (a099772).
Report is 25 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6096      +/-   ##
==========================================
+ Coverage   56.95%   57.04%   +0.08%     
==========================================
  Files         506      506              
  Lines       30467    30935     +468     
  Branches     4592     4592              
==========================================
+ Hits        17353    17646     +293     
- Misses      12285    12463     +178     
+ Partials      829      826       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@justinchuby
Copy link
Contributor

Looks like the option was added in https://github.com/protocolbuffers/protobuf/releases/tag/v3.20.0. We may need to bump some versions in the pipelines to use it

tools/protoc-gen-mypy.py Fixed Show fixed Hide fixed
tools/protoc-gen-mypy.py Fixed Show fixed Hide fixed
@kumar-ish kumar-ish force-pushed the use-protobuf-pyi-generator branch 2 times, most recently from 0cddd1e to c187cfb Compare April 22, 2024 17:32
@kumar-ish
Copy link
Author

Oops sorry for all the force pushes, I keep missing the DCO 😅

I can't seem to find any instances that protobuf's version in the code precedes that. Do you have any idea where it would need to be updated?

@justinchuby
Copy link
Contributor

Oops sorry for all the force pushes, I keep missing the DCO 😅

I can't seem to find any instances that protobuf's version in the code precedes that. Do you have any idea where it would need to be updated?

Right. That seems to be what I realized too. I need to look deeper.

@justinchuby
Copy link
Contributor

@justinchuby
Copy link
Contributor

justinchuby commented Apr 22, 2024

Is there a way to either disable pyi gen or fall back to the old method when building with an older protobuf version? Whichever is easier.

@kumar-ish
Copy link
Author

kumar-ish commented Apr 22, 2024

Ahh, I see. Yes (I think former will be nicer), that's one of the CMake options -- I will address this tomorrow when on a computer again.

@justinchuby
Copy link
Contributor

justinchuby commented Apr 23, 2024

Generated

from google.protobuf.internal import containers as _containers
from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union

DESCRIPTOR: _descriptor.FileDescriptor

class Version(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
    __slots__ = []
    _START_VERSION: _ClassVar[Version]
    IR_VERSION_2017_10_10: _ClassVar[Version]
    IR_VERSION_2017_10_30: _ClassVar[Version]
    IR_VERSION_2017_11_3: _ClassVar[Version]
    IR_VERSION_2019_1_22: _ClassVar[Version]
    IR_VERSION_2019_3_18: _ClassVar[Version]
    IR_VERSION_2019_9_19: _ClassVar[Version]
    IR_VERSION_2020_5_8: _ClassVar[Version]
    IR_VERSION_2021_7_30: _ClassVar[Version]
    IR_VERSION_2023_5_5: _ClassVar[Version]
    IR_VERSION: _ClassVar[Version]

class OperatorStatus(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
    __slots__ = []
    EXPERIMENTAL: _ClassVar[OperatorStatus]
    STABLE: _ClassVar[OperatorStatus]
_START_VERSION: Version
IR_VERSION_2017_10_10: Version
IR_VERSION_2017_10_30: Version
IR_VERSION_2017_11_3: Version
IR_VERSION_2019_1_22: Version
IR_VERSION_2019_3_18: Version
IR_VERSION_2019_9_19: Version
IR_VERSION_2020_5_8: Version
IR_VERSION_2021_7_30: Version
IR_VERSION_2023_5_5: Version
IR_VERSION: Version
EXPERIMENTAL: OperatorStatus
STABLE: OperatorStatus

class AttributeProto(_message.Message):
    __slots__ = ["name", "ref_attr_name", "doc_string", "type", "f", "i", "s", "t", "g", "sparse_tensor", "tp", "floats", "ints", "strings", "tensors", "graphs", "sparse_tensors", "type_protos"]
    class AttributeType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
        __slots__ = []
        UNDEFINED: _ClassVar[AttributeProto.AttributeType]
        FLOAT: _ClassVar[AttributeProto.AttributeType]
        INT: _ClassVar[AttributeProto.AttributeType]
        STRING: _ClassVar[AttributeProto.AttributeType]
        TENSOR: _ClassVar[AttributeProto.AttributeType]
        GRAPH: _ClassVar[AttributeProto.AttributeType]
        SPARSE_TENSOR: _ClassVar[AttributeProto.AttributeType]
        TYPE_PROTO: _ClassVar[AttributeProto.AttributeType]
        FLOATS: _ClassVar[AttributeProto.AttributeType]
        INTS: _ClassVar[AttributeProto.AttributeType]
        STRINGS: _ClassVar[AttributeProto.AttributeType]
        TENSORS: _ClassVar[AttributeProto.AttributeType]
        GRAPHS: _ClassVar[AttributeProto.AttributeType]
        SPARSE_TENSORS: _ClassVar[AttributeProto.AttributeType]
        TYPE_PROTOS: _ClassVar[AttributeProto.AttributeType]
    UNDEFINED: AttributeProto.AttributeType
    FLOAT: AttributeProto.AttributeType
    INT: AttributeProto.AttributeType
    STRING: AttributeProto.AttributeType
    TENSOR: AttributeProto.AttributeType
    GRAPH: AttributeProto.AttributeType
    SPARSE_TENSOR: AttributeProto.AttributeType
    TYPE_PROTO: AttributeProto.AttributeType
    FLOATS: AttributeProto.AttributeType
    INTS: AttributeProto.AttributeType
    STRINGS: AttributeProto.AttributeType
    TENSORS: AttributeProto.AttributeType
    GRAPHS: AttributeProto.AttributeType
    SPARSE_TENSORS: AttributeProto.AttributeType
    TYPE_PROTOS: AttributeProto.AttributeType
    NAME_FIELD_NUMBER: _ClassVar[int]
    REF_ATTR_NAME_FIELD_NUMBER: _ClassVar[int]
    DOC_STRING_FIELD_NUMBER: _ClassVar[int]
    TYPE_FIELD_NUMBER: _ClassVar[int]
    F_FIELD_NUMBER: _ClassVar[int]
    I_FIELD_NUMBER: _ClassVar[int]
    S_FIELD_NUMBER: _ClassVar[int]
    T_FIELD_NUMBER: _ClassVar[int]
    G_FIELD_NUMBER: _ClassVar[int]
    SPARSE_TENSOR_FIELD_NUMBER: _ClassVar[int]
    TP_FIELD_NUMBER: _ClassVar[int]
    FLOATS_FIELD_NUMBER: _ClassVar[int]
    INTS_FIELD_NUMBER: _ClassVar[int]
    STRINGS_FIELD_NUMBER: _ClassVar[int]
    TENSORS_FIELD_NUMBER: _ClassVar[int]
    GRAPHS_FIELD_NUMBER: _ClassVar[int]
    SPARSE_TENSORS_FIELD_NUMBER: _ClassVar[int]
    TYPE_PROTOS_FIELD_NUMBER: _ClassVar[int]
    name: str
    ref_attr_name: str
    doc_string: str
    type: AttributeProto.AttributeType
    f: float
    i: int
    s: bytes
    t: TensorProto
    g: GraphProto
    sparse_tensor: SparseTensorProto
    tp: TypeProto
    floats: _containers.RepeatedScalarFieldContainer[float]
    ints: _containers.RepeatedScalarFieldContainer[int]
    strings: _containers.RepeatedScalarFieldContainer[bytes]
    tensors: _containers.RepeatedCompositeFieldContainer[TensorProto]
    graphs: _containers.RepeatedCompositeFieldContainer[GraphProto]
    sparse_tensors: _containers.RepeatedCompositeFieldContainer[SparseTensorProto]
    type_protos: _containers.RepeatedCompositeFieldContainer[TypeProto]
    def __init__(self, name: _Optional[str] = ..., ref_attr_name: _Optional[str] = ..., doc_string: _Optional[str] = ..., type: _Optional[_Union[AttributeProto.AttributeType, str]] = ..., f: _Optional[float] = ..., i: _Optional[int] = ..., s: _Optional[bytes] = ..., t: _Optional[_Union[TensorProto, _Mapping]] = ..., g: _Optional[_Union[GraphProto, _Mapping]] = ..., sparse_tensor: _Optional[_Union[SparseTensorProto, _Mapping]] = ..., tp: _Optional[_Union[TypeProto, _Mapping]] = ..., floats: _Optional[_Iterable[float]] = ..., ints: _Optional[_Iterable[int]] = ..., strings: _Optional[_Iterable[bytes]] = ..., tensors: _Optional[_Iterable[_Union[TensorProto, _Mapping]]] = ..., graphs: _Optional[_Iterable[_Union[GraphProto, _Mapping]]] = ..., sparse_tensors: _Optional[_Iterable[_Union[SparseTensorProto, _Mapping]]] = ..., type_protos: _Optional[_Iterable[_Union[TypeProto, _Mapping]]] = ...) -> None: ...

class ValueInfoProto(_message.Message):
    __slots__ = ["name", "type", "doc_string", "metadata_props"]
    NAME_FIELD_NUMBER: _ClassVar[int]
    TYPE_FIELD_NUMBER: _ClassVar[int]
    DOC_STRING_FIELD_NUMBER: _ClassVar[int]
    METADATA_PROPS_FIELD_NUMBER: _ClassVar[int]
    name: str
    type: TypeProto
    doc_string: str
    metadata_props: _containers.RepeatedCompositeFieldContainer[StringStringEntryProto]
    def __init__(self, name: _Optional[str] = ..., type: _Optional[_Union[TypeProto, _Mapping]] = ..., doc_string: _Optional[str] = ..., metadata_props: _Optional[_Iterable[_Union[StringStringEntryProto, _Mapping]]] = ...) -> None: ...

class NodeProto(_message.Message):
    __slots__ = ["input", "output", "name", "op_type", "domain", "overload", "attribute", "doc_string", "metadata_props"]
    INPUT_FIELD_NUMBER: _ClassVar[int]
    OUTPUT_FIELD_NUMBER: _ClassVar[int]
    NAME_FIELD_NUMBER: _ClassVar[int]
    OP_TYPE_FIELD_NUMBER: _ClassVar[int]
    DOMAIN_FIELD_NUMBER: _ClassVar[int]
    OVERLOAD_FIELD_NUMBER: _ClassVar[int]
    ATTRIBUTE_FIELD_NUMBER: _ClassVar[int]
    DOC_STRING_FIELD_NUMBER: _ClassVar[int]
    METADATA_PROPS_FIELD_NUMBER: _ClassVar[int]
    input: _containers.RepeatedScalarFieldContainer[str]
    output: _containers.RepeatedScalarFieldContainer[str]
    name: str
    op_type: str
    domain: str
    overload: str
    attribute: _containers.RepeatedCompositeFieldContainer[AttributeProto]
    doc_string: str
    metadata_props: _containers.RepeatedCompositeFieldContainer[StringStringEntryProto]
    def __init__(self, input: _Optional[_Iterable[str]] = ..., output: _Optional[_Iterable[str]] = ..., name: _Optional[str] = ..., op_type: _Optional[str] = ..., domain: _Optional[str] = ..., overload: _Optional[str] = ..., attribute: _Optional[_Iterable[_Union[AttributeProto, _Mapping]]] = ..., doc_string: _Optional[str] = ..., metadata_props: _Optional[_Iterable[_Union[StringStringEntryProto, _Mapping]]] = ...) -> None: ...

class TrainingInfoProto(_message.Message):
    __slots__ = ["initialization", "algorithm", "initialization_binding", "update_binding"]
    INITIALIZATION_FIELD_NUMBER: _ClassVar[int]
    ALGORITHM_FIELD_NUMBER: _ClassVar[int]
    INITIALIZATION_BINDING_FIELD_NUMBER: _ClassVar[int]
    UPDATE_BINDING_FIELD_NUMBER: _ClassVar[int]
    initialization: GraphProto
    algorithm: GraphProto
    initialization_binding: _containers.RepeatedCompositeFieldContainer[StringStringEntryProto]
    update_binding: _containers.RepeatedCompositeFieldContainer[StringStringEntryProto]
    def __init__(self, initialization: _Optional[_Union[GraphProto, _Mapping]] = ..., algorithm: _Optional[_Union[GraphProto, _Mapping]] = ..., initialization_binding: _Optional[_Iterable[_Union[StringStringEntryProto, _Mapping]]] = ..., update_binding: _Optional[_Iterable[_Union[StringStringEntryProto, _Mapping]]] = ...) -> None: ...

class ModelProto(_message.Message):
    __slots__ = ["ir_version", "opset_import", "producer_name", "producer_version", "domain", "model_version", "doc_string", "graph", "metadata_props", "training_info", "functions"]
    IR_VERSION_FIELD_NUMBER: _ClassVar[int]
    OPSET_IMPORT_FIELD_NUMBER: _ClassVar[int]
    PRODUCER_NAME_FIELD_NUMBER: _ClassVar[int]
    PRODUCER_VERSION_FIELD_NUMBER: _ClassVar[int]
    DOMAIN_FIELD_NUMBER: _ClassVar[int]
    MODEL_VERSION_FIELD_NUMBER: _ClassVar[int]
    DOC_STRING_FIELD_NUMBER: _ClassVar[int]
    GRAPH_FIELD_NUMBER: _ClassVar[int]
    METADATA_PROPS_FIELD_NUMBER: _ClassVar[int]
    TRAINING_INFO_FIELD_NUMBER: _ClassVar[int]
    FUNCTIONS_FIELD_NUMBER: _ClassVar[int]
    ir_version: int
    opset_import: _containers.RepeatedCompositeFieldContainer[OperatorSetIdProto]
    producer_name: str
    producer_version: str
    domain: str
    model_version: int
    doc_string: str
    graph: GraphProto
    metadata_props: _containers.RepeatedCompositeFieldContainer[StringStringEntryProto]
    training_info: _containers.RepeatedCompositeFieldContainer[TrainingInfoProto]
    functions: _containers.RepeatedCompositeFieldContainer[FunctionProto]
    def __init__(self, ir_version: _Optional[int] = ..., opset_import: _Optional[_Iterable[_Union[OperatorSetIdProto, _Mapping]]] = ..., producer_name: _Optional[str] = ..., producer_version: _Optional[str] = ..., domain: _Optional[str] = ..., model_version: _Optional[int] = ..., doc_string: _Optional[str] = ..., graph: _Optional[_Union[GraphProto, _Mapping]] = ..., metadata_props: _Optional[_Iterable[_Union[StringStringEntryProto, _Mapping]]] = ..., training_info: _Optional[_Iterable[_Union[TrainingInfoProto, _Mapping]]] = ..., functions: _Optional[_Iterable[_Union[FunctionProto, _Mapping]]] = ...) -> None: ...

class StringStringEntryProto(_message.Message):
    __slots__ = ["key", "value"]
    KEY_FIELD_NUMBER: _ClassVar[int]
    VALUE_FIELD_NUMBER: _ClassVar[int]
    key: str
    value: str
    def __init__(self, key: _Optional[str] = ..., value: _Optional[str] = ...) -> None: ...

class TensorAnnotation(_message.Message):
    __slots__ = ["tensor_name", "quant_parameter_tensor_names"]
    TENSOR_NAME_FIELD_NUMBER: _ClassVar[int]
    QUANT_PARAMETER_TENSOR_NAMES_FIELD_NUMBER: _ClassVar[int]
    tensor_name: str
    quant_parameter_tensor_names: _containers.RepeatedCompositeFieldContainer[StringStringEntryProto]
    def __init__(self, tensor_name: _Optional[str] = ..., quant_parameter_tensor_names: _Optional[_Iterable[_Union[StringStringEntryProto, _Mapping]]] = ...) -> None: ...

class GraphProto(_message.Message):
    __slots__ = ["node", "name", "initializer", "sparse_initializer", "doc_string", "input", "output", "value_info", "quantization_annotation", "metadata_props"]
    NODE_FIELD_NUMBER: _ClassVar[int]
    NAME_FIELD_NUMBER: _ClassVar[int]
    INITIALIZER_FIELD_NUMBER: _ClassVar[int]
    SPARSE_INITIALIZER_FIELD_NUMBER: _ClassVar[int]
    DOC_STRING_FIELD_NUMBER: _ClassVar[int]
    INPUT_FIELD_NUMBER: _ClassVar[int]
    OUTPUT_FIELD_NUMBER: _ClassVar[int]
    VALUE_INFO_FIELD_NUMBER: _ClassVar[int]
    QUANTIZATION_ANNOTATION_FIELD_NUMBER: _ClassVar[int]
    METADATA_PROPS_FIELD_NUMBER: _ClassVar[int]
    node: _containers.RepeatedCompositeFieldContainer[NodeProto]
    name: str
    initializer: _containers.RepeatedCompositeFieldContainer[TensorProto]
    sparse_initializer: _containers.RepeatedCompositeFieldContainer[SparseTensorProto]
    doc_string: str
    input: _containers.RepeatedCompositeFieldContainer[ValueInfoProto]
    output: _containers.RepeatedCompositeFieldContainer[ValueInfoProto]
    value_info: _containers.RepeatedCompositeFieldContainer[ValueInfoProto]
    quantization_annotation: _containers.RepeatedCompositeFieldContainer[TensorAnnotation]
    metadata_props: _containers.RepeatedCompositeFieldContainer[StringStringEntryProto]
    def __init__(self, node: _Optional[_Iterable[_Union[NodeProto, _Mapping]]] = ..., name: _Optional[str] = ..., initializer: _Optional[_Iterable[_Union[TensorProto, _Mapping]]] = ..., sparse_initializer: _Optional[_Iterable[_Union[SparseTensorProto, _Mapping]]] = ..., doc_string: _Optional[str] = ..., input: _Optional[_Iterable[_Union[ValueInfoProto, _Mapping]]] = ..., output: _Optional[_Iterable[_Union[ValueInfoProto, _Mapping]]] = ..., value_info: _Optional[_Iterable[_Union[ValueInfoProto, _Mapping]]] = ..., quantization_annotation: _Optional[_Iterable[_Union[TensorAnnotation, _Mapping]]] = ..., metadata_props: _Optional[_Iterable[_Union[StringStringEntryProto, _Mapping]]] = ...) -> None: ...

class TensorProto(_message.Message):
    __slots__ = ["dims", "data_type", "segment", "float_data", "int32_data", "string_data", "int64_data", "name", "doc_string", "raw_data", "external_data", "data_location", "double_data", "uint64_data", "metadata_props"]
    class DataType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
        __slots__ = []
        UNDEFINED: _ClassVar[TensorProto.DataType]
        FLOAT: _ClassVar[TensorProto.DataType]
        UINT8: _ClassVar[TensorProto.DataType]
        INT8: _ClassVar[TensorProto.DataType]
        UINT16: _ClassVar[TensorProto.DataType]
        INT16: _ClassVar[TensorProto.DataType]
        INT32: _ClassVar[TensorProto.DataType]
        INT64: _ClassVar[TensorProto.DataType]
        STRING: _ClassVar[TensorProto.DataType]
        BOOL: _ClassVar[TensorProto.DataType]
        FLOAT16: _ClassVar[TensorProto.DataType]
        DOUBLE: _ClassVar[TensorProto.DataType]
        UINT32: _ClassVar[TensorProto.DataType]
        UINT64: _ClassVar[TensorProto.DataType]
        COMPLEX64: _ClassVar[TensorProto.DataType]
        COMPLEX128: _ClassVar[TensorProto.DataType]
        BFLOAT16: _ClassVar[TensorProto.DataType]
        FLOAT8E4M3FN: _ClassVar[TensorProto.DataType]
        FLOAT8E4M3FNUZ: _ClassVar[TensorProto.DataType]
        FLOAT8E5M2: _ClassVar[TensorProto.DataType]
        FLOAT8E5M2FNUZ: _ClassVar[TensorProto.DataType]
        UINT4: _ClassVar[TensorProto.DataType]
        INT4: _ClassVar[TensorProto.DataType]
    UNDEFINED: TensorProto.DataType
    FLOAT: TensorProto.DataType
    UINT8: TensorProto.DataType
    INT8: TensorProto.DataType
    UINT16: TensorProto.DataType
    INT16: TensorProto.DataType
    INT32: TensorProto.DataType
    INT64: TensorProto.DataType
    STRING: TensorProto.DataType
    BOOL: TensorProto.DataType
    FLOAT16: TensorProto.DataType
    DOUBLE: TensorProto.DataType
    UINT32: TensorProto.DataType
    UINT64: TensorProto.DataType
    COMPLEX64: TensorProto.DataType
    COMPLEX128: TensorProto.DataType
    BFLOAT16: TensorProto.DataType
    FLOAT8E4M3FN: TensorProto.DataType
    FLOAT8E4M3FNUZ: TensorProto.DataType
    FLOAT8E5M2: TensorProto.DataType
    FLOAT8E5M2FNUZ: TensorProto.DataType
    UINT4: TensorProto.DataType
    INT4: TensorProto.DataType
    class DataLocation(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
        __slots__ = []
        DEFAULT: _ClassVar[TensorProto.DataLocation]
        EXTERNAL: _ClassVar[TensorProto.DataLocation]
    DEFAULT: TensorProto.DataLocation
    EXTERNAL: TensorProto.DataLocation
    class Segment(_message.Message):
        __slots__ = ["begin", "end"]
        BEGIN_FIELD_NUMBER: _ClassVar[int]
        END_FIELD_NUMBER: _ClassVar[int]
        begin: int
        end: int
        def __init__(self, begin: _Optional[int] = ..., end: _Optional[int] = ...) -> None: ...
    DIMS_FIELD_NUMBER: _ClassVar[int]
    DATA_TYPE_FIELD_NUMBER: _ClassVar[int]
    SEGMENT_FIELD_NUMBER: _ClassVar[int]
    FLOAT_DATA_FIELD_NUMBER: _ClassVar[int]
    INT32_DATA_FIELD_NUMBER: _ClassVar[int]
    STRING_DATA_FIELD_NUMBER: _ClassVar[int]
    INT64_DATA_FIELD_NUMBER: _ClassVar[int]
    NAME_FIELD_NUMBER: _ClassVar[int]
    DOC_STRING_FIELD_NUMBER: _ClassVar[int]
    RAW_DATA_FIELD_NUMBER: _ClassVar[int]
    EXTERNAL_DATA_FIELD_NUMBER: _ClassVar[int]
    DATA_LOCATION_FIELD_NUMBER: _ClassVar[int]
    DOUBLE_DATA_FIELD_NUMBER: _ClassVar[int]
    UINT64_DATA_FIELD_NUMBER: _ClassVar[int]
    METADATA_PROPS_FIELD_NUMBER: _ClassVar[int]
    dims: _containers.RepeatedScalarFieldContainer[int]
    data_type: int
    segment: TensorProto.Segment
    float_data: _containers.RepeatedScalarFieldContainer[float]
    int32_data: _containers.RepeatedScalarFieldContainer[int]
    string_data: _containers.RepeatedScalarFieldContainer[bytes]
    int64_data: _containers.RepeatedScalarFieldContainer[int]
    name: str
    doc_string: str
    raw_data: bytes
    external_data: _containers.RepeatedCompositeFieldContainer[StringStringEntryProto]
    data_location: TensorProto.DataLocation
    double_data: _containers.RepeatedScalarFieldContainer[float]
    uint64_data: _containers.RepeatedScalarFieldContainer[int]
    metadata_props: _containers.RepeatedCompositeFieldContainer[StringStringEntryProto]
    def __init__(self, dims: _Optional[_Iterable[int]] = ..., data_type: _Optional[int] = ..., segment: _Optional[_Union[TensorProto.Segment, _Mapping]] = ..., float_data: _Optional[_Iterable[float]] = ..., int32_data: _Optional[_Iterable[int]] = ..., string_data: _Optional[_Iterable[bytes]] = ..., int64_data: _Optional[_Iterable[int]] = ..., name: _Optional[str] = ..., doc_string: _Optional[str] = ..., raw_data: _Optional[bytes] = ..., external_data: _Optional[_Iterable[_Union[StringStringEntryProto, _Mapping]]] = ..., data_location: _Optional[_Union[TensorProto.DataLocation, str]] = ..., double_data: _Optional[_Iterable[float]] = ..., uint64_data: _Optional[_Iterable[int]] = ..., metadata_props: _Optional[_Iterable[_Union[StringStringEntryProto, _Mapping]]] = ...) -> None: ...

class SparseTensorProto(_message.Message):
    __slots__ = ["values", "indices", "dims"]
    VALUES_FIELD_NUMBER: _ClassVar[int]
    INDICES_FIELD_NUMBER: _ClassVar[int]
    DIMS_FIELD_NUMBER: _ClassVar[int]
    values: TensorProto
    indices: TensorProto
    dims: _containers.RepeatedScalarFieldContainer[int]
    def __init__(self, values: _Optional[_Union[TensorProto, _Mapping]] = ..., indices: _Optional[_Union[TensorProto, _Mapping]] = ..., dims: _Optional[_Iterable[int]] = ...) -> None: ...

class TensorShapeProto(_message.Message):
    __slots__ = ["dim"]
    class Dimension(_message.Message):
        __slots__ = ["dim_value", "dim_param", "denotation"]
        DIM_VALUE_FIELD_NUMBER: _ClassVar[int]
        DIM_PARAM_FIELD_NUMBER: _ClassVar[int]
        DENOTATION_FIELD_NUMBER: _ClassVar[int]
        dim_value: int
        dim_param: str
        denotation: str
        def __init__(self, dim_value: _Optional[int] = ..., dim_param: _Optional[str] = ..., denotation: _Optional[str] = ...) -> None: ...
    DIM_FIELD_NUMBER: _ClassVar[int]
    dim: _containers.RepeatedCompositeFieldContainer[TensorShapeProto.Dimension]
    def __init__(self, dim: _Optional[_Iterable[_Union[TensorShapeProto.Dimension, _Mapping]]] = ...) -> None: ...

class TypeProto(_message.Message):
    __slots__ = ["tensor_type", "sequence_type", "map_type", "optional_type", "sparse_tensor_type", "opaque_type", "denotation"]
    class Tensor(_message.Message):
        __slots__ = ["elem_type", "shape"]
        ELEM_TYPE_FIELD_NUMBER: _ClassVar[int]
        SHAPE_FIELD_NUMBER: _ClassVar[int]
        elem_type: int
        shape: TensorShapeProto
        def __init__(self, elem_type: _Optional[int] = ..., shape: _Optional[_Union[TensorShapeProto, _Mapping]] = ...) -> None: ...
    class Sequence(_message.Message):
        __slots__ = ["elem_type"]
        ELEM_TYPE_FIELD_NUMBER: _ClassVar[int]
        elem_type: TypeProto
        def __init__(self, elem_type: _Optional[_Union[TypeProto, _Mapping]] = ...) -> None: ...
    class Map(_message.Message):
        __slots__ = ["key_type", "value_type"]
        KEY_TYPE_FIELD_NUMBER: _ClassVar[int]
        VALUE_TYPE_FIELD_NUMBER: _ClassVar[int]
        key_type: int
        value_type: TypeProto
        def __init__(self, key_type: _Optional[int] = ..., value_type: _Optional[_Union[TypeProto, _Mapping]] = ...) -> None: ...
    class Optional(_message.Message):
        __slots__ = ["elem_type"]
        ELEM_TYPE_FIELD_NUMBER: _ClassVar[int]
        elem_type: TypeProto
        def __init__(self, elem_type: _Optional[_Union[TypeProto, _Mapping]] = ...) -> None: ...
    class SparseTensor(_message.Message):
        __slots__ = ["elem_type", "shape"]
        ELEM_TYPE_FIELD_NUMBER: _ClassVar[int]
        SHAPE_FIELD_NUMBER: _ClassVar[int]
        elem_type: int
        shape: TensorShapeProto
        def __init__(self, elem_type: _Optional[int] = ..., shape: _Optional[_Union[TensorShapeProto, _Mapping]] = ...) -> None: ...
    class Opaque(_message.Message):
        __slots__ = ["domain", "name"]
        DOMAIN_FIELD_NUMBER: _ClassVar[int]
        NAME_FIELD_NUMBER: _ClassVar[int]
        domain: str
        name: str
        def __init__(self, domain: _Optional[str] = ..., name: _Optional[str] = ...) -> None: ...
    TENSOR_TYPE_FIELD_NUMBER: _ClassVar[int]
    SEQUENCE_TYPE_FIELD_NUMBER: _ClassVar[int]
    MAP_TYPE_FIELD_NUMBER: _ClassVar[int]
    OPTIONAL_TYPE_FIELD_NUMBER: _ClassVar[int]
    SPARSE_TENSOR_TYPE_FIELD_NUMBER: _ClassVar[int]
    OPAQUE_TYPE_FIELD_NUMBER: _ClassVar[int]
    DENOTATION_FIELD_NUMBER: _ClassVar[int]
    tensor_type: TypeProto.Tensor
    sequence_type: TypeProto.Sequence
    map_type: TypeProto.Map
    optional_type: TypeProto.Optional
    sparse_tensor_type: TypeProto.SparseTensor
    opaque_type: TypeProto.Opaque
    denotation: str
    def __init__(self, tensor_type: _Optional[_Union[TypeProto.Tensor, _Mapping]] = ..., sequence_type: _Optional[_Union[TypeProto.Sequence, _Mapping]] = ..., map_type: _Optional[_Union[TypeProto.Map, _Mapping]] = ..., optional_type: _Optional[_Union[TypeProto.Optional, _Mapping]] = ..., sparse_tensor_type: _Optional[_Union[TypeProto.SparseTensor, _Mapping]] = ..., opaque_type: _Optional[_Union[TypeProto.Opaque, _Mapping]] = ..., denotation: _Optional[str] = ...) -> None: ...

class OperatorSetIdProto(_message.Message):
    __slots__ = ["domain", "version"]
    DOMAIN_FIELD_NUMBER: _ClassVar[int]
    VERSION_FIELD_NUMBER: _ClassVar[int]
    domain: str
    version: int
    def __init__(self, domain: _Optional[str] = ..., version: _Optional[int] = ...) -> None: ...

class FunctionProto(_message.Message):
    __slots__ = ["name", "input", "output", "attribute", "attribute_proto", "node", "doc_string", "opset_import", "domain", "overload", "value_info", "metadata_props"]
    NAME_FIELD_NUMBER: _ClassVar[int]
    INPUT_FIELD_NUMBER: _ClassVar[int]
    OUTPUT_FIELD_NUMBER: _ClassVar[int]
    ATTRIBUTE_FIELD_NUMBER: _ClassVar[int]
    ATTRIBUTE_PROTO_FIELD_NUMBER: _ClassVar[int]
    NODE_FIELD_NUMBER: _ClassVar[int]
    DOC_STRING_FIELD_NUMBER: _ClassVar[int]
    OPSET_IMPORT_FIELD_NUMBER: _ClassVar[int]
    DOMAIN_FIELD_NUMBER: _ClassVar[int]
    OVERLOAD_FIELD_NUMBER: _ClassVar[int]
    VALUE_INFO_FIELD_NUMBER: _ClassVar[int]
    METADATA_PROPS_FIELD_NUMBER: _ClassVar[int]
    name: str
    input: _containers.RepeatedScalarFieldContainer[str]
    output: _containers.RepeatedScalarFieldContainer[str]
    attribute: _containers.RepeatedScalarFieldContainer[str]
    attribute_proto: _containers.RepeatedCompositeFieldContainer[AttributeProto]
    node: _containers.RepeatedCompositeFieldContainer[NodeProto]
    doc_string: str
    opset_import: _containers.RepeatedCompositeFieldContainer[OperatorSetIdProto]
    domain: str
    overload: str
    value_info: _containers.RepeatedCompositeFieldContainer[ValueInfoProto]
    metadata_props: _containers.RepeatedCompositeFieldContainer[StringStringEntryProto]
    def __init__(self, name: _Optional[str] = ..., input: _Optional[_Iterable[str]] = ..., output: _Optional[_Iterable[str]] = ..., attribute: _Optional[_Iterable[str]] = ..., attribute_proto: _Optional[_Iterable[_Union[AttributeProto, _Mapping]]] = ..., node: _Optional[_Iterable[_Union[NodeProto, _Mapping]]] = ..., doc_string: _Optional[str] = ..., opset_import: _Optional[_Iterable[_Union[OperatorSetIdProto, _Mapping]]] = ..., domain: _Optional[str] = ..., overload: _Optional[str] = ..., value_info: _Optional[_Iterable[_Union[ValueInfoProto, _Mapping]]] = ..., metadata_props: _Optional[_Iterable[_Union[StringStringEntryProto, _Mapping]]] = ...) -> None: ...

@justinchuby
Copy link
Contributor

vs before

# @generated by protoc-gen-mypy.py.  Do not edit!
# mypy: disable-error-code=override
from typing import (
    Iterable,
    List,
    Optional as OptionalType,
    Tuple,
    cast,
)

from google.protobuf.message import (  # type: ignore
    Message,
)

from google.protobuf.internal.containers import (  # type: ignore
    RepeatedCompositeFieldContainer,
    RepeatedScalarFieldContainer,
)

class Version(int):
    @classmethod
    def Name(cls, number: int) -> str: ...
    @classmethod
    def Value(cls, name: str) -> int: ...
    @classmethod
    def keys(cls) -> List[str]: ...
    @classmethod
    def values(cls) -> List[int]: ...
    @classmethod
    def items(cls) -> List[Tuple[str, int]]: ...
_START_VERSION = cast(Version, 0)
IR_VERSION_2017_10_10 = cast(Version, 1)
IR_VERSION_2017_10_30 = cast(Version, 2)
IR_VERSION_2017_11_3 = cast(Version, 3)
IR_VERSION_2019_1_22 = cast(Version, 4)
IR_VERSION_2019_3_18 = cast(Version, 5)
IR_VERSION_2019_9_19 = cast(Version, 6)
IR_VERSION_2020_5_8 = cast(Version, 7)
IR_VERSION_2021_7_30 = cast(Version, 8)
IR_VERSION_2023_5_5 = cast(Version, 9)
IR_VERSION = cast(Version, 10)

class OperatorStatus(int):
    @classmethod
    def Name(cls, number: int) -> str: ...
    @classmethod
    def Value(cls, name: str) -> int: ...
    @classmethod
    def keys(cls) -> List[str]: ...
    @classmethod
    def values(cls) -> List[int]: ...
    @classmethod
    def items(cls) -> List[Tuple[str, int]]: ...
EXPERIMENTAL = cast(OperatorStatus, 0)
STABLE = cast(OperatorStatus, 1)

class AttributeProto(Message):
    class AttributeType(int):
        @classmethod
        def Name(cls, number: int) -> str: ...
        @classmethod
        def Value(cls, name: str) -> int: ...
        @classmethod
        def keys(cls) -> List[str]: ...
        @classmethod
        def values(cls) -> List[int]: ...
        @classmethod
        def items(cls) -> List[Tuple[str, int]]: ...
    UNDEFINED = cast(AttributeType, 0)
    FLOAT = cast(AttributeType, 1)
    INT = cast(AttributeType, 2)
    STRING = cast(AttributeType, 3)
    TENSOR = cast(AttributeType, 4)
    GRAPH = cast(AttributeType, 5)
    SPARSE_TENSOR = cast(AttributeType, 11)
    TYPE_PROTO = cast(AttributeType, 13)
    FLOATS = cast(AttributeType, 6)
    INTS = cast(AttributeType, 7)
    STRINGS = cast(AttributeType, 8)
    TENSORS = cast(AttributeType, 9)
    GRAPHS = cast(AttributeType, 10)
    SPARSE_TENSORS = cast(AttributeType, 12)
    TYPE_PROTOS = cast(AttributeType, 14)
    
    name = ... # type: str
    ref_attr_name = ... # type: str
    doc_string = ... # type: str
    type = ... # type: AttributeProto.AttributeType
    f = ... # type: float
    i = ... # type: int
    s = ... # type: bytes
    floats = ... # type: RepeatedScalarFieldContainer[float]
    ints = ... # type: RepeatedScalarFieldContainer[int]
    strings = ... # type: RepeatedScalarFieldContainer[bytes]
    
    @property
    def t(self) -> TensorProto: ...
    
    @property
    def g(self) -> GraphProto: ...
    
    @property
    def sparse_tensor(self) -> SparseTensorProto: ...
    
    @property
    def tp(self) -> TypeProto: ...
    
    @property
    def tensors(self) -> RepeatedCompositeFieldContainer[TensorProto]: ...
    
    @property
    def graphs(self) -> RepeatedCompositeFieldContainer[GraphProto]: ...
    
    @property
    def sparse_tensors(self) -> RepeatedCompositeFieldContainer[SparseTensorProto]: ...
    
    @property
    def type_protos(self) -> RepeatedCompositeFieldContainer[TypeProto]: ...
    
    def __init__(self,
        name : OptionalType[str] = None,
        ref_attr_name : OptionalType[str] = None,
        doc_string : OptionalType[str] = None,
        type : OptionalType[AttributeProto.AttributeType] = None,
        f : OptionalType[float] = None,
        i : OptionalType[int] = None,
        s : OptionalType[bytes] = None,
        t : OptionalType[TensorProto] = None,
        g : OptionalType[GraphProto] = None,
        sparse_tensor : OptionalType[SparseTensorProto] = None,
        tp : OptionalType[TypeProto] = None,
        floats : OptionalType[Iterable[float]] = None,
        ints : OptionalType[Iterable[int]] = None,
        strings : OptionalType[Iterable[bytes]] = None,
        tensors : OptionalType[Iterable[TensorProto]] = None,
        graphs : OptionalType[Iterable[GraphProto]] = None,
        sparse_tensors : OptionalType[Iterable[SparseTensorProto]] = None,
        type_protos : OptionalType[Iterable[TypeProto]] = None,
        ) -> None: ...
    @classmethod
    def FromString(cls, s: bytes) -> AttributeProto: ...
    def MergeFrom(self, other_msg: Message) -> None: ...
    def CopyFrom(self, other_msg: Message) -> None: ...

class ValueInfoProto(Message):
    name = ... # type: str
    doc_string = ... # type: str
    
    @property
    def type(self) -> TypeProto: ...
    
    @property
    def metadata_props(self) -> RepeatedCompositeFieldContainer[StringStringEntryProto]: ...
    
    def __init__(self,
        name : OptionalType[str] = None,
        type : OptionalType[TypeProto] = None,
        doc_string : OptionalType[str] = None,
        metadata_props : OptionalType[Iterable[StringStringEntryProto]] = None,
        ) -> None: ...
    @classmethod
    def FromString(cls, s: bytes) -> ValueInfoProto: ...
    def MergeFrom(self, other_msg: Message) -> None: ...
    def CopyFrom(self, other_msg: Message) -> None: ...

class NodeProto(Message):
    input = ... # type: RepeatedScalarFieldContainer[str]
    output = ... # type: RepeatedScalarFieldContainer[str]
    name = ... # type: str
    op_type = ... # type: str
    domain = ... # type: str
    overload = ... # type: str
    doc_string = ... # type: str
    
    @property
    def attribute(self) -> RepeatedCompositeFieldContainer[AttributeProto]: ...
    
    @property
    def metadata_props(self) -> RepeatedCompositeFieldContainer[StringStringEntryProto]: ...
    
    def __init__(self,
        input : OptionalType[Iterable[str]] = None,
        output : OptionalType[Iterable[str]] = None,
        name : OptionalType[str] = None,
        op_type : OptionalType[str] = None,
        domain : OptionalType[str] = None,
        overload : OptionalType[str] = None,
        attribute : OptionalType[Iterable[AttributeProto]] = None,
        doc_string : OptionalType[str] = None,
        metadata_props : OptionalType[Iterable[StringStringEntryProto]] = None,
        ) -> None: ...
    @classmethod
    def FromString(cls, s: bytes) -> NodeProto: ...
    def MergeFrom(self, other_msg: Message) -> None: ...
    def CopyFrom(self, other_msg: Message) -> None: ...

class TrainingInfoProto(Message):
    
    @property
    def initialization(self) -> GraphProto: ...
    
    @property
    def algorithm(self) -> GraphProto: ...
    
    @property
    def initialization_binding(self) -> RepeatedCompositeFieldContainer[StringStringEntryProto]: ...
    
    @property
    def update_binding(self) -> RepeatedCompositeFieldContainer[StringStringEntryProto]: ...
    
    def __init__(self,
        initialization : OptionalType[GraphProto] = None,
        algorithm : OptionalType[GraphProto] = None,
        initialization_binding : OptionalType[Iterable[StringStringEntryProto]] = None,
        update_binding : OptionalType[Iterable[StringStringEntryProto]] = None,
        ) -> None: ...
    @classmethod
    def FromString(cls, s: bytes) -> TrainingInfoProto: ...
    def MergeFrom(self, other_msg: Message) -> None: ...
    def CopyFrom(self, other_msg: Message) -> None: ...

class ModelProto(Message):
    ir_version = ... # type: int
    producer_name = ... # type: str
    producer_version = ... # type: str
    domain = ... # type: str
    model_version = ... # type: int
    doc_string = ... # type: str
    
    @property
    def opset_import(self) -> RepeatedCompositeFieldContainer[OperatorSetIdProto]: ...
    
    @property
    def graph(self) -> GraphProto: ...
    
    @property
    def metadata_props(self) -> RepeatedCompositeFieldContainer[StringStringEntryProto]: ...
    
    @property
    def training_info(self) -> RepeatedCompositeFieldContainer[TrainingInfoProto]: ...
    
    @property
    def functions(self) -> RepeatedCompositeFieldContainer[FunctionProto]: ...
    
    def __init__(self,
        ir_version : OptionalType[int] = None,
        opset_import : OptionalType[Iterable[OperatorSetIdProto]] = None,
        producer_name : OptionalType[str] = None,
        producer_version : OptionalType[str] = None,
        domain : OptionalType[str] = None,
        model_version : OptionalType[int] = None,
        doc_string : OptionalType[str] = None,
        graph : OptionalType[GraphProto] = None,
        metadata_props : OptionalType[Iterable[StringStringEntryProto]] = None,
        training_info : OptionalType[Iterable[TrainingInfoProto]] = None,
        functions : OptionalType[Iterable[FunctionProto]] = None,
        ) -> None: ...
    @classmethod
    def FromString(cls, s: bytes) -> ModelProto: ...
    def MergeFrom(self, other_msg: Message) -> None: ...
    def CopyFrom(self, other_msg: Message) -> None: ...

class StringStringEntryProto(Message):
    key = ... # type: str
    value = ... # type: str
    
    def __init__(self,
        key : OptionalType[str] = None,
        value : OptionalType[str] = None,
        ) -> None: ...
    @classmethod
    def FromString(cls, s: bytes) -> StringStringEntryProto: ...
    def MergeFrom(self, other_msg: Message) -> None: ...
    def CopyFrom(self, other_msg: Message) -> None: ...

class TensorAnnotation(Message):
    tensor_name = ... # type: str
    
    @property
    def quant_parameter_tensor_names(self) -> RepeatedCompositeFieldContainer[StringStringEntryProto]: ...
    
    def __init__(self,
        tensor_name : OptionalType[str] = None,
        quant_parameter_tensor_names : OptionalType[Iterable[StringStringEntryProto]] = None,
        ) -> None: ...
    @classmethod
    def FromString(cls, s: bytes) -> TensorAnnotation: ...
    def MergeFrom(self, other_msg: Message) -> None: ...
    def CopyFrom(self, other_msg: Message) -> None: ...

class GraphProto(Message):
    name = ... # type: str
    doc_string = ... # type: str
    
    @property
    def node(self) -> RepeatedCompositeFieldContainer[NodeProto]: ...
    
    @property
    def initializer(self) -> RepeatedCompositeFieldContainer[TensorProto]: ...
    
    @property
    def sparse_initializer(self) -> RepeatedCompositeFieldContainer[SparseTensorProto]: ...
    
    @property
    def input(self) -> RepeatedCompositeFieldContainer[ValueInfoProto]: ...
    
    @property
    def output(self) -> RepeatedCompositeFieldContainer[ValueInfoProto]: ...
    
    @property
    def value_info(self) -> RepeatedCompositeFieldContainer[ValueInfoProto]: ...
    
    @property
    def quantization_annotation(self) -> RepeatedCompositeFieldContainer[TensorAnnotation]: ...
    
    @property
    def metadata_props(self) -> RepeatedCompositeFieldContainer[StringStringEntryProto]: ...
    
    def __init__(self,
        node : OptionalType[Iterable[NodeProto]] = None,
        name : OptionalType[str] = None,
        initializer : OptionalType[Iterable[TensorProto]] = None,
        sparse_initializer : OptionalType[Iterable[SparseTensorProto]] = None,
        doc_string : OptionalType[str] = None,
        input : OptionalType[Iterable[ValueInfoProto]] = None,
        output : OptionalType[Iterable[ValueInfoProto]] = None,
        value_info : OptionalType[Iterable[ValueInfoProto]] = None,
        quantization_annotation : OptionalType[Iterable[TensorAnnotation]] = None,
        metadata_props : OptionalType[Iterable[StringStringEntryProto]] = None,
        ) -> None: ...
    @classmethod
    def FromString(cls, s: bytes) -> GraphProto: ...
    def MergeFrom(self, other_msg: Message) -> None: ...
    def CopyFrom(self, other_msg: Message) -> None: ...

class TensorProto(Message):
    class DataType(int):
        @classmethod
        def Name(cls, number: int) -> str: ...
        @classmethod
        def Value(cls, name: str) -> int: ...
        @classmethod
        def keys(cls) -> List[str]: ...
        @classmethod
        def values(cls) -> List[int]: ...
        @classmethod
        def items(cls) -> List[Tuple[str, int]]: ...
    UNDEFINED = cast(DataType, 0)
    FLOAT = cast(DataType, 1)
    UINT8 = cast(DataType, 2)
    INT8 = cast(DataType, 3)
    UINT16 = cast(DataType, 4)
    INT16 = cast(DataType, 5)
    INT32 = cast(DataType, 6)
    INT64 = cast(DataType, 7)
    STRING = cast(DataType, 8)
    BOOL = cast(DataType, 9)
    FLOAT16 = cast(DataType, 10)
    DOUBLE = cast(DataType, 11)
    UINT32 = cast(DataType, 12)
    UINT64 = cast(DataType, 13)
    COMPLEX64 = cast(DataType, 14)
    COMPLEX128 = cast(DataType, 15)
    BFLOAT16 = cast(DataType, 16)
    FLOAT8E4M3FN = cast(DataType, 17)
    FLOAT8E4M3FNUZ = cast(DataType, 18)
    FLOAT8E5M2 = cast(DataType, 19)
    FLOAT8E5M2FNUZ = cast(DataType, 20)
    UINT4 = cast(DataType, 21)
    INT4 = cast(DataType, 22)
    
    class DataLocation(int):
        @classmethod
        def Name(cls, number: int) -> str: ...
        @classmethod
        def Value(cls, name: str) -> int: ...
        @classmethod
        def keys(cls) -> List[str]: ...
        @classmethod
        def values(cls) -> List[int]: ...
        @classmethod
        def items(cls) -> List[Tuple[str, int]]: ...
    DEFAULT = cast(DataLocation, 0)
    EXTERNAL = cast(DataLocation, 1)
    
    class Segment(Message):
        begin = ... # type: int
        end = ... # type: int
        
        def __init__(self,
            begin : OptionalType[int] = None,
            end : OptionalType[int] = None,
            ) -> None: ...
        @classmethod
        def FromString(cls, s: bytes) -> TensorProto.Segment: ...
        def MergeFrom(self, other_msg: Message) -> None: ...
        def CopyFrom(self, other_msg: Message) -> None: ...
    
    dims = ... # type: RepeatedScalarFieldContainer[int]
    data_type = ... # type: int
    float_data = ... # type: RepeatedScalarFieldContainer[float]
    int32_data = ... # type: RepeatedScalarFieldContainer[int]
    string_data = ... # type: RepeatedScalarFieldContainer[bytes]
    int64_data = ... # type: RepeatedScalarFieldContainer[int]
    name = ... # type: str
    doc_string = ... # type: str
    raw_data = ... # type: bytes
    data_location = ... # type: TensorProto.DataLocation
    double_data = ... # type: RepeatedScalarFieldContainer[float]
    uint64_data = ... # type: RepeatedScalarFieldContainer[int]
    
    @property
    def segment(self) -> TensorProto.Segment: ...
    
    @property
    def external_data(self) -> RepeatedCompositeFieldContainer[StringStringEntryProto]: ...
    
    @property
    def metadata_props(self) -> RepeatedCompositeFieldContainer[StringStringEntryProto]: ...
    
    def __init__(self,
        dims : OptionalType[Iterable[int]] = None,
        data_type : OptionalType[int] = None,
        segment : OptionalType[TensorProto.Segment] = None,
        float_data : OptionalType[Iterable[float]] = None,
        int32_data : OptionalType[Iterable[int]] = None,
        string_data : OptionalType[Iterable[bytes]] = None,
        int64_data : OptionalType[Iterable[int]] = None,
        name : OptionalType[str] = None,
        doc_string : OptionalType[str] = None,
        raw_data : OptionalType[bytes] = None,
        external_data : OptionalType[Iterable[StringStringEntryProto]] = None,
        data_location : OptionalType[TensorProto.DataLocation] = None,
        double_data : OptionalType[Iterable[float]] = None,
        uint64_data : OptionalType[Iterable[int]] = None,
        metadata_props : OptionalType[Iterable[StringStringEntryProto]] = None,
        ) -> None: ...
    @classmethod
    def FromString(cls, s: bytes) -> TensorProto: ...
    def MergeFrom(self, other_msg: Message) -> None: ...
    def CopyFrom(self, other_msg: Message) -> None: ...

class SparseTensorProto(Message):
    dims = ... # type: RepeatedScalarFieldContainer[int]
    
    @property
    def values(self) -> TensorProto: ...
    
    @property
    def indices(self) -> TensorProto: ...
    
    def __init__(self,
        values : OptionalType[TensorProto] = None,
        indices : OptionalType[TensorProto] = None,
        dims : OptionalType[Iterable[int]] = None,
        ) -> None: ...
    @classmethod
    def FromString(cls, s: bytes) -> SparseTensorProto: ...
    def MergeFrom(self, other_msg: Message) -> None: ...
    def CopyFrom(self, other_msg: Message) -> None: ...

class TensorShapeProto(Message):
    class Dimension(Message):
        dim_value = ... # type: int
        dim_param = ... # type: str
        denotation = ... # type: str
        
        def __init__(self,
            dim_value : OptionalType[int] = None,
            dim_param : OptionalType[str] = None,
            denotation : OptionalType[str] = None,
            ) -> None: ...
        @classmethod
        def FromString(cls, s: bytes) -> TensorShapeProto.Dimension: ...
        def MergeFrom(self, other_msg: Message) -> None: ...
        def CopyFrom(self, other_msg: Message) -> None: ...
    
    
    @property
    def dim(self) -> RepeatedCompositeFieldContainer[TensorShapeProto.Dimension]: ...
    
    def __init__(self,
        dim : OptionalType[Iterable[TensorShapeProto.Dimension]] = None,
        ) -> None: ...
    @classmethod
    def FromString(cls, s: bytes) -> TensorShapeProto: ...
    def MergeFrom(self, other_msg: Message) -> None: ...
    def CopyFrom(self, other_msg: Message) -> None: ...

class TypeProto(Message):
    class Tensor(Message):
        elem_type = ... # type: int
        
        @property
        def shape(self) -> TensorShapeProto: ...
        
        def __init__(self,
            elem_type : OptionalType[int] = None,
            shape : OptionalType[TensorShapeProto] = None,
            ) -> None: ...
        @classmethod
        def FromString(cls, s: bytes) -> TypeProto.Tensor: ...
        def MergeFrom(self, other_msg: Message) -> None: ...
        def CopyFrom(self, other_msg: Message) -> None: ...
    
    class Sequence(Message):
        
        @property
        def elem_type(self) -> TypeProto: ...
        
        def __init__(self,
            elem_type : OptionalType[TypeProto] = None,
            ) -> None: ...
        @classmethod
        def FromString(cls, s: bytes) -> TypeProto.Sequence: ...
        def MergeFrom(self, other_msg: Message) -> None: ...
        def CopyFrom(self, other_msg: Message) -> None: ...
    
    class Map(Message):
        key_type = ... # type: int
        
        @property
        def value_type(self) -> TypeProto: ...
        
        def __init__(self,
            key_type : OptionalType[int] = None,
            value_type : OptionalType[TypeProto] = None,
            ) -> None: ...
        @classmethod
        def FromString(cls, s: bytes) -> TypeProto.Map: ...
        def MergeFrom(self, other_msg: Message) -> None: ...
        def CopyFrom(self, other_msg: Message) -> None: ...
    
    class Optional(Message):
        
        @property
        def elem_type(self) -> TypeProto: ...
        
        def __init__(self,
            elem_type : OptionalType[TypeProto] = None,
            ) -> None: ...
        @classmethod
        def FromString(cls, s: bytes) -> TypeProto.Optional: ...
        def MergeFrom(self, other_msg: Message) -> None: ...
        def CopyFrom(self, other_msg: Message) -> None: ...
    
    class SparseTensor(Message):
        elem_type = ... # type: int
        
        @property
        def shape(self) -> TensorShapeProto: ...
        
        def __init__(self,
            elem_type : OptionalType[int] = None,
            shape : OptionalType[TensorShapeProto] = None,
            ) -> None: ...
        @classmethod
        def FromString(cls, s: bytes) -> TypeProto.SparseTensor: ...
        def MergeFrom(self, other_msg: Message) -> None: ...
        def CopyFrom(self, other_msg: Message) -> None: ...
    
    class Opaque(Message):
        domain = ... # type: str
        name = ... # type: str
        
        def __init__(self,
            domain : OptionalType[str] = None,
            name : OptionalType[str] = None,
            ) -> None: ...
        @classmethod
        def FromString(cls, s: bytes) -> TypeProto.Opaque: ...
        def MergeFrom(self, other_msg: Message) -> None: ...
        def CopyFrom(self, other_msg: Message) -> None: ...
    
    denotation = ... # type: str
    
    @property
    def tensor_type(self) -> TypeProto.Tensor: ...
    
    @property
    def sequence_type(self) -> TypeProto.Sequence: ...
    
    @property
    def map_type(self) -> TypeProto.Map: ...
    
    @property
    def optional_type(self) -> TypeProto.Optional: ...
    
    @property
    def sparse_tensor_type(self) -> TypeProto.SparseTensor: ...
    
    @property
    def opaque_type(self) -> TypeProto.Opaque: ...
    
    def __init__(self,
        tensor_type : OptionalType[TypeProto.Tensor] = None,
        sequence_type : OptionalType[TypeProto.Sequence] = None,
        map_type : OptionalType[TypeProto.Map] = None,
        optional_type : OptionalType[TypeProto.Optional] = None,
        sparse_tensor_type : OptionalType[TypeProto.SparseTensor] = None,
        opaque_type : OptionalType[TypeProto.Opaque] = None,
        denotation : OptionalType[str] = None,
        ) -> None: ...
    @classmethod
    def FromString(cls, s: bytes) -> TypeProto: ...
    def MergeFrom(self, other_msg: Message) -> None: ...
    def CopyFrom(self, other_msg: Message) -> None: ...

class OperatorSetIdProto(Message):
    domain = ... # type: str
    version = ... # type: int
    
    def __init__(self,
        domain : OptionalType[str] = None,
        version : OptionalType[int] = None,
        ) -> None: ...
    @classmethod
    def FromString(cls, s: bytes) -> OperatorSetIdProto: ...
    def MergeFrom(self, other_msg: Message) -> None: ...
    def CopyFrom(self, other_msg: Message) -> None: ...

class FunctionProto(Message):
    name = ... # type: str
    input = ... # type: RepeatedScalarFieldContainer[str]
    output = ... # type: RepeatedScalarFieldContainer[str]
    attribute = ... # type: RepeatedScalarFieldContainer[str]
    doc_string = ... # type: str
    domain = ... # type: str
    overload = ... # type: str
    
    @property
    def attribute_proto(self) -> RepeatedCompositeFieldContainer[AttributeProto]: ...
    
    @property
    def node(self) -> RepeatedCompositeFieldContainer[NodeProto]: ...
    
    @property
    def opset_import(self) -> RepeatedCompositeFieldContainer[OperatorSetIdProto]: ...
    
    @property
    def value_info(self) -> RepeatedCompositeFieldContainer[ValueInfoProto]: ...
    
    @property
    def metadata_props(self) -> RepeatedCompositeFieldContainer[StringStringEntryProto]: ...
    
    def __init__(self,
        name : OptionalType[str] = None,
        input : OptionalType[Iterable[str]] = None,
        output : OptionalType[Iterable[str]] = None,
        attribute : OptionalType[Iterable[str]] = None,
        attribute_proto : OptionalType[Iterable[AttributeProto]] = None,
        node : OptionalType[Iterable[NodeProto]] = None,
        doc_string : OptionalType[str] = None,
        opset_import : OptionalType[Iterable[OperatorSetIdProto]] = None,
        domain : OptionalType[str] = None,
        overload : OptionalType[str] = None,
        value_info : OptionalType[Iterable[ValueInfoProto]] = None,
        metadata_props : OptionalType[Iterable[StringStringEntryProto]] = None,
        ) -> None: ...
    @classmethod
    def FromString(cls, s: bytes) -> FunctionProto: ...
    def MergeFrom(self, other_msg: Message) -> None: ...
    def CopyFrom(self, other_msg: Message) -> None: ...

@justinchuby justinchuby added this to the 1.17 milestone Apr 23, 2024
@justinchuby justinchuby added the release notes Important changes to call out in release notes label Apr 23, 2024
Signed-off-by: Madhav Kumar <47245900+kumar-ish@users.noreply.github.com>
Signed-off-by: Madhav Kumar <47245900+kumar-ish@users.noreply.github.com>
Signed-off-by: Madhav Kumar <47245900+kumar-ish@users.noreply.github.com>
Signed-off-by: Madhav Kumar <47245900+kumar-ish@users.noreply.github.com>
@kumar-ish
Copy link
Author

We can also specify/install the correct version on the Linux pipeline -- practically I don't think it really makes a difference.

@justinchuby
Copy link
Contributor

We can also specify/install the correct version on the Linux pipeline -- practically I don't think it really makes a difference.

I'm afraid we can't. pip install still needs to succeed in environments with older protobuf versions

@justinchuby
Copy link
Contributor

It seems possible to check the version here: https://cmake.org/cmake/help/latest/module/FindProtobuf.html using Protobuf_VERSION

@justinchuby
Copy link
Contributor

@kumar-ish Did you get a chance to update this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release notes Important changes to call out in release notes run release CIs Use this label to trigger release tests in CI
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

[Feature request] Use protobuf's generator to generate pyi stubs
2 participants