Shortcuts

torch.mps

This package enables an interface for accessing MPS (Metal Performance Shaders) backend in Python. Metal is Apple’s API for programming metal GPU (graphics processor unit). Using MPS means that increased performance can be achieved, by running work on the metal GPU(s). See https://developer.apple.com/documentation/metalperformanceshaders for more details.

synchronize

Waits for all kernels in all streams on a MPS device to complete.

get_rng_state

Returns the random number generator state as a ByteTensor.

set_rng_state

Sets the random number generator state.

manual_seed

Sets the seed for generating random numbers.

seed

Sets the seed for generating random numbers to a random number.

empty_cache

Releases all unoccupied cached memory currently held by the caching allocator so that those can be used in other GPU applications.

set_per_process_memory_fraction

Set memory fraction for limiting process's memory allocation on MPS device.

current_allocated_memory

Returns the current GPU memory occupied by tensors in bytes.

driver_allocated_memory

Returns total GPU memory allocated by Metal driver for the process in bytes.

MPS Profiler

profiler.start

Start OS Signpost tracing from MPS backend.

profiler.stop

Stops generating OS Signpost tracing from MPS backend.

profiler.profile

Context Manager to enabling generating OS Signpost tracing from MPS backend.

MPS Event

event.Event

Wrapper around an MPS event.

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources