Esempio n. 1
0
def sample_multithread(sess,
                       ts_batch_que,
                       loss,
                       sd_z,
                       x,
                       x_sample,
                       y,
                       nlf0,
                       nlf1,
                       iso,
                       cam,
                       is_training,
                       sample_epoch_loss_que,
                       sd_z_que,
                       kldiv_que,
                       test_its,
                       nthr=8,
                       requeue=False,
                       sc_sd=1,
                       epoch=0):
    divs = divide_parts(test_its, nthr)
    threads = []
    for thr_id in range(nthr):
        threads.append(
            Thread(target=sample_thread,
                   args=(thr_id, divs[thr_id], sess, ts_batch_que, loss, sd_z,
                         x, x_sample, y, nlf0, nlf1, iso, cam, is_training,
                         sample_epoch_loss_que, sd_z_que, kldiv_que, requeue,
                         sc_sd, epoch)))
        threads[thr_id].start()
    for thr_id in range(nthr):
        threads[thr_id].join()
Esempio n. 2
0
def train_multithread(sess,
                      tr_batch_que,
                      loss,
                      sd_z,
                      train_op,
                      x,
                      y,
                      nlf0,
                      nlf1,
                      iso,
                      cam,
                      lr,
                      is_training,
                      _lr,
                      n_processed_que,
                      train_epoch_loss_que,
                      sd_z_que,
                      train_its,
                      nthr=8,
                      requeue=False):
    divs = divide_parts(train_its, nthr)
    threads = []
    for thr_id in range(nthr):
        threads.append(
            Thread(target=train_thread,
                   args=(thr_id, divs[thr_id], sess, tr_batch_que, loss, sd_z,
                         train_op, x, y, nlf0, nlf1, iso, cam, lr, is_training,
                         _lr, n_processed_que, train_epoch_loss_que, sd_z_que,
                         requeue)))
        threads[thr_id].start()
    for thr_id in range(nthr):
        threads[thr_id].join()
Esempio n. 3
0
def test_multithread(sess,
                     ts_batch_que,
                     loss,
                     sd_z,
                     x,
                     y,
                     nlf0,
                     nlf1,
                     iso,
                     cam,
                     is_training,
                     test_epoch_loss_que,
                     sd_z_que,
                     test_its,
                     nthr=8,
                     requeue=False):
    divs = divide_parts(test_its, nthr)
    threads = []
    for thr_id in range(nthr):
        threads.append(
            Thread(target=test_thread,
                   args=(thr_id, divs[thr_id], sess, ts_batch_que, loss, sd_z,
                         x, y, nlf0, nlf1, iso, cam, is_training,
                         test_epoch_loss_que, sd_z_que, requeue)))
        threads[thr_id].start()
    for thr_id in range(nthr):
        threads[thr_id].join()