update code styles

This commit is contained in:
D-X-Y
2020-01-09 22:26:23 +11:00
parent 5ac5060a33
commit ad34af9913
26 changed files with 192 additions and 81 deletions

View File

@@ -1,4 +1,3 @@
import torch
import torch.nn as nn
from copy import deepcopy
from ..cell_operations import OPS

View File

@@ -68,7 +68,7 @@ class Structure:
for i, node_info in enumerate(self.nodes):
sums = []
for op, xin in node_info:
if op == 'none' or nodes[xin] == False: x = False
if op == 'none' or nodes[xin] is False: x = False
else: x = True
sums.append( x )
nodes[i+1] = sum(sums) > 0

View File

@@ -85,7 +85,7 @@ class SearchCell(nn.Module):
candidates = self.edges[node_str]
select_op = random.choice(candidates)
sops.append( select_op )
if not hasattr(select_op, 'is_zero') or select_op.is_zero == False: has_non_zero=True
if not hasattr(select_op, 'is_zero') or select_op.is_zero is False: has_non_zero=True
if has_non_zero: break
inter_nodes = []
for j, select_op in enumerate(sops):

View File

@@ -1,4 +1,4 @@
import math, torch
import math
import torch.nn as nn
import torch.nn.functional as F
from ..initialization import initialize_resnet