Example #1
0
 def wrapped(instance, *v, **k):
     started = time.time()
     try:
         return fun(instance, *v, **k)
     finally:
         elapsed = time.time() - started
         Logger.create(instance).debug(
                 '%s in %.2fs.', self.message, elapsed)
Example #2
0
    def __init__(self, indexer, params, save_path=DEFAULT_PATH):
        self.log = Logger.create(self)
        self.max_length = params.max_length
        self.batch_size = params.batch_size
        self.num_hidden = params.num_hidden
        self.keep_prob = params.keep_prob
        self.num_layers = params.num_layers
        self.epoch = params.epoch
        self.error = params.error
        self.save_path = save_path
        self.vector_dims = indexer.dimensions

        self.session = tf.Session(graph=tf.Graph())
        self.graph = self.reuse_graph()
        self.lookup = Lookup(indexer, self.max_length)
Example #3
0
 def __init__(self, size, evict_action):
     self.log = Logger.create(self)
     self.size = size
     self.cache = collections.OrderedDict()
     self.action = evict_action
Example #4
0
 def __init__(self):
     self.log = Logger.create(self)
     self.dictionary = {}
     self.vectors = []
     self.dimensions = None
Example #5
0
 def __init__(self, indexer):
     self.log = Logger.create(self)
     self.indexer = indexer