reagent.ope package


reagent.ope.utils module

class reagent.ope.utils.Clamper(min_v: float = -inf, max_v: float = inf)

Bases: object

class reagent.ope.utils.LRUCache(maxsize=1024, *args, **kwds)

Bases: collections.OrderedDict

class reagent.ope.utils.RunningAverage(init_val: float = nan)

Bases: object

add(value) → reagent.ope.utils.RunningAverage
property average
property count
property total
reagent.ope.utils.convert_to_one_hots(a, num_classes: int,, device=None)

Convert class index array (num_sample,) to an one hots array (num_sample, num_classes)

  • a – index array

  • num_classes – number of classes

  • dtype – data type


one hots array in shape of (a.shape[0], num_classes)

Module contents