Source code for nni.nas.pytorch.random.mutator

import torch
import torch.nn.functional as F

from nni.nas.pytorch.mutator import Mutator
from nni.nas.pytorch.mutables import LayerChoice, InputChoice

[docs]class RandomMutator(Mutator): """ Random mutator that samples a random candidate in the search space each time ``reset()``. It uses random function in PyTorch, so users can set seed in PyTorch to ensure deterministic behavior. """
[docs] def sample_final(self): """ Same as :meth:`sample_search`. """ return self.sample_search()