Closed
Description
The following function in nda.optimizers.compressor seems incorrect. It does not keep a values; instead it keeps dim-a values.
Random_a compressor, keep a values
def random(x, a):
dim = x.shape[0]
if a == 0:
return 0
if a == dim:
return x
if x.ndim == 2:
for i in range(x.shape[1]):
zero_mask = xp.random.choice(dim, a, replace=False)
x[zero_mask, i] = 0
else:
zero_mask = xp.random.choice(dim, a, replace=False)
x[zero_mask] = 0
return x
To correct the above issue, replace:
xp.random.choice(dim, a, replace=False)
with
xp.random.choice(dim, dim-a, replace=False)
Metadata
Metadata
Assignees
Labels
No labels