torch.distributions.greater_than
function greater_than(lower_bound: number): _GreaterThanCreates a constraint for values strictly greater than a lower bound.
Returns a constraint that validates whether tensor values satisfy x > lower_bound. Useful for:
- Distribution parameters requiring strict positivity (e.g., scale, concentration)
- Ensuring numerical stability by excluding boundary cases
- Parameter validation in continuous distributions
- Range-constrained optimization
- Strict inequality: Uses (not =), excluding the boundary value
- Open interval: Defines constraint for interval (lower_bound, ∞)
- Check returns tensor: Returns boolean tensor indicating constraint satisfaction
Parameters
lower_boundnumber- The lower bound value (values must be strictly greater than this)
Returns
_GreaterThan– A constraint object that validates x lower_boundExamples
const positive = torch.distributions.constraints.greater_than(0);
const scale = torch.tensor([1.5, 2.0, 0.5]);
positive.check(scale); // Validates all values > 0
// Use with distribution validation
const dist = torch.distributions.Normal(
torch.tensor(0),
scale,
{ validate_args: true } // Validates scale > 0
);See Also
- PyTorch torch.distributions.constraints.greater_than()
- greater_than_eq - Greater than or equal constraint
- interval - Two-sided interval constraint
- constraints - Other available constraints