reagent.ope package

Submodules

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, dtype=torch.int, device=None)

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

Parameters
  • a – index array

  • num_classes – number of classes

  • dtype – data type

Returns

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

Module contents