(self, e)
| 241 | self.r_max = float(r) |
| 242 | |
| 243 | def __call__(self, e): |
| 244 | n = len(e) |
| 245 | if self.r_min is None: |
| 246 | r = self.r_max |
| 247 | else: |
| 248 | # Randomly select removal ratio |
| 249 | r = random.uniform(self.r_min, self.r_max) |
| 250 | |
| 251 | mask = np.random.choice(range(n), size=int(n*r), replace=False) # select elements to remove |
| 252 | e[mask] = torch.zeros_like(e[mask]) |
| 253 | return e |
| 254 | |
| 255 | |
| 256 | class RemoveRandomBlock: |
nothing calls this directly
no outgoing calls
no test coverage detected