diff --git a/README.md b/README.md index 9384fab..8d1ecc8 100644 --- a/README.md +++ b/README.md @@ -15,14 +15,14 @@ The goal of model-based optimization is to find an input **x** that maximizes an Design-Bench can be installed with the complete set of benchmarks via our pip package. ```bash -pip install design-bench[all]==2.0.12 +pip install design-bench[all]==2.0.13 pip install morphing-agents==1.5.1 ``` Alternatively, if you do not have MuJoCo, you may opt for a minimal install. ```bash -pip install design-bench==2.0.12 +pip install design-bench==2.0.13 ``` ## Available Tasks diff --git a/design_bench/oracles/exact/cifar_nas_oracle.py b/design_bench/oracles/exact/cifar_nas_oracle.py index 315bbc8..8f0ca85 100644 --- a/design_bench/oracles/exact/cifar_nas_oracle.py +++ b/design_bench/oracles/exact/cifar_nas_oracle.py @@ -12,6 +12,9 @@ Design-Bench Maintainer: Brandon Trabucco """ +import functools +import operator + import torch import torch.nn as nn import torch.optim as optim @@ -42,10 +45,24 @@ def __init__(self, config): kernel_size2 = kernel_sizes[config[2]] activation2 = activations[config[3]] + # the next lines are to compensate for how older versions of + # pytorch do not natively support padding=same + padding1 = (kernel_size1 // 2 + (kernel_size1 - 2 * ( + kernel_size1 // 2)) - 1, kernel_size1 // 2, + kernel_size1 // 2 + (kernel_size1 - 2 * ( + kernel_size1 // 2)) - 1, kernel_size1 // 2) + + padding2 = (kernel_size2 // 2 + (kernel_size2 - 2 * ( + kernel_size2 // 2)) - 1, kernel_size2 // 2, + kernel_size2 // 2 + (kernel_size2 - 2 * ( + kernel_size2 // 2)) - 1, kernel_size2 // 2) + self.network = nn.Sequential( - nn.Conv2d(32, 32, kernel_size1, padding='same'), + nn.ZeroPad2d(padding1), + nn.Conv2d(32, 32, kernel_size1), activation1(), - nn.Conv2d(32, 32, kernel_size2, padding='same'), + nn.ZeroPad2d(padding2), + nn.Conv2d(32, 32, kernel_size2), activation2(), nn.MaxPool2d(3, stride=1, padding=1) ) @@ -65,8 +82,8 @@ def __init__(self, config): for i in range(0, len(config), n_params): configs.append(config[i:i + n_params]) - layers = [] - layers.append(nn.Conv2d(3, 32, 3, padding='same')) + layers = [nn.ZeroPad2d((1, 1, 1, 1)), + nn.Conv2d(3, 32, 3)] for config in configs: layers.append(Block(config))