class_docstr: Base options for MediaPipe Tasks' Python APIs.
  
  Represents external model asset used by the Task APIs. The files can be
  specified by one of the following two ways:
  
  (1) model asset file path in `model_asset_path`.
  (2) model asset contents loaded in `model_asset_buffer`.
  
  If more than one field of these fields is provided, they are used in this
  precedence order.
  
  Attributes:
    model_asset_path: Path to the model asset file.
    model_asset_buffer: The model asset file contents as bytes.
    delegate: Acceleration to use. Supported values are GPU and CPU. GPU support
      is currently limited to Ubuntu platforms.
class_docstr_tok: ["Base","options","for","MediaPipe","Tasks","'","Python","APIs",".","Represents","external","model","asset","used","by","the","Task","APIs",".","The","files","can","be","specified","by","one","of","the","following","two","ways",":","(","1",")","model","asset","file","path","in","`","model_asset_path","`",".","(","2",")","model","asset","contents","loaded","in","`","model_asset_buffer","`",".","If","more","than","one","field","of","these","fields","is","provided",",","they","are","used","in","this","precedence","order",".","Attributes",":","model_asset_path",":","Path","to","the","model","asset","file",".","model_asset_buffer",":","The","model","asset","file","contents","as","bytes",".","delegate",":","Acceleration","to","use",".","Supported","values","are","GPU","and","CPU",".","GPU","support","is","currently","limited","to","Ubuntu","platforms","."]
docstr: Generates a BaseOptions protobuf object.
docstr_tok: ["Generates","a","BaseOptions","protobuf","object","."]
code: def to_pb2(self) -> _BaseOptionsProto:
      """Generates a BaseOptions protobuf object."""
      if self.model_asset_path is not None:
          full_path = os.path.abspath(self.model_asset_path)
      else:
          full_path = None
  
      platform_name = platform.system()
  
      if self.delegate == BaseOptions.Delegate.GPU:
          if platform_name in ["Linux", "Darwin"]:
              acceleration_proto = _AccelerationProto(
                  gpu=_DelegateProto.Gpu()
              )
          else:
              raise NotImplementedError(
                  "GPU Delegate is not yet supported for "
                  + platform_name
              )
      elif self.delegate == BaseOptions.Delegate.CPU:
          acceleration_proto = _AccelerationProto(
              tflite=_DelegateProto.TfLite()
          )
      else:
          acceleration_proto = None
  
      return _BaseOptionsProto(
          model_asset=_ExternalFileProto(
              file_name=full_path, file_content=self.model_asset_buffer
          ),
          acceleration=acceleration_proto,
      )
  
file_path: mediapipe/mediapipe/tasks/python/core/base_options.py
imports: import dataclasses
  import enum
  import os
  import platform
  from typing import Any, Optional
  from mediapipe.calculators.tensor import inference_calculator_pb2
  from mediapipe.tasks.cc.core.proto import acceleration_pb2
  from mediapipe.tasks.cc.core.proto import base_options_pb2
  from mediapipe.tasks.cc.core.proto import external_file_pb2
  from mediapipe.tasks.python.core.optional_dependencies import doc_controls
label_desc: Use image node_id 1 for calling the BaseOptions obj's underlying member method code with example usage: obj.to_pb2() and returns: _BaseOptionsProto