# Path: deep_architect/helpers/tensorflow_eager_support.py
# def set_is_training(outputs, is_training):
# 
#     def fn(mx):
#         if hasattr(mx, 'is_training'):
#             mx.is_training = is_training
# 
#     co.traverse_backward(outputs, fn)


import gc
import os
import tensorflow as tf
import numpy as np
import deep_architect.core as co
from builtins import object
from past.utils import old_div
from deep_architect.helpers.tensorflow_eager_support import set_is_training
        self.controller_step = 0
        self.child_step = 0
        self.controller_mode = False
        self.max_controller_steps = max_controller_steps

        self.weight_sharer = weight_sharer

        if self.optimizer_type == 'adam':
            self.optimizer = tf.train.AdamOptimizer(
                learning_rate=self.learning_rate_init)
        elif self.optimizer_type == 'sgd':
            self.optimizer = tf.train.GradientDescentOptimizer(
                learning_rate=self.learning_rate_init)
        elif self.optimizer_type == 'sgd_mom':
            self.optimizer = tf.train.MomentumOptimizer(
                learning_rate=self.learning_rate_init, momentum=0.99)
        else:
            raise ValueError("Unknown optimizer.")

    def save_state(self, folderpath):
        weight_sharer_file = os.path.join(folderpath, "weight_sharer")
        self.weight_sharer.save(weight_sharer_file)

    def load_state(self, folderpath):
        weight_sharer_file = os.path.join(folderpath, "weight_sharer")
        self.weight_sharer.load(weight_sharer_file)

    def _compute_accuracy(self, inputs, outputs, dataset):
        nc = 0
        num_left = dataset.get_num_examples()

# Path: deep_architect/helpers/tensorflow_eager_support.py
# def set_is_training(outputs, is_training):
# 
#     def fn(mx):
#         if hasattr(mx, 'is_training'):
#             mx.is_training = is_training
# 
#     co.traverse_backward(outputs, fn)


# Path: dev/enas/evaluator/enas_evaluator.py
import gc
import os
import tensorflow as tf
import numpy as np
import deep_architect.core as co
from builtins import object
from past.utils import old_div
from deep_architect.helpers.tensorflow_eager_support import set_is_training

        self.controller_step = 0
        self.child_step = 0
        self.controller_mode = False
        self.max_controller_steps = max_controller_steps

        self.weight_sharer = weight_sharer

        if self.optimizer_type == 'adam':
            self.optimizer = tf.train.AdamOptimizer(
                learning_rate=self.learning_rate_init)
        elif self.optimizer_type == 'sgd':
            self.optimizer = tf.train.GradientDescentOptimizer(
                learning_rate=self.learning_rate_init)
        elif self.optimizer_type == 'sgd_mom':
            self.optimizer = tf.train.MomentumOptimizer(
                learning_rate=self.learning_rate_init, momentum=0.99)
        else:
            raise ValueError("Unknown optimizer.")

    def save_state(self, folderpath):
        weight_sharer_file = os.path.join(folderpath, "weight_sharer")
        self.weight_sharer.save(weight_sharer_file)

    def load_state(self, folderpath):
        weight_sharer_file = os.path.join(folderpath, "weight_sharer")
        self.weight_sharer.load(weight_sharer_file)

    def _compute_accuracy(self, inputs, outputs, dataset):
        nc = 0
        num_left = dataset.get_num_examples()

        set_is_training(outputs, False)