目录

Utils

Utility components that are ready-to-use out of the box. These are components that simply execute well known binaries (e.g. /bin/cp) and are meant to be used as tutorial materials or glue operations between meaningful stages in a workflow.

torchx.components.utils.echo(msg: str = 'hello world', image: str = 'ghcr.io/pytorch/torchx:0.1.0rc1', num_replicas: int = 1)torchx.specs.api.AppDef[source]

Echos a message to stdout (calls /bin/echo)

Parameters
  • msg – message to echo

  • image – image to use

  • num_replicas – number of replicas to run

torchx.components.utils.touch(file: str, image: str = 'ghcr.io/pytorch/torchx:0.1.0rc1')torchx.specs.api.AppDef[source]

Touches a file (calls touch)

Parameters
  • file – file to create

  • image – the image to use

torchx.components.utils.sh(*args: str, image: str = 'ghcr.io/pytorch/torchx:0.1.0rc1', num_replicas: int = 1)torchx.specs.api.AppDef[source]

Runs the provided command via sh. Currently sh does not support environment variable substitution.

Parameters
  • args – bash arguments

  • image – image to use

  • num_replicas – number of replicas to run

torchx.components.utils.copy(src: str, dst: str, image: str = 'ghcr.io/pytorch/torchx:0.1.0rc1')torchx.specs.api.AppDef[source]

copy copies the file from src to dst. src and dst can be any valid fsspec url.

This does not support recursive copies or directories.

Parameters
  • src – the source fsspec file location

  • dst – the destination fsspec file location

  • image – the image that contains the copy app

torchx.components.utils.booth(x1: float, x2: float, trial_idx: int = 0, tracker_base: str = '/tmp/torchx-util-booth', image: str = 'ghcr.io/pytorch/torchx:0.1.0rc1')torchx.specs.api.AppDef[source]

Evaluates the booth function, f(x1, x2) = (x1 + 2*x2 - 7)^2 + (2*x1 + x2 - 5)^2. Output result is accessible via FsspecResultTracker(outdir)[trial_idx]

Parameters
  • x1 – x1

  • x2 – x2

  • trial_idx – ignore if not running hpo

  • tracker_base – URI of the tracker’s base output directory (e.g. s3://foo/bar)

  • image – the image that contains the booth app

文档

访问 PyTorch 的全面开发人员文档

查看文档

教程

获取面向初学者和高级开发人员的深入教程

查看教程

资源

查找开发资源并解答您的问题

查看资源