def METHOD_NAME(self, mask=None):
    weights = self._weights
    try:
        # enable the initializer and set a mask
        self._weights = utils.VectorDict(weights, self.initializer, mask)
        yield
    finally:
        self._weights = weights