class_docstr: A task represents how to compute a micro-batch on a partition.
  
  It consists of two parts: :meth:`compute` and :meth:`finalize`.
  :meth:`compute` should be executed in worker threads concurrently.
  :meth:`finalize` should be executed after when worker threads complete to
  execute :meth:`compute`.
  
  :meth:`compute` might be boosted by worker threads. Because it produces
  several CUDA API calls by user code. In PyTorch, parallel CUDA API calls
  are not serialized through GIL. So more than one CUDA API call can be
  produced at the same time.
code: def compute(self) -> Batch:
      with use_stream(self.stream), torch.set_grad_enabled(
          self._grad_enabled
      ):
          return self._compute()
  
file_path: pytorch/torch/distributed/pipeline/sync/worker.py
imports: from contextlib import contextmanager
  from queue import Queue
  import sys
  from threading import Thread
  from types import TracebackType
  from typing import TYPE_CHECKING, Callable, Dict, Generator, List, Optional, Tuple, Type, Union, cast
  import torch
  from .microbatch import Batch
  from .stream import AbstractStream, use_device, use_stream
label_desc: Use image node_id 2 for calling the Task obj's underlying member method code with example usage: obj.compute() and returns: self