policy
orchard.core.environment.policy
¶
Execution & Optimization Policies.
Defines decision-making logic for runtime strategy selection based on hardware availability and configuration constraints.
This module contains policy functions that determine optimal execution strategies (e.g., TTA mode complexity) by analyzing available resources and user configuration. Policies ensure the framework adapts intelligently to heterogeneous deployment environments (CPU, CUDA, MPS).
Key Policies
- TTA Mode Selection: Balances augmentation ensemble size with hardware acceleration to prevent CPU bottlenecks while maximizing GPU throughput
determine_tta_mode(use_tta, device_type, tta_mode='full')
¶
Reports the active TTA ensemble policy.
The ensemble complexity is driven by the tta_mode config field,
not by hardware. This guarantees identical predictions on CPU, CUDA
and MPS for the same config, preserving cross-platform determinism.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
use_tta
|
bool
|
Whether Test-Time Augmentation is enabled. |
required |
device_type
|
str
|
The type of active device ('cpu', 'cuda', 'mps'). |
required |
tta_mode
|
str
|
Config-driven ensemble complexity ('full' or 'light'). |
'full'
|
Returns:
| Type | Description |
|---|---|
str
|
Descriptive string of the TTA operation mode. |