mani_skill.envs.utils.rewards.common ==================================== .. py:module:: mani_skill.envs.utils.rewards.common Functions --------- .. autoapisummary:: mani_skill.envs.utils.rewards.common.tolerance Module Contents --------------- .. py:function:: tolerance(x, lower=0.0, upper=0.0, margin=0.0, sigmoid='gaussian', value_at_margin=0.1) Returns 1 when `x` falls inside the bounds, between 0 and 1 otherwise. :param x: A torch array. (B, 3) :param lower: specifying inclusive `(lower, upper)` bounds for the target interval. These can be infinite if the interval is unbounded at one or both ends, or they can be equal to one another if the target value is exact. :param upper: specifying inclusive `(lower, upper)` bounds for the target interval. These can be infinite if the interval is unbounded at one or both ends, or they can be equal to one another if the target value is exact. :param margin: Float. Parameter that controls how steeply the output decreases as `x` moves out-of-bounds. * If `margin == 0` then the output will be 0 for all values of `x` outside of `bounds`. * If `margin > 0` then the output will decrease sigmoidally with increasing distance from the nearest bound. :param sigmoid: String, choice of sigmoid type. Valid values are: 'gaussian', 'linear', 'hyperbolic', 'long_tail', 'cosine', 'tanh_squared'. :param value_at_margin: A float between 0 and 1 specifying the output value when the distance from `x` to the nearest bound is equal to `margin`. Ignored if `margin == 0`. :returns: A torch array with values between 0.0 and 1.0. :raises ValueError: If `bounds[0] > bounds[1]`. :raises ValueError: If `margin` is negative. :raises ValueError: If not 0 < `value_at_margin` < 1, :raises except for `linear`, `cosine` and `quadratic` sigmoids, which allow `value_at_margin` == 0.: :raises ValueError: If `sigmoid` is of an unknown type.