sometimes
Sometimes
¶
Bases: NumpyOp
Perform a NumpyOp with a given probability.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
numpy_op |
NumpyOp
|
The operator to be performed. |
required |
prob |
float
|
The probability of execution, which should be in the range: [0-1). |
0.5
|
Source code in fastestimator\fastestimator\op\numpyop\meta\sometimes.py
forward
¶
Execute the wrapped operator a certain fraction of the time.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
Union[np.ndarray, List[np.ndarray]]
|
The information to be passed to the wrapped operator. |
required |
state |
Dict[str, Any]
|
Information about the current execution context, for example {"mode": "train"}. |
required |
Returns:
Type | Description |
---|---|
Union[np.ndarray, List[np.ndarray]]
|
The original |