viam.proto.service.mlmodel ========================== .. py:module:: viam.proto.service.mlmodel .. autoapi-nested-parse:: @generated by Viam. Do not edit manually! 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 Package Contents ---------------- .. 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:: GetStatus(stream: grpclib.server.Stream[common.v1.common_pb2.GetStatusRequest, common.v1.common_pb2.GetStatusResponse]) -> None :abstractmethod: :async: .. py:method:: __mapping__() -> Dict[str, grpclib.const.Handler] .. py:class:: MLModelServiceStub(channel: grpclib.client.Channel) .. py:attribute:: Infer .. py:attribute:: Metadata .. py:attribute:: GetStatus .. 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:method:: GetStatus(stream: grpclib.server.Stream[common.v1.common_pb2.GetStatusRequest, common.v1.common_pb2.GetStatusResponse]) -> 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:method:: shape() -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[int] the shape of the provided tensor as a list of integer extents .. py:method:: int8_tensor() -> Global___FlatTensorDataInt8 .. py:method:: uint8_tensor() -> Global___FlatTensorDataUInt8 .. py:method:: int16_tensor() -> Global___FlatTensorDataInt16 .. py:method:: uint16_tensor() -> Global___FlatTensorDataUInt16 .. py:method:: int32_tensor() -> Global___FlatTensorDataInt32 .. py:method:: uint32_tensor() -> Global___FlatTensorDataUInt32 .. py:method:: int64_tensor() -> Global___FlatTensorDataInt64 .. py:method:: uint64_tensor() -> Global___FlatTensorDataUInt64 .. py:method:: float_tensor() -> Global___FlatTensorDataFloat .. py:method:: double_tensor() -> Global___FlatTensorDataDouble .. py:method:: HasField(field_name: _HasFieldArgType) -> 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: _WhichOneofArgType_tensor) -> _WhichOneofReturnType_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:method:: data() -> 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:method:: data() -> 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:method:: data() -> 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:method:: data() -> 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:method:: data() -> 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:method:: data() -> 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:method:: data() -> 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:method:: data() -> 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:attribute:: key :type: str .. py:method:: value() -> Global___FlatTensor .. py:method:: HasField(field_name: _HasFieldArgType) -> 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:: tensors() -> 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:attribute:: name :type: str name of the model service .. py:method:: input_tensors() -> Global___FlatTensors the input data is provided as set of named flat tensors .. py:method:: extra() -> google.protobuf.struct_pb2.Struct Additional arguments to the method .. py:method:: HasField(field_name: _HasFieldArgType) -> 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:method:: output_tensors() -> Global___FlatTensors the output data is provided as a set of named flat tensors .. py:method:: HasField(field_name: _HasFieldArgType) -> 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: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:method:: input_info() -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[Global___TensorInfo] the necessary input arrays/tensors for an inference, order matters .. py:method:: output_info() -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[Global___TensorInfo] the output arrays/tensors of the model, order matters .. 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:attribute:: name :type: str name of the model service .. py:method:: extra() -> google.protobuf.struct_pb2.Struct Additional arguments to the method .. py:method:: HasField(field_name: _HasFieldArgType) -> 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:method:: metadata() -> Global___Metadata this is the metadata associated with the ML model .. py:method:: HasField(field_name: _HasFieldArgType) -> 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: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:: shape() -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[int] shape of the array/tensor (-1 for unknown) .. py:method:: associated_files() -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[Global___File] files associated with the array/tensor, like for category labels .. py:method:: extra() -> google.protobuf.struct_pb2.Struct anything else you want to say .. py:method:: HasField(field_name: _HasFieldArgType) -> 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.