input
stringlengths
11
7.65k
target
stringlengths
22
8.26k
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def noun_chunks(doclike: Union[Doc, Span]) -> Iterator[Span]: """ Detect base noun phrases from a dependency parse. Works on both Doc and Span. """ # fmt: off labels = ["nsubj", "nsubj:pass", "obj", "iobj", "ROOT", "appos", "nmod", "nmod:poss"] # fmt: on doc = doclike.doc # Ensure works on ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __init__(self, leaf): self.leaf = leaf self.lchild = None self.rchild = None
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def get_leafs(self): if self.lchild == None and self.rchild == None: return [self.leaf] else: return self.lchild.get_leafs()+self.rchild.get_leafs()
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def get_level(self, level, queue): if queue == None: queue = [] if level == 1: queue.push(self) else: if self.lchild != None: self.lchild.get_level(level-1, queue) if self.rchild != None: self.rchild.get_level(level-1, queue) return queue
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def paint(self, c): self.leaf.paint(c) if self.lchild != None: self.lchild.paint(c) if self.rchild != None: self.rchild.paint(c)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __init__(self, x, y, w, h): self.x = x self.y = y self.w = w self.h = h self.center = (self.x+int(self.w/2),self.y+int(self.h/2)) self.distance_from_center = sqrt((self.center[0]-MAP_WIDTH/2)**2 + (self.center[1]-MAP_HEIGHT/2)**2)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def paint(self, c): c.stroke_rectangle(self.x, self.y, self.w, self.h)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def draw_path(self,c,container): c.path(self.center[0],self.center[1],container.center[0],container.center[1])
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __init__(self, w, h, color = "empty"): self.board = zeros((h,w), dtype=uint8) self.w = w self.h = h self.set_brush(color)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def set_brush(self, code): self.color = self.brushes[code]
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def stroke_rectangle(self, x, y, w, h): self.line(x,y,w,True) self.line(x,y+h-1,w,True) self.line(x,y,h,False) self.line(x+w-1,y,h,False)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def filled_rectangle(self, x, y, w, h): self.board[y:y+h,x:x+w] = self.color
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def line(self, x, y, length, horizontal): if horizontal: self.board[y,x:x+length] = self.color else: self.board[y:y+length,x] = self.color
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def path(self,x1,y1,x2,y2): self.board[y1:y2+1,x1:x2+1] = self.color
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def circle(self,x,y,r): for x_offset in range(-r,r+1): for y_offset in range(-r,r+1): if sqrt(x_offset**2+y_offset**2)<r: self.board[x+x_offset,y+y_offset] = self.color
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def draw(self): im = Image.fromarray(self.board) im.save(MAP_NAME)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __str__(self): return str(self.board)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __init__(self, container): self.x = container.x+randint(1, floor(container.w/3)) self.y = container.y+randint(1, floor(container.h/3)) self.w = container.w-(self.x-container.x) self.h = container.h-(self.y-container.y) self.w -= randint(0,floor(self.w/3)) self.h -= randint(0,floor(self.w/3)) self.envi...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def paint(self,c): c.filled_rectangle(self.x, self.y,self.w, self.h)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _split_vertical(container): r1 = None r2 = None min_w = int(W_RATIO*container.h)+1 if container.w < 2*min_w: return None r1 = Container(container.x,container.y,randint(min_w, container.w-min_w),container.h) r2 = Container(container.x+r1.w,container.y,container.w-r1.w,container.h) return [r1, r2]
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _split_horizontal(container): r1 = None r2 = None min_h = int(H_RATIO*container.w)+1 if container.h < 2*min_h: return None r1 = Container(container.x,container.y,container.w,randint(min_h, container.h-min_h)) r2 = Container(container.x,container.y+r1.h,container.w,container.h-r1.h) return [r1, r2]
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def split_container(container, iter): root = Tree(container) if iter != 0: sr = random_split(container) if sr!=None: root.lchild = split_container(sr[0], iter-1) root.rchild = split_container(sr[1], iter-1) return root
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def draw_paths(c, tree): if tree.lchild == None or tree.rchild == None: return tree.lchild.leaf.draw_path(c, tree.rchild.leaf) draw_paths(c, tree.lchild) draw_paths(c, tree.rchild)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def init(num_players): global MAP_WIDTH,MAP_HEIGHT,N_ITERATIONS,H_RATIO,W_RATIO,MIN_ROOM_SIDE,CENTER_HUB_HOLE,CENTER_HUB_RADIO,MAP_NAME MAP_WIDTH=int(500*sqrt(num_players)) MAP_HEIGHT=MAP_WIDTH N_ITERATIONS=log(MAP_WIDTH*100,2) H_RATIO=0.49 W_RATIO=H_RATIO MIN_ROOM_SIDE = 32 CENTER_HUB_HOLE = 32 CENTER_HUB_RAD...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def get_attn(attn_type): if isinstance(attn_type, torch.nn.Module): return attn_type module_cls = None if attn_type is not None: if isinstance(attn_type, str): attn_type = attn_type.lower() # Lightweight attention modules (channel and/or coarse spatial). #...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( region = dict(required=True, aliases = ['aws_region', 'ec2_region']), owner = dict(required=False, default=None), ami_id = dict(required=False), ami_tags = dict(required=Fal...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def start(self, action_name: str) -> None: """Defines how to start recording an action."""
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def install_secret_key(app, filename='secret_key'): """Configure the SECRET_KEY from a file in the instance directory. If the file does not exist, print instructions to create it from a shell with a random key, then exit. """ filename = os.path.join(app.instance_path, filename) try: ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def stop(self, action_name: str) -> None: """Defines how to record the duration once an action is complete."""
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def not_found(error): return render_template('404.html'), 404
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def summary(self) -> str: """Create profiler summary in text format."""
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def after_request(response): response.headers.add('X-Test', 'This is only test.') response.headers.add('Access-Control-Allow-Origin', '*') # TODO: set to real origin return response
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def setup(self, **kwargs: Any) -> None: """Execute arbitrary pre-profiling set-up steps as defined by subclass."""
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def teardown(self, **kwargs: Any) -> None: """Execute arbitrary post-profiling tear-down steps as defined by subclass."""
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __init__( self, dirpath: Optional[Union[str, Path]] = None, filename: Optional[str] = None, ) -> None: self.dirpath = dirpath self.filename = filename self._output_file: Optional[TextIO] = None self._write_stream: Optional[Callable] = None self._l...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def profile(self, action_name: str) -> Generator: """ Yields a context manager to encapsulate the scope of a profiled action. Example:: with self.profile('load training data'): # load training data code The profiler will start once you've entered the contex...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def profile_iterable(self, iterable: Iterable, action_name: str) -> Generator: iterator = iter(iterable) while True: try: self.start(action_name) value = next(iterator) self.stop(action_name) yield value except StopI...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _rank_zero_info(self, *args, **kwargs) -> None: if self._local_rank in (None, 0): log.info(*args, **kwargs)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _prepare_filename( self, action_name: Optional[str] = None, extension: str = ".txt", split_token: str = "-" ) -> str: args = [] if self._stage is not None: args.append(self._stage) if self.filename: args.append(self.filename) if self._local_rank is...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _prepare_streams(self) -> None: if self._write_stream is not None: return if self.filename: filepath = os.path.join(self.dirpath, self._prepare_filename()) fs = get_filesystem(filepath) file = fs.open(filepath, "a") self._output_file = file...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def describe(self) -> None: """Logs a profile report after the conclusion of run.""" # there are pickling issues with open file handles in Python 3.6 # so to avoid them, we open and close the files within this function # by calling `_prepare_streams` and `teardown` self._prepare_...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _stats_to_str(self, stats: Dict[str, str]) -> str: stage = f"{self._stage.upper()} " if self._stage is not None else "" output = [stage + "Profiler Report"] for action, value in stats.items(): header = f"Profile stats for: {action}" if self._local_rank is not None: ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def setup( self, stage: Optional[str] = None, local_rank: Optional[int] = None, log_dir: Optional[str] = None ) -> None: """Execute arbitrary pre-profiling set-up steps.""" self._stage = stage self._local_rank = local_rank self._log_dir = log_dir self.dirpath = self.d...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def teardown(self, stage: Optional[str] = None) -> None: """ Execute arbitrary post-profiling tear-down steps. Closes the currently open file and stream. """ self._write_stream = None if self._output_file is not None: self._output_file.close() sel...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __del__(self) -> None: self.teardown(stage=self._stage)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def start(self, action_name: str) -> None: raise NotImplementedError
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def stop(self, action_name: str) -> None: raise NotImplementedError
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def summary(self) -> str: raise NotImplementedError
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def local_rank(self) -> int: return 0 if self._local_rank is None else self._local_rank
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def start(self, action_name: str) -> None: pass
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def stop(self, action_name: str) -> None: pass
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __init__(self, model, data): # try and import pytorch global torch if torch is None: import torch if version.parse(torch.__version__) < version.parse("0.4"): warnings.warn("Your PyTorch version is older than 0.4 and not supported.") # check if...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __init__(self, reddit, term, config, oauth, url=None, submission=None): super(SubmissionPage, self).__init__(reddit, term, config, oauth) self.controller = SubmissionController(self, keymap=config.keymap) if url: self.content = SubmissionContent.from_url( reddit...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def add_target_handle(self, layer): input_handle = layer.register_forward_hook(get_target_input) self.target_handle = input_handle
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def toggle_comment(self): "Toggle the selected comment tree between visible and hidden" current_index = self.nav.absolute_index self.content.toggle(current_index) # This logic handles a display edge case after a comment toggle. We # want to make sure that when we re-draw the pa...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def add_handles(self, model, forward_handle, backward_handle): """ Add handles to all non-container layers in the model. Recursively for non-container layers """ handles_list = [] model_children = list(model.children()) if model_children: for child in ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def exit_submission(self): "Close the submission and return to the subreddit page" self.active = False
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def remove_attributes(self, model): """ Removes the x and y attributes which were added by the forward handles Recursively searches for non-container layers """ for child in model.children(): if 'nn.modules.container' in str(type(child)): self.remove_a...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def refresh_content(self, order=None, name=None): "Re-download comments and reset the page index" order = order or self.content.order url = name or self.content.name with self.term.loader('Refreshing page'): self.content = SubmissionContent.from_url( self.re...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def gradient(self, idx, inputs): self.model.zero_grad() X = [x.requires_grad_() for x in inputs] outputs = self.model(*X) selected = [val for val in outputs[:, idx]] grads = [] if self.interim: interim_inputs = self.layer.target_input for idx, inpu...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def prompt_subreddit(self): "Open a prompt to navigate to a different subreddit" name = self.term.prompt_input('Enter page: /') if name is not None: with self.term.loader('Loading page'): content = SubredditContent.from_name( self.reddit, name, se...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def shap_values(self, X, ranked_outputs=None, output_rank_order="max", check_additivity=False): # X ~ self.model_input # X_data ~ self.data # check if we have multiple inputs if not self.multi_input: assert type(X) != list, "Expected a single tensor model input!" ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def open_link(self): "Open the selected item with the webbrowser" data = self.get_selected_item() url = data.get('permalink') if url: self.term.open_browser(url) else: self.term.flash()
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def deeplift_grad(module, grad_input, grad_output): """The backward hook which computes the deeplift gradient for an nn.Module """ # first, get the module type module_type = module.__class__.__name__ # first, check the module is supported if module_type in op_handler: if op_handler[m...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def open_pager(self): "Open the selected item with the system's pager" data = self.get_selected_item() if data['type'] == 'Submission': text = '\n\n'.join((data['permalink'], data['text'])) self.term.open_pager(text) elif data['type'] == 'Comment': tex...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def add_interim_values(module, input, output): """The forward hook used to save interim tensors, detached from the graph. Used to calculate the multipliers """ try: del module.x except AttributeError: pass try: del module.y except AttributeError: pass modu...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def add_comment(self): """ Submit a reply to the selected item. Selected item: Submission - add a top level comment Comment - add a comment reply """ data = self.get_selected_item() if data['type'] == 'Submission': body = data['text']...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def get_target_input(module, input, output): """A forward hook which saves the tensor - attached to its graph. Used if we want to explain the interim outputs of a model """ try: del module.target_input except AttributeError: pass setattr(module, 'target_input', input)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def delete_comment(self): "Delete the selected comment" if self.get_selected_item()['type'] == 'Comment': self.delete_item() else: self.term.flash()
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def deeplift_tensor_grad(grad): return_grad = complex_module_gradients[-1] del complex_module_gradients[-1] return return_grad
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def comment_urlview(self): data = self.get_selected_item() comment = data.get('body') or data.get('text') or data.get('url_full') if comment: self.term.open_urlview(comment) else: self.term.flash()
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def passthrough(module, grad_input, grad_output): """No change made to gradients""" return None
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _draw_item(self, win, data, inverted): if data['type'] == 'MoreComments': return self._draw_more_comments(win, data) elif data['type'] == 'HiddenComment': return self._draw_more_comments(win, data) elif data['type'] == 'Comment': return self._draw_comment...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def maxpool(module, grad_input, grad_output): pool_to_unpool = { 'MaxPool1d': torch.nn.functional.max_unpool1d, 'MaxPool2d': torch.nn.functional.max_unpool2d, 'MaxPool3d': torch.nn.functional.max_unpool3d } pool_to_function = { 'MaxPool1d': torch.nn.functional.max_pool1d, ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _draw_comment(self, win, data, inverted): n_rows, n_cols = win.getmaxyx() n_cols -= 1 # Handle the case where the window is not large enough to fit the text. valid_rows = range(0, n_rows) offset = 0 if not inverted else -(data['n_rows'] - n_rows) # If there isn't e...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def linear_1d(module, grad_input, grad_output): """No change made to gradients.""" return None
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _draw_more_comments(self, win, data): n_rows, n_cols = win.getmaxyx() n_cols -= 1 self.term.add_line(win, '{body}'.format(**data), 0, 1) self.term.add_line( win, ' [{count}]'.format(**data), attr=curses.A_BOLD) attr = Color.get_level(data['level']) self...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def nonlinear_1d(module, grad_input, grad_output): delta_out = module.y[: int(module.y.shape[0] / 2)] - module.y[int(module.y.shape[0] / 2):] delta_in = module.x[: int(module.x.shape[0] / 2)] - module.x[int(module.x.shape[0] / 2):] dup0 = [2] + [1 for i in delta_in.shape[1:]] # handles numerical instab...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def wait_time_gen(): count = 0 while True: rand = random.randrange(round(interval.total_seconds())) tmp = round(start + interval.total_seconds() * count + rand - loop.time()) yield tmp count += 1
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def every_day(job, loop=None): return every(job, timedelta=timedelta(days=1), loop=loop)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def every_week(job, loop=None): return every(job, timedelta=timedelta(days=7), loop=loop)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _nearest_weekday(weekday): return datetime.now() + timedelta(days=(weekday - datetime.now().weekday()) % 7)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _every_weekday(job, weekday, loop=None): return every(job, timedelta=timedelta(days=7), start_at=_nearest_weekday(weekday), loop=loop)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def test_dummy_request(): from rasa.nlu.emulators.no_emulator import NoEmulator em = NoEmulator() norm = em.normalise_request_json({"text": ["arb text"]}) assert norm == {"text": "arb text", "time": None} norm = em.normalise_request_json({"text": ["arb text"], "time": "1499279161658"}) assert ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __init__(self): ApiCli.__init__(self) self.path = "v1/account/sources/" self.method = "GET"
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def test_dummy_response(): from rasa.nlu.emulators.no_emulator import NoEmulator em = NoEmulator() data = {"intent": "greet", "text": "hi", "entities": {}, "confidence": 1.0} assert em.normalise_response_json(data) == data
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __init__(self, root, transforms=None): super().__init__(root=root) self.transforms = transforms self._flow_list = [] self._image_list = []
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _read_img(self, file_name): img = Image.open(file_name) if img.mode != "RGB": img = img.convert("RGB") return img
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _read_flow(self, file_name): # Return the flow or a tuple with the flow and the valid_flow_mask if _has_builtin_flow_mask is True pass
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __getitem__(self, index): img1 = self._read_img(self._image_list[index][0]) img2 = self._read_img(self._image_list[index][1]) if self._flow_list: # it will be empty for some dataset when split="test" flow = self._read_flow(self._flow_list[index]) if self._has_built...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __len__(self): return len(self._image_list)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __rmul__(self, v): return torch.utils.data.ConcatDataset([self] * v)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __init__(self, root, split="train", pass_name="clean", transforms=None): super().__init__(root=root, transforms=transforms) verify_str_arg(split, "split", valid_values=("train", "test")) verify_str_arg(pass_name, "pass_name", valid_values=("clean", "final", "both")) passes = ["clean...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __getitem__(self, index): """Return example at given index. Args: index(int): The index of the example to retrieve Returns: tuple: A 3-tuple with ``(img1, img2, flow)``. The flow is a numpy array of shape (2, H, W) and the images are PIL images. ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _read_flow(self, file_name): return _read_flo(file_name)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __init__(self, root, split="train", transforms=None): super().__init__(root=root, transforms=transforms) verify_str_arg(split, "split", valid_values=("train", "test")) root = Path(root) / "KittiFlow" / (split + "ing") images1 = sorted(glob(str(root / "image_2" / "*_10.png"))) ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __getitem__(self, index): """Return example at given index. Args: index(int): The index of the example to retrieve Returns: tuple: A 4-tuple with ``(img1, img2, flow, valid_flow_mask)`` where ``valid_flow_mask`` is a numpy boolean mask of shape (H, W) ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _read_flow(self, file_name): return _read_16bits_png_with_flow_and_valid_mask(file_name)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __init__(self, root, split="train", transforms=None): super().__init__(root=root, transforms=transforms) verify_str_arg(split, "split", valid_values=("train", "val")) root = Path(root) / "FlyingChairs" images = sorted(glob(str(root / "data" / "*.ppm"))) flows = sorted(glob(...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __init__(self, root, split="train", pass_name="clean", camera="left", transforms=None): super().__init__(root=root, transforms=transforms) verify_str_arg(split, "split", valid_values=("train", "test")) split = split.upper() verify_str_arg(pass_name, "pass_name", valid_values=("clea...