def __init__(self, genotype, i, C_pp, C_p, C, reduction_p, reduction, SSC): super().__init__() self.reduction = reduction try: self.n_nodes = len(genotype.normal) except: self.n_nodes = len(genotype["cell_0"]) if reduction_p: self.preproc0 = ops.FactorizedReduce(C_pp, C) else: self.preproc0 = ops.StdConv(C_pp, C, 1, 1, 0) self.preproc1 = ops.StdConv(C_p, C, 1, 1, 0) # generate dag if reduction: try: gene = genotype.reduce self.concat = genotype.reduce_concat except: gene = genotype["cell_%d" % i] self.concat = range(2, 2 + self.n_nodes) else: try: gene = genotype.normal self.concat = genotype.normal_concat except: gene = genotype["cell_%d" % i] self.concat = range(2, 2 + self.n_nodes) self.dag = gt.to_dag(C, gene, SSC, reduction)
def __init__(self, genotype, C_pp, C_p, C, reduction_p, reduction, layer_id, n_layers): super().__init__() self.reduction = reduction self.n_nodes = len(genotype.normal1) self.layer_id = layer_id if reduction_p: self.preproc0 = ops.FactorizedReduce(C_pp, C) else: self.preproc0 = ops.StdConv(C_pp, C, 1, 1, 0) self.preproc1 = ops.StdConv(C_p, C, 1, 1, 0) if self.layer_id < n_layers // 3: gene = genotype.normal1 self.concat = genotype.normal1_concat elif self.layer_id == n_layers // 3: gene = genotype.reduce1 self.concat = genotype.reduce1_concat elif self.layer_id < 2 * n_layers // 3: gene = genotype.normal2 self.concat = genotype.normal2_concat elif self.layer_id == 2 * n_layers // 3: gene = genotype.reduce2 self.concat = genotype.reduce2_concat elif self.layer_id > 2 * n_layers // 3: gene = genotype.normal3 self.concat = genotype.normal3_concat self.dag = gt.to_dag(C, gene, reduction)
def __init__(self, genotype, C_pp, C_p, C, reduction): super().__init__() self.reduction = reduction self.n_nodes = len(genotype.normal) self.preproc0 = ops.StdConv(C_pp, C, 1, 1, 0) self.preproc1 = ops.StdConv(C_p, C, 1, 1, 0) if reduction: gene = genotype.reduce self.concat = genotype.reduce_concat else: gene = genotype.normal self.concat = genotype.normal_concat self.dag = gt.to_dag(C, gene, reduction)
def __init__(self, genotype, C_pp, C_p, C, reduction_p, reduction): super().__init__() self.reduction = reduction self.n_nodes = len(genotype.normal) if reduction_p: self.preproc0 = ops.FactorizedReduce(C_pp, C) else: self.preproc0 = ops.Conv2dBlock(C_pp, C, 1, 1, 0) self.preproc1 = ops.Conv2dBlock(C_p, C, 1, 1, 0) # generate dag if reduction: gene = genotype.reduce self.concat = genotype.reduce_concat else: gene = genotype.normal self.concat = genotype.normal_concat self.dag = gt.to_dag(C, gene, reduction)
def __init__(self, DAG, cells, start_p, end_p, C_pp, C_p, C): super().__init__() self.DAG = DAG self.cells = cells self.preproc0 = ops.StdConv(C_pp, C, 1, 1, 0, affine=True) self.preproc1 = ops.StdConv(C_p, C, 1, 1, 0, affine=True) if start_p == 0: gene = DAG.DAG1 self.concat = DAG.DAG1_concat elif start_p == len(DAG.DAG1) + 1: gene = DAG.DAG2 self.concat = DAG.DAG2_concat elif start_p == len(DAG.DAG1) + len(DAG.DAG2) + 2: gene = DAG.DAG3 self.concat = DAG.DAG3_concat self.bigDAG = gt.to_dag(C, gene, False) for k in range(start_p, end_p + 1): # 4 self.bigDAG.append(cells[k])