def train_batches(model, X_train, ids, run_options=None, run_metadata=None):
    for batch in gen.generate_batch_pairs(model.params,
                                          ids,
                                          generate_triplets=False):
        feed_dict = {
            model.x: X_train[batch['batch_samples']],
            model.pos_comps: batch['pos_comps'],
            model.neg_comps: batch['neg_comps']
        }
        yield batch['batch_idx'], feed_dict
def train_batches(model, X_train, ids, run_options=None, run_metadata=None):
    batch_idx = 0
    losses = [model.optimizer, model.cost]
    for batch in gen.generate_batch_pairs(model.params,
                                          ids,
                                          generate_triplets=False):
        feed_dict = {
            model.x: X_train[batch['batch_samples']],
            model.pos_comps: batch['pos_comps'],
            model.neg_comps: batch['neg_comps'],
            model.n_pos_comps: len(batch['pos_comps']),
            model.n_neg_comps: len(batch['neg_comps'])
        }
        yield batch['batch_idx'], feed_dict
예제 #3
0
def train_batches(model,X_train, ids, run_options=None, run_metadata=None):
    for batch in gen.generate_batch_pairs(model.params,ids, generate_triplets=False):
            feed_dict = {model.x:X_train[batch['batch_samples']],
                         model.batch_ids:batch['batch_ids'],
                         model.n_classes:len(np.unique(batch['batch_ids']))}
            yield batch['batch_idx'], feed_dict