pytc.vmc.sharding.get_vmap_fn¶
- pytc.vmc.sharding.get_vmap_fn(max_vmap_batch_size=0, mesh=None)[source]¶
Return the appropriate vmap implementation.
Automatically detects if multiple GPUs are available. If so, and
max_vmap_batch_size > 0, usessharded_batched_vmapwhich combines sharding and batching. Ifmax_vmap_batch_size == 0, usesshard_vmapfor sharded data-parallel execution.- Returns:
A vmap-like function with
(fn, in_axes, ...)signature.- Return type:
callable
- Parameters:
max_vmap_batch_size (int)
mesh (jax.sharding.Mesh | None)