def reset(self):
    '\n        Reset environment\n\n        Returns\n        -------\n        np.array\n            Environment state\n        '
    super(SGDEnv, self).reset_()
    dataset = self.instance[0]
    instance_seed = self.instance[1]
    construct_model = self.instance[2]
    self.seed(instance_seed)
    self.model = construct_model().to(self.device)
    self.training_validation_ratio = 0.8
    train_dataloader_args = {'batch_size': self.batch_size}
    validation_dataloader_args = {'batch_size': self.validation_batch_size}
    if self.use_cuda:
        param = {'num_workers': 1, 'pin_memory': True, 'shuffle': True}
        train_dataloader_args.update(param)
        validation_dataloader_args.update(param)
    if (dataset == 'MNIST'):
        transform = transforms.Compose([transforms.ToTensor(), transforms.Normalize((0.1307,), (0.3081,))])
        train_dataset = datasets.MNIST('../data', train=True, download=True, transform=transform)
    else:
        raise NotImplementedError
    training_dataset_limit = math.floor((len(train_dataset) * self.training_validation_ratio))
    validation_dataset_limit = len(train_dataset)
    self.train_dataset = torch.utils.data.Subset(train_dataset, range(0, (training_dataset_limit - 1)))
    self.validation_dataset = torch.utils.data.Subset(train_dataset, range(training_dataset_limit, validation_dataset_limit))
    self.train_loader = torch.utils.data.DataLoader(self.train_dataset, **train_dataloader_args)
    self.validation_loader = torch.utils.data.DataLoader(self.validation_dataset, **validation_dataloader_args)
    self.train_batch_index = 0
    self.epoch_index = 0
    self.train_loader_it = iter(self.train_loader)
    self.validation_loader_it = iter(self.validation_loader)
    self.parameter_count = 0
    self.layer_sizes = []
    for p in self.model.parameters():
        layer_size = reduce((lambda x, y: (x * y)), p.shape)
        self.layer_sizes.append(layer_size)
        self.parameter_count += layer_size
    self.model = extend(self.model)
    self._set_zero_grad()
    self.model.train()
    self.current_training_loss = None
    self.loss_batch = None
    self.m = 0
    self.v = 0
    self.t = 0
    self.step_count = torch.zeros(1, device=self.device, requires_grad=False)
    self.current_lr = self.initial_lr
    self.prev_descent = torch.zeros((self.parameter_count,), device=self.device, requires_grad=False)
    self.get_default_reward(self)
    return self.get_state(self)
Reset environment

Returns
-------
np.array
    Environment state
def reset(self):
    '\n        Reset environment\n\n        Returns\n        -------\n        np.array\n            Environment state\n        '
    super(SGDEnv, self).reset_()
    dataset = self.instance[0]
    instance_seed = self.instance[1]
    construct_model = self.instance[2]
    self.seed(instance_seed)
    self.model = construct_model().to(self.device)
    self.training_validation_ratio = 0.8
    train_dataloader_args = {'batch_size': self.batch_size}
    validation_dataloader_args = {'batch_size': self.validation_batch_size}
    if self.use_cuda:
        param = {'num_workers': 1, 'pin_memory': True, 'shuffle': True}
        train_dataloader_args.update(param)
        validation_dataloader_args.update(param)
    if (dataset == 'MNIST'):
        transform = transforms.Compose([transforms.ToTensor(), transforms.Normalize((0.1307,), (0.3081,))])
        train_dataset = datasets.MNIST('../data', train=True, download=True, transform=transform)
    else:
        raise NotImplementedError
    training_dataset_limit = math.floor((len(train_dataset) * self.training_validation_ratio))
    validation_dataset_limit = len(train_dataset)
    self.train_dataset = torch.utils.data.Subset(train_dataset, range(0, (training_dataset_limit - 1)))
    self.validation_dataset = torch.utils.data.Subset(train_dataset, range(training_dataset_limit, validation_dataset_limit))
    self.train_loader = torch.utils.data.DataLoader(self.train_dataset, **train_dataloader_args)
    self.validation_loader = torch.utils.data.DataLoader(self.validation_dataset, **validation_dataloader_args)
    self.train_batch_index = 0
    self.epoch_index = 0
    self.train_loader_it = iter(self.train_loader)
    self.validation_loader_it = iter(self.validation_loader)
    self.parameter_count = 0
    self.layer_sizes = []
    for p in self.model.parameters():
        layer_size = reduce((lambda x, y: (x * y)), p.shape)
        self.layer_sizes.append(layer_size)
        self.parameter_count += layer_size
    self.model = extend(self.model)
    self._set_zero_grad()
    self.model.train()
    self.current_training_loss = None
    self.loss_batch = None
    self.m = 0
    self.v = 0
    self.t = 0
    self.step_count = torch.zeros(1, device=self.device, requires_grad=False)
    self.current_lr = self.initial_lr
    self.prev_descent = torch.zeros((self.parameter_count,), device=self.device, requires_grad=False)
    self.get_default_reward(self)
    return self.get_state(self)