MCPcopy Create free account
hub / github.com/AMAP-ML/EMF / remove

Method remove

trl/trl/data_utils.py:465–473  ·  view source on GitHub ↗
(self, val)

Source from the content-addressed store, hash-verified

463 self.tree[i] = left if left >= right else right
464
465 def remove(self, val):
466 assert 0 < val <= self.maxval
467 i = self.maxval + val - 1
468 self.tree[i] = 0
469 while i > 1:
470 i >>= 1
471 left, right = self.tree[i << 1], self.tree[(i << 1) + 1]
472 # Compare the values using if-else otherwise repeated calls to `builtins.max` become the bottleneck
473 self.tree[i] = left if left >= right else right
474
475 def search(self, val):
476 assert 0 < val <= self.maxval

Callers 2

_pack_bfdFunction · 0.80
remove_hooksFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected