in datasets/MixedPrioritizedSampler.py [0:0]
def reset_fixed_weights(self, fixed_weights, rescale=False):
""" Reset the manually designed weights and
update the whole tree accordingly.
@rescale: rescale the fixed_weights such that
fixed_weights.sum() = self.fixed_scale * adaptive_weights.sum()
"""
adaptive_weights = self.get_adaptive_weights()
fixed_sum = fixed_weights.sum()
if rescale and fixed_sum > 0:
scale = self.fixed_scale * adaptive_weights.sum() / fixed_sum
self.fixed_weights = fixed_weights * scale
else:
self.fixed_weights = fixed_weights
self.update_whole(self.fixed_weights + adaptive_weights)