This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
import time | |
from collections import deque | |
from threading import Thread | |
import numpy as np | |
class TemporalQueue: | |
def __init__(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import torch | |
import itertools | |
def make_pairs_ids(nregion, bsize): | |
pairs_ids = [] | |
for batch_id in range(bsize): | |
pairs_id = torch.LongTensor([ | |
(batch_id,i,j) for i,j in \ | |
itertools.product(range(nregion),repeat=2)]) |