From 529a2899fe7cebb48aadff807cad4c8ca9ab6f02 Mon Sep 17 00:00:00 2001 From: Yuge Zhang Date: Thu, 14 May 2020 10:09:43 +0800 Subject: [PATCH] Update implementation of PDARTS export due to mutator refactor (#2423) * Disable precondition check for length in export for PDARTS * update --- src/sdk/pynni/nni/nas/pytorch/pdarts/mutator.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sdk/pynni/nni/nas/pytorch/pdarts/mutator.py b/src/sdk/pynni/nni/nas/pytorch/pdarts/mutator.py index 108557f30e..5bafba4042 100644 --- a/src/sdk/pynni/nni/nas/pytorch/pdarts/mutator.py +++ b/src/sdk/pynni/nni/nas/pytorch/pdarts/mutator.py @@ -55,7 +55,8 @@ def __init__(self, model, pdarts_epoch_index, pdarts_num_to_drop, switches={}): del module[index] assert len(module) <= len(choices), "Failed to remove dropped choices." - def sample_final(self): + def export(self): + # Cannot rely on super().export() because P-DARTS has deleted some of the choices and has misaligned length. results = super().sample_final() for mutable in self.mutables: if isinstance(mutable, LayerChoice):