:py:mod:`viam.proto.service.mlmodel` ==================================== .. py:module:: viam.proto.service.mlmodel .. autoapi-nested-parse:: @generated by Viam. Do not edit manually! Package Contents ---------------- Classes ~~~~~~~ .. autoapisummary:: viam.proto.service.mlmodel.MLModelServiceBase viam.proto.service.mlmodel.MLModelServiceStub viam.proto.service.mlmodel.UnimplementedMLModelServiceBase viam.proto.service.mlmodel.File viam.proto.service.mlmodel.FlatTensor viam.proto.service.mlmodel.FlatTensorDataDouble viam.proto.service.mlmodel.FlatTensorDataFloat viam.proto.service.mlmodel.FlatTensorDataInt8 viam.proto.service.mlmodel.FlatTensorDataInt16 viam.proto.service.mlmodel.FlatTensorDataInt32 viam.proto.service.mlmodel.FlatTensorDataInt64 viam.proto.service.mlmodel.FlatTensorDataUInt8 viam.proto.service.mlmodel.FlatTensorDataUInt16 viam.proto.service.mlmodel.FlatTensorDataUInt32 viam.proto.service.mlmodel.FlatTensorDataUInt64 viam.proto.service.mlmodel.FlatTensors viam.proto.service.mlmodel.InferRequest viam.proto.service.mlmodel.InferResponse viam.proto.service.mlmodel.LabelType viam.proto.service.mlmodel.Metadata viam.proto.service.mlmodel.MetadataRequest viam.proto.service.mlmodel.MetadataResponse viam.proto.service.mlmodel.TensorInfo .. py:class:: MLModelServiceBase Bases: :py:obj:`abc.ABC` Helper class that provides a standard way to create an ABC using inheritance. .. py:method:: Infer(stream: grpclib.server.Stream[service.mlmodel.v1.mlmodel_pb2.InferRequest, service.mlmodel.v1.mlmodel_pb2.InferResponse]) -> None :abstractmethod: :async: .. py:method:: Metadata(stream: grpclib.server.Stream[service.mlmodel.v1.mlmodel_pb2.MetadataRequest, service.mlmodel.v1.mlmodel_pb2.MetadataResponse]) -> None :abstractmethod: :async: .. py:method:: __mapping__() -> Dict[str, grpclib.const.Handler] .. py:class:: MLModelServiceStub(channel: grpclib.client.Channel) .. py:class:: UnimplementedMLModelServiceBase Bases: :py:obj:`MLModelServiceBase` Helper class that provides a standard way to create an ABC using inheritance. .. py:method:: Infer(stream: grpclib.server.Stream[service.mlmodel.v1.mlmodel_pb2.InferRequest, service.mlmodel.v1.mlmodel_pb2.InferResponse]) -> None :async: .. py:method:: Metadata(stream: grpclib.server.Stream[service.mlmodel.v1.mlmodel_pb2.MetadataRequest, service.mlmodel.v1.mlmodel_pb2.MetadataResponse]) -> None :async: .. py:class:: File(*, name: str = ..., description: str = ..., label_type: global___LabelType = ...) Bases: :py:obj:`google.protobuf.message.Message` Abstract base class for protocol messages. Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below. .. py:attribute:: name :type: str name of the file, with file extension .. py:attribute:: description :type: str description of what the file contains .. py:attribute:: label_type :type: global___LabelType How to associate the arrays/tensors to the labels in the file .. py:class:: FlatTensor(*, shape: collections.abc.Iterable[int] | None = ..., int8_tensor: global___FlatTensorDataInt8 | None = ..., uint8_tensor: global___FlatTensorDataUInt8 | None = ..., int16_tensor: global___FlatTensorDataInt16 | None = ..., uint16_tensor: global___FlatTensorDataUInt16 | None = ..., int32_tensor: global___FlatTensorDataInt32 | None = ..., uint32_tensor: global___FlatTensorDataUInt32 | None = ..., int64_tensor: global___FlatTensorDataInt64 | None = ..., uint64_tensor: global___FlatTensorDataUInt64 | None = ..., float_tensor: global___FlatTensorDataFloat | None = ..., double_tensor: global___FlatTensorDataDouble | None = ...) Bases: :py:obj:`google.protobuf.message.Message` Abstract base class for protocol messages. Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below. .. py:property:: shape :type: google.protobuf.internal.containers.RepeatedScalarFieldContainer[int] the shape of the provided tensor as a list of integer extents .. py:property:: int8_tensor :type: global___FlatTensorDataInt8 .. py:property:: uint8_tensor :type: global___FlatTensorDataUInt8 .. py:property:: int16_tensor :type: global___FlatTensorDataInt16 .. py:property:: uint16_tensor :type: global___FlatTensorDataUInt16 .. py:property:: int32_tensor :type: global___FlatTensorDataInt32 .. py:property:: uint32_tensor :type: global___FlatTensorDataUInt32 .. py:property:: int64_tensor :type: global___FlatTensorDataInt64 .. py:property:: uint64_tensor :type: global___FlatTensorDataUInt64 .. py:property:: float_tensor :type: global___FlatTensorDataFloat .. py:property:: double_tensor :type: global___FlatTensorDataDouble .. py:method:: HasField(field_name: Literal[double_tensor, b'double_tensor', float_tensor, b'float_tensor', int16_tensor, b'int16_tensor', int32_tensor, b'int32_tensor', int64_tensor, b'int64_tensor', int8_tensor, b'int8_tensor', tensor, b'tensor', uint16_tensor, b'uint16_tensor', uint32_tensor, b'uint32_tensor', uint64_tensor, b'uint64_tensor', uint8_tensor, b'uint8_tensor']) -> bool Checks if a certain field is set for the message. For a oneof group, checks if any field inside is set. Note that if the field_name is not defined in the message descriptor, :exc:`ValueError` will be raised. :param field_name: The name of the field to check for presence. :type field_name: str :returns: Whether a value has been set for the named field. :rtype: bool :raises ValueError: if the `field_name` is not a member of this message. .. py:method:: WhichOneof(oneof_group: Literal[tensor, b'tensor']) -> Literal[int8_tensor, uint8_tensor, int16_tensor, uint16_tensor, int32_tensor, uint32_tensor, int64_tensor, uint64_tensor, float_tensor, double_tensor] | None Returns the name of the field that is set inside a oneof group. If no field is set, returns None. :param oneof_group: the name of the oneof group to check. :type oneof_group: str :returns: The name of the group that is set, or None. :rtype: str or None :raises ValueError: no group with the given name exists .. py:class:: FlatTensorDataDouble(*, data: collections.abc.Iterable[float] | None = ...) Bases: :py:obj:`google.protobuf.message.Message` Abstract base class for protocol messages. Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below. .. py:property:: data :type: google.protobuf.internal.containers.RepeatedScalarFieldContainer[float] .. py:class:: FlatTensorDataFloat(*, data: collections.abc.Iterable[float] | None = ...) Bases: :py:obj:`google.protobuf.message.Message` Abstract base class for protocol messages. Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below. .. py:property:: data :type: google.protobuf.internal.containers.RepeatedScalarFieldContainer[float] .. py:class:: FlatTensorDataInt8(*, data: bytes = ...) Bases: :py:obj:`google.protobuf.message.Message` Abstract base class for protocol messages. Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below. .. py:attribute:: data :type: bytes .. py:class:: FlatTensorDataInt16(*, data: collections.abc.Iterable[int] | None = ...) Bases: :py:obj:`google.protobuf.message.Message` Abstract base class for protocol messages. Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below. .. py:property:: data :type: google.protobuf.internal.containers.RepeatedScalarFieldContainer[int] packs two 16-bit numbers per entry - explicitly little-endian so big-endian producers/consumers must compensate .. py:class:: FlatTensorDataInt32(*, data: collections.abc.Iterable[int] | None = ...) Bases: :py:obj:`google.protobuf.message.Message` Abstract base class for protocol messages. Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below. .. py:property:: data :type: google.protobuf.internal.containers.RepeatedScalarFieldContainer[int] .. py:class:: FlatTensorDataInt64(*, data: collections.abc.Iterable[int] | None = ...) Bases: :py:obj:`google.protobuf.message.Message` Abstract base class for protocol messages. Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below. .. py:property:: data :type: google.protobuf.internal.containers.RepeatedScalarFieldContainer[int] .. py:class:: FlatTensorDataUInt8(*, data: bytes = ...) Bases: :py:obj:`google.protobuf.message.Message` Abstract base class for protocol messages. Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below. .. py:attribute:: data :type: bytes .. py:class:: FlatTensorDataUInt16(*, data: collections.abc.Iterable[int] | None = ...) Bases: :py:obj:`google.protobuf.message.Message` Abstract base class for protocol messages. Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below. .. py:property:: data :type: google.protobuf.internal.containers.RepeatedScalarFieldContainer[int] packs two 16-bit numbers per entry - explicitly little-endian so big-endian producers/consumers must compensate .. py:class:: FlatTensorDataUInt32(*, data: collections.abc.Iterable[int] | None = ...) Bases: :py:obj:`google.protobuf.message.Message` Abstract base class for protocol messages. Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below. .. py:property:: data :type: google.protobuf.internal.containers.RepeatedScalarFieldContainer[int] .. py:class:: FlatTensorDataUInt64(*, data: collections.abc.Iterable[int] | None = ...) Bases: :py:obj:`google.protobuf.message.Message` Abstract base class for protocol messages. Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below. .. py:property:: data :type: google.protobuf.internal.containers.RepeatedScalarFieldContainer[int] .. py:class:: FlatTensors(*, tensors: collections.abc.Mapping[str, global___FlatTensor] | None = ...) Bases: :py:obj:`google.protobuf.message.Message` Abstract base class for protocol messages. Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below. .. py:class:: TensorsEntry(*, key: str = ..., value: global___FlatTensor | None = ...) Bases: :py:obj:`google.protobuf.message.Message` Abstract base class for protocol messages. Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below. .. py:property:: value :type: global___FlatTensor .. py:attribute:: key :type: str .. py:method:: HasField(field_name: Literal[value, b'value']) -> bool Checks if a certain field is set for the message. For a oneof group, checks if any field inside is set. Note that if the field_name is not defined in the message descriptor, :exc:`ValueError` will be raised. :param field_name: The name of the field to check for presence. :type field_name: str :returns: Whether a value has been set for the named field. :rtype: bool :raises ValueError: if the `field_name` is not a member of this message. .. py:property:: tensors :type: google.protobuf.internal.containers.MessageMap[str, global___FlatTensor] A name-indexed collection of flat tensor objects .. py:class:: InferRequest(*, name: str = ..., input_tensors: global___FlatTensors | None = ..., extra: google.protobuf.struct_pb2.Struct | None = ...) Bases: :py:obj:`google.protobuf.message.Message` Abstract base class for protocol messages. Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below. .. py:property:: input_tensors :type: global___FlatTensors the input data is provided as set of named flat tensors .. py:property:: extra :type: google.protobuf.struct_pb2.Struct Additional arguments to the method .. py:attribute:: name :type: str name of the model service .. py:method:: HasField(field_name: Literal[extra, b'extra', input_tensors, b'input_tensors']) -> bool Checks if a certain field is set for the message. For a oneof group, checks if any field inside is set. Note that if the field_name is not defined in the message descriptor, :exc:`ValueError` will be raised. :param field_name: The name of the field to check for presence. :type field_name: str :returns: Whether a value has been set for the named field. :rtype: bool :raises ValueError: if the `field_name` is not a member of this message. .. py:class:: InferResponse(*, output_tensors: global___FlatTensors | None = ...) Bases: :py:obj:`google.protobuf.message.Message` Abstract base class for protocol messages. Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below. .. py:property:: output_tensors :type: global___FlatTensors the output data is provided as a set of named flat tensors .. py:method:: HasField(field_name: Literal[output_tensors, b'output_tensors']) -> bool Checks if a certain field is set for the message. For a oneof group, checks if any field inside is set. Note that if the field_name is not defined in the message descriptor, :exc:`ValueError` will be raised. :param field_name: The name of the field to check for presence. :type field_name: str :returns: Whether a value has been set for the named field. :rtype: bool :raises ValueError: if the `field_name` is not a member of this message. .. py:class:: LabelType Bases: :py:obj:`_LabelType` .. py:class:: Metadata(*, name: str = ..., type: str = ..., description: str = ..., input_info: collections.abc.Iterable[global___TensorInfo] | None = ..., output_info: collections.abc.Iterable[global___TensorInfo] | None = ...) Bases: :py:obj:`google.protobuf.message.Message` Abstract base class for protocol messages. Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below. .. py:property:: input_info :type: google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___TensorInfo] the necessary input arrays/tensors for an inference, order matters .. py:property:: output_info :type: google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___TensorInfo] the output arrays/tensors of the model, order matters .. py:attribute:: name :type: str name of the model .. py:attribute:: type :type: str type of model e.g. object_detector, text_classifier .. py:attribute:: description :type: str description of the model .. py:class:: MetadataRequest(*, name: str = ..., extra: google.protobuf.struct_pb2.Struct | None = ...) Bases: :py:obj:`google.protobuf.message.Message` Abstract base class for protocol messages. Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below. .. py:property:: extra :type: google.protobuf.struct_pb2.Struct Additional arguments to the method .. py:attribute:: name :type: str name of the model service .. py:method:: HasField(field_name: Literal[extra, b'extra']) -> bool Checks if a certain field is set for the message. For a oneof group, checks if any field inside is set. Note that if the field_name is not defined in the message descriptor, :exc:`ValueError` will be raised. :param field_name: The name of the field to check for presence. :type field_name: str :returns: Whether a value has been set for the named field. :rtype: bool :raises ValueError: if the `field_name` is not a member of this message. .. py:class:: MetadataResponse(*, metadata: global___Metadata | None = ...) Bases: :py:obj:`google.protobuf.message.Message` Abstract base class for protocol messages. Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below. .. py:property:: metadata :type: global___Metadata this is the metadata associated with the ML model .. py:method:: HasField(field_name: Literal[metadata, b'metadata']) -> bool Checks if a certain field is set for the message. For a oneof group, checks if any field inside is set. Note that if the field_name is not defined in the message descriptor, :exc:`ValueError` will be raised. :param field_name: The name of the field to check for presence. :type field_name: str :returns: Whether a value has been set for the named field. :rtype: bool :raises ValueError: if the `field_name` is not a member of this message. .. py:class:: TensorInfo(*, name: str = ..., description: str = ..., data_type: str = ..., shape: collections.abc.Iterable[int] | None = ..., associated_files: collections.abc.Iterable[global___File] | None = ..., extra: google.protobuf.struct_pb2.Struct | None = ...) Bases: :py:obj:`google.protobuf.message.Message` Abstract base class for protocol messages. Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below. .. py:property:: shape :type: google.protobuf.internal.containers.RepeatedScalarFieldContainer[int] shape of the array/tensor (-1 for unknown) .. py:property:: associated_files :type: google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___File] files associated with the array/tensor, like for category labels .. py:property:: extra :type: google.protobuf.struct_pb2.Struct anything else you want to say .. py:attribute:: name :type: str name of the data in the array/tensor .. py:attribute:: description :type: str description of the data in the array/tensor .. py:attribute:: data_type :type: str data type of the array/tensor, e.g. float32, float64, uint8 .. py:method:: HasField(field_name: Literal[extra, b'extra']) -> bool Checks if a certain field is set for the message. For a oneof group, checks if any field inside is set. Note that if the field_name is not defined in the message descriptor, :exc:`ValueError` will be raised. :param field_name: The name of the field to check for presence. :type field_name: str :returns: Whether a value has been set for the named field. :rtype: bool :raises ValueError: if the `field_name` is not a member of this message.