inputs stringlengths 312 52k | targets stringlengths 1 3.1k ⌀ | block_type stringclasses 11
values | scenario stringclasses 7
values |
|---|---|---|---|
<filename>UHGEval/uhgeval/dataset/truthfulqa.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UHGEval/uhgeval/dataset/xinhua.py
def __init__(self, path: str, shuffle: bool = False, seed: int = 22):
self.data = []
if os.path.isfile(... | self.data = [] | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UHGEval/uhgeval/metric/common.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UHGEval/uhgeval/metric/tmp_common.py
def classifications(
predictions: list[bool],
references: list[bool]
) -> tuple[float, float, float, float]:
"""
... | return accuracy, precision, recall, f1 | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UHGEval/uhgeval/metric/common.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UHGEval/uhgeval/metric/tmp_common.py
def classifications(
predictions: list[bool],
references: list[bool]
) -> tuple[float, float, float, float]:
"""
... | f1 = 2 * (precision * recall) / (precision + recall) | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UHGEval/uhgeval/metric/common.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UHGEval/uhgeval/metric/tmp_common.py
def wrapper(*args, **kwargs):
try:
result = func(*args, **kwargs)
return result
e... | logger.warning(repr(e)) | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UHGEval/uhgeval/metric/common.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UHGEval/uhgeval/metric/tmp_common.py
def classifications(
predictions: list[bool],
references: list[bool]
) -> tuple[float, float, float, float]:
"""
... | false_positive = sum(1 for a, b in zip(references, predictions) if a == 0 and b == 1) | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UHGEval/uhgeval/metric/common.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UHGEval/uhgeval/metric/tmp_common.py
def classifications(
predictions: list[bool],
references: list[bool]
) -> tuple[float, float, float, float]:
"""
... | accuracy = sum(1 for a, b in zip(references, predictions) if a == b) / len(predictions) if len(predictions) > 0 else 0 | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UHGEval/uhgeval/metric/common.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UHGEval/uhgeval/metric/tmp_common.py
def classifications(
predictions: list[bool],
references: list[bool]
) -> tuple[float, float, float, float]:
"""
... | true_positive = sum(1 for a, b in zip(references, predictions) if a == 1 and b == 1) | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UHGEval/uhgeval/metric/common.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UHGEval/uhgeval/metric/tmp_common.py
def classifications(
predictions: list[bool],
references: list[bool]
) -> tuple[float, float, float, float]:
"""
... | precision = true_positive / (true_positive + false_positive) if (true_positive + false_positive) > 0 else 0 | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UHGEval/uhgeval/dataset/truthfulqa.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UHGEval/uhgeval/dataset/xinhua.py
def load(self) -> list[dict]:
return self.data[:]
# UHGEval/uhgeval/dataset/base.py
def load(self) -> list... | return self.data[:] | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UHGEval/uhgeval/metric/common.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UHGEval/uhgeval/metric/tmp_common.py
def wrapper(*args, **kwargs):
try:
result = func(*args, **kwargs)
return result
e... | return result | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UHGEval/uhgeval/metric/common.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UHGEval/uhgeval/metric/tmp_common.py
def classifications(
predictions: list[bool],
references: list[bool]
) -> tuple[float, float, float, float]:
"""
... | if precision + recall == 0:
f1 = 0
else:
f1 = 2 * (precision * recall) / (precision + recall) | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UHGEval/uhgeval/metric/common.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UHGEval/uhgeval/metric/tmp_common.py
def wrapper(*args, **kwargs):
try:
result = func(*args, **kwargs)
return result
e... | try:
result = func(*args, **kwargs)
return result | TRY | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UHGEval/uhgeval/metric/common.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UHGEval/uhgeval/metric/tmp_common.py
def wrapper(*args, **kwargs):
try:
result = func(*args, **kwargs)
return result
e... | except Exception as e:
logger.warning(repr(e)) | CATCH | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UHGEval/uhgeval/metric/common.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UHGEval/uhgeval/metric/tmp_common.py
def classifications(
predictions: list[bool],
references: list[bool]
) -> tuple[float, float, float, float]:
"""
... | """
Calculate accuracy, precision, recall, and F1 in a binary classification problem.
Args:
predictions (list[bool]): List of predicted values (0 or 1).
references (list[bool]): List of true values (0 or 1).
Returns:
tuple: Accuracy, precision, recall, and F1 scores.
""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/structures/image_list.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/projects/UniRef/uniref/models/segment_anything/utils/transforms.py
def apply_boxes_torch(
self, boxes: torch.Tensor, original_size: T... | """
Access the individual image in its original size.
Args:
idx: int or slice
Returns:
Tensor: an image of shape (H, W) or (C_1, ..., C_K, H, W) where K >= 1
""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/solver/build.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/engine/hooks.py
def load_state_dict(self, state_dict):
if isinstance(self.scheduler, torch.optim.lr_scheduler._LRScheduler):
... | """
Build a LR scheduler from config.
""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/tracking/bbox_iou_tracker.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/tracking/hungarian_tracker.py
def _process_unmatched_idx(self, instances: Instances, matched_idx: np.ndarray) -> Instances:
... | """
For each untracked instance, assign a new id
Args:
instances: D2 Instances, for predictions of the current frame
Return:
D2 Instances with new ID assigned
""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/structures/masks.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/projects/UniRef/uniref/util/box_ops.py
def masks_to_boxes(masks):
"""Compute the bounding boxes around the provided masks
The masks should be... | """
Returns:
Boxes: tight bounding boxes around bitmasks.
If a mask is empty, it's bounding box will be all zero.
""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/tracking/bbox_iou_tracker.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/tracking/base_tracker.py
def __init__(self, **kwargs):
self._prev_instances = None # (D2)instances for previous frame... | """
Before each uodate call, reset fields first
""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/structures/boxes.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/structures/rotated_boxes.py
def __getitem__(self, item) -> "RotatedBoxes":
"""
Returns:
RotatedBoxes: Creat... | """
Args:
item: int, slice, or a BoolTensor
Returns:
Boxes: Create a new :class:`Boxes` by indexing.
The following usage are allowed:
1. `new_boxes = boxes[3]`: return a `Boxes` which contains only one box.
2. `new_boxes = boxes[2:10]`: return a slice o... | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/structures/instances.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/data/catalog.py
def set(self, **kwargs):
"""
Set multiple metadata with kwargs.
"""
for k, v in kwa... | """
Args:
image_size (height, width): the spatial size of the image.
kwargs: fields to add to this `Instances`.
""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/structures/masks.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/utils/visualizer.py
def overlay_instances(
self,
*,
boxes=None,
labels=None,
masks=None,
... | """
Arguments:
polygons (list[list[np.ndarray]]): The first
level of the list correspond to individual instances,
the second level to all the polygons that compose the
instance, and the third level to the polygon coordinates.
The third ... | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/config/instantiate.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/config/lazy.py
def __call__(self, **kwargs):
if is_dataclass(self._target):
# omegaconf object cannot hold datacl... | """
Recursively instantiate objects defined in dictionaries by
"_target_" and arguments.
Args:
cfg: a dict-like object with "_target_" that defines the caller, and
other keys that define the arguments
Returns:
object instantiated by cfg
""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/tracking/bbox_iou_tracker.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/tracking/hungarian_tracker.py
def _initialize_extra_fields(self, instances: Instances) -> Instances:
"""
If in... | """
If input instances don't have ID, ID_period, lost_frame_count fields,
this method is used to initialize these fields.
Args:
instances: D2 Instances, for predictions of the current frame
Return:
D2 Instances with extra fields added
""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/tracking/bbox_iou_tracker.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/tracking/hungarian_tracker.py
def _initialize_extra_fields(self, instances: Instances) -> Instances:
"""
If in... | self._id_count += len(instances) | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/external/davis2017-evaluation/davis2017/metrics.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/external/lvos-evaluation/lvos/metrics.py
def db_eval_iou(annotation, segmentation, void_pixels=None):
""" Compute region simil... | inters = np.sum((segmentation & annotation) & np.logical_not(void_pixels), axis=(-2, -1)) | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/layers/losses.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/utils/events.py
def put_image(self, img_name, img_tensor):
"""
Add an `img_tensor` associated with `img_name`, to be shown... | intsct[mask] = (xkis2[mask] - xkis1[mask]) * (ykis2[mask] - ykis1[mask]) | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/layers/losses.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/utils/events.py
def put_image(self, img_name, img_tensor):
"""
Add an `img_tensor` associated with `img_name`, to be shown... | xc1 = torch.min(x1, x1g) | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/tracking/hungarian_tracker.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/tracking/bbox_iou_tracker.py
def _merge_untracked_instances(self, instances: Instances) -> Instances:
"""
For... | untracked_instances.pred_classes = torch.IntTensor(untracked_instances.pred_classes) | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/checkpoint/c2_model_loading.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/projects/UniRef/uniref/models/segment_anything/modeling/transformer.py
def _separate_heads(self, x: Tensor, num_heads: int) -> Tensor:
... | m1, m2 = min(names), max(names) | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/structures/masks.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/utils/visualizer.py
def polygons_to_mask(self, polygons):
rle = mask_util.frPyObjects(polygons, self.height, self.width)
... | return mask_util.decode(rle).astype(np.bool) | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/structures/masks.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/projects/UniRef/uniref/util/box_ops.py
def masks_to_boxes(masks):
"""Compute the bounding boxes around the provided masks
The masks should be... | boxes[idx, 2:] = maxxy | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/layers/losses.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/evaluation/refcocoeval.py
def compute_mask_iou(outputs: torch.Tensor, labels: torch.Tensor, EPS=1e-6):
outputs = outputs.int()
interse... | x_g = (x1g + x2g) / 2 | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/tracking/hungarian_tracker.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/tracking/bbox_iou_tracker.py
def _merge_untracked_instances(self, instances: Instances) -> Instances:
"""
For... | untracked_instances.ID.append(self._prev_instances.ID[idx]) | STATEMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/tracking/hungarian_tracker.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/tracking/bbox_iou_tracker.py
def _initialize_extra_fields(self, instances: Instances) -> Instances:
"""
If in... | if not instances.has("lost_frame_count"):
instances.set("lost_frame_count", [None] * len(instances)) | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/external/davis2017-evaluation/davis2017/metrics.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/external/lvos-evaluation/lvos/metrics.py
def f_measure(foreground_mask, gt_mask, void_pixels=None, bound_th=0.008):
"""
Co... | if precision + recall == 0:
F = 0
else:
F = 2 * precision * recall / (precision + recall) | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/config/config.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/data/transforms/augmentation.py
def _get_aug_input_args(aug, aug_input) -> List[Any]:
"""
Get the arguments to be passed to ``aug.get_... | if support_var_arg: # forward all arguments to from_config, if from_config accepts them
ret = from_config_func(*args, **kwargs)
else:
# forward supported arguments to from_config
supported_arg_names = set(signature.parameters.keys())
extra_kwargs = {}
for name in list(kwargs... | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/tracking/bbox_iou_tracker.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/tracking/hungarian_tracker.py
def _initialize_extra_fields(self, instances: Instances) -> Instances:
"""
If in... | if not instances.has("ID_period"):
instances.set("ID_period", [None] * len(instances)) | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/config/instantiate.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/config/lazy.py
def __call__(self, **kwargs):
if is_dataclass(self._target):
# omegaconf object cannot hold datacl... | if isinstance(cls, str):
cls_name = cls
cls = locate(cls_name)
assert cls is not None, cls_name
else:
try:
cls_name = cls.__module__ + "." + cls.__qualname__
except Exception:
# target could be anything, so the above cou... | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/tracking/bbox_iou_tracker.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/tracking/hungarian_tracker.py
def _initialize_extra_fields(self, instances: Instances) -> Instances:
"""
If in... | if not instances.has("ID"):
instances.set("ID", [None] * len(instances)) | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/structures/instances.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/export/c10.py
def __getattr__(self, name):
if name not in self.batch_extra_fields:
raise AttributeError("Cannot... | if name == "_fields" or name not in self._fields:
raise AttributeError("Cannot find field '{}' in the given Instances!".format(name)) | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/tracking/bbox_iou_tracker.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/tracking/hungarian_tracker.py
def _initialize_extra_fields(self, instances: Instances) -> Instances:
"""
If in... | if not instances.has("lost_frame_count"):
instances.set("lost_frame_count", [None] * len(instances)) | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/tracking/bbox_iou_tracker.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/tracking/hungarian_tracker.py
def _initialize_extra_fields(self, instances: Instances) -> Instances:
"""
If in... | if self._prev_instances is None:
instances.ID = list(range(len(instances)))
self._id_count += len(instances)
instances.ID_period = [1] * len(instances)
instances.lost_frame_count = [0] * len(instances) | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/tracking/hungarian_tracker.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/tracking/bbox_iou_tracker.py
def _merge_untracked_instances(self, instances: Instances) -> Instances:
"""
For... | if instances.has("pred_masks"):
untracked_instances.pred_masks.append(prev_masks[idx].numpy().astype(np.uint8)) | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/structures/boxes.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/structures/rotated_boxes.py
def pairwise_iou(boxes1: RotatedBoxes, boxes2: RotatedBoxes) -> None:
"""
Given two lists of rotated bo... | # [M] | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/structures/boxes.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/structures/rotated_boxes.py
def __init__(self, tensor: torch.Tensor):
"""
Args:
tensor (Tensor[float]): a N... | # the inputs (and consequently confuses jit) | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/checkpoint/c2_model_loading.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/export/caffe2_export.py
def export_caffe2_detection_model(model: torch.nn.Module, tensor_inputs: List[torch.Tensor]):
"""
... | # RPN hidden representation conv | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/external/davis2017-evaluation/davis2017/metrics.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/external/lvos-evaluation/lvos/metrics.py
def f_measure(foreground_mask, gt_mask, void_pixels=None, bound_th=0.008):
"""
Co... | # Get the pixel boundaries of both masks | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/checkpoint/c2_model_loading.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/utils/logger.py
def log_every_n_seconds(lvl, msg, n=1, *, name=None):
"""
Log no more than once per n seconds.
Args... | # ckpt_key string, if it matches | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/tracking/iou_weighted_hungarian_bbox_iou_tracker.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/tracking/vanilla_hungarian_bbox_iou_tracker.py
def assign_cost_matrix_values(self, cost_matrix: np.ndar... | # assign (-1 * IoU) for above threshold pairs, algorithms will minimize cost | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/external/davis2017-evaluation/davis2017/metrics.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/external/lvos-evaluation/lvos/metrics.py
def db_eval_iou(annotation, segmentation, void_pixels=None):
""" Compute region simil... | # Intersection between all sets | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/checkpoint/c2_model_loading.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/export/caffe2_export.py
def export_caffe2_detection_model(model: torch.nn.Module, tensor_inputs: List[torch.Tensor]):
"""
... | # remove the meaningless prediction weight for background class | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/config/instantiate.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/config/lazy.py
def __call__(self, **kwargs):
if is_dataclass(self._target):
# omegaconf object cannot hold datacl... | # return as-is if don't know what to do | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/checkpoint/c2_model_loading.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/export/caffe2_export.py
def export_caffe2_detection_model(model: torch.nn.Module, tensor_inputs: List[torch.Tensor]):
"""
... | # -------------------------------------------------------------------------- | LINE_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/structures/masks.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/projects/UniRef/uniref/util/box_ops.py
def masks_to_boxes(masks):
"""Compute the bounding boxes around the provided masks
The masks should be... | for idx, polygons_per_instance in enumerate(self.polygons):
minxy = torch.as_tensor([float("inf"), float("inf")], dtype=torch.float32)
maxxy = torch.zeros(2, dtype=torch.float32)
for polygon in polygons_per_instance:
coords = torch.from_numpy(polygon).view(-1, 2).to(d... | FOR | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/checkpoint/c2_model_loading.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/utils/logger.py
def log_every_n_seconds(lvl, msg, n=1, *, name=None):
"""
Log no more than once per n seconds.
Args... | for idx_model, idx_ckpt in enumerate(idxs.tolist()):
if idx_ckpt == -1:
continue
key_model = model_keys[idx_model]
key_ckpt = ckpt_keys[idx_ckpt]
value_ckpt = ckpt_state_dict[key_ckpt]
shape_in_model = model_state_dict[key_model].shape
if shape_in_model != va... | FOR | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/structures/masks.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/projects/UniRef/uniref/util/box_ops.py
def masks_to_boxes(masks):
"""Compute the bounding boxes around the provided masks
The masks should be... | for idx in range(self.tensor.shape[0]):
x = torch.where(x_any[idx, :])[0]
y = torch.where(y_any[idx, :])[0]
if len(x) > 0 and len(y) > 0:
boxes[idx, :] = torch.as_tensor(
[x[0], y[0], x[-1] + 1, y[-1] + 1], dtype=torch.float32
) | FOR | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/tracking/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/tracking/bbox_iou_tracker.py
def _create_prediction_pairs(
self, instances: Instances, iou_all: np.ndarray
) -> List:
... | for j in range(len(prev_instances)):
if iou_all[i, j] < threshold:
continue
bbox_pairs.append(
{
"idx": i,
"prev_idx": j,
"prev_id": prev_instances.ID[j],
"IoU": iou_all[i, j],
... | FOR | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/tracking/bbox_iou_tracker.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/tracking/utils.py
def create_prediction_pairs(
instances: Instances,
prev_instances: Instances,
iou_all: np.ndarray,
... | for j in range(len(self._prev_instances)):
bbox_pairs.append(
{
"idx": i,
"prev_idx": j,
"prev_id": self._prev_instances.ID[j],
"IoU": iou_all[i, j],
"prev_period":... | FOR | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/tracking/bbox_iou_tracker.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/tracking/hungarian_tracker.py
def update(self, instances: Instances) -> Instances:
if instances.has("pred_keypoints"):... | for bbox_pair in bbox_pairs:
idx = bbox_pair["idx"]
prev_id = bbox_pair["prev_id"]
if idx in self._matched_idx \
or prev_id in self._matched_ID \
or bbox_pair["IoU"] < self._track_iou_threshold:
continue
... | FOR | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/tracking/hungarian_tracker.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/tracking/bbox_iou_tracker.py
def _assign_new_id(self, instances: Instances) -> Instances:
"""
For each untrac... | for i in range(matched_idx.size):
instances.ID[matched_idx[i]] = self._prev_instances.ID[matched_prev_idx[i]]
instances.ID_period[matched_idx[i]] = \
self._prev_instances.ID_period[matched_prev_idx[i]] + 1
instances.lost_frame_count[matched_idx[i]] = 0 | FOR | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/tracking/bbox_iou_tracker.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/tracking/utils.py
def create_prediction_pairs(
instances: Instances,
prev_instances: Instances,
iou_all: np.ndarray,
... | for i in range(len(instances)):
for j in range(len(self._prev_instances)):
bbox_pairs.append(
{
"idx": i,
"prev_idx": j,
"prev_id": self._prev_instances.ID[j],
"IoU": iou_all[i... | FOR | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/tracking/hungarian_tracker.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/tracking/bbox_iou_tracker.py
def _assign_new_id(self, instances: Instances) -> Instances:
"""
For each untrac... | for idx in untracked_idx:
instances.ID[idx] = self._id_count
self._id_count += 1
instances.ID_period[idx] = 1
instances.lost_frame_count[idx] = 0 | FOR | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/external/davis2017-evaluation/davis2017/metrics.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/external/lvos-evaluation/lvos/metrics.py
def _seg2bmap(seg, width=None, height=None):
"""
From a segmentation, compute a b... | for y in range(h):
if b[y, x]:
j = 1 + math.floor((y - 1) + height / h)
i = 1 + math.floor((x - 1) + width / h)
bmap[j, i] = 1 | FOR | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/config/instantiate.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/config/lazy.py
def __call__(self, **kwargs):
if is_dataclass(self._target):
# omegaconf object cannot hold datacl... | from omegaconf import ListConfig | IMPORT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/layers/roi_align.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/layers/roi_align_rotated.py
def __init__(self, output_size, spatial_scale, sampling_ratio):
"""
Args:
outpu... | from torchvision import __version__ | IMPORT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/external/davis2017-evaluation/davis2017/metrics.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/external/lvos-evaluation/lvos/metrics.py
def f_measure(foreground_mask, gt_mask, void_pixels=None, bound_th=0.008):
"""
Co... | from skimage.morphology import disk | IMPORT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/utils/registry.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/data/catalog.py
def get(self, name):
"""
Call the registered function and return its results.
Args:
... | from hydra.utils import _locate | IMPORT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/config/config.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/config/compat.py
def upgrade_config(cfg: CN, to_version: Optional[int] = None) -> CN:
"""
Upgrade a config from its current version to... | from .defaults import _C | IMPORT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/checkpoint/c2_model_loading.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/utils/logger.py
def log_every_n_seconds(lvl, msg, n=1, *, name=None):
"""
Log no more than once per n seconds.
Args... | def match(a, b):
# Matched ckpt_key should be a complete (starts with '.') suffix.
# For example, roi_heads.mesh_head.whatever_conv1 does not match conv1,
# but matches whatever_conv1 or mesh_head.whatever_conv1.
return a == b or a.endswith("." + b) | METHOD | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/structures/masks.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/utils/visualizer.py
def overlay_instances(
self,
*,
boxes=None,
labels=None,
masks=None,
... | def process_polygons(
polygons_per_instance: List[Union[torch.Tensor, np.ndarray]]
) -> List[np.ndarray]:
if not isinstance(polygons_per_instance, list):
raise ValueError(
"Cannot create polygons: Expect a list of polygons per instance. "
... | METHOD | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/checkpoint/c2_model_loading.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/export/caffe2_export.py
def export_caffe2_detection_model(model: torch.nn.Module, tensor_inputs: List[torch.Tensor]):
"""
... | def fpn_map(name):
"""
Look for keys with the following patterns:
1) Starts with "fpn.inner."
Example: "fpn.inner.res2.2.sum.lateral.weight"
Meaning: These are lateral pathway convolutions
2) Starts with "fpn.res"
Example: "fpn.res2.2.sum.weight"
... | METHOD | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/checkpoint/c2_model_loading.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/utils/events.py
def latest(self):
"""
Returns:
dict[str -> (float, int)]: mapping from the name ... | def _submodule_name(key):
pos = key.rfind(".")
if pos < 0:
return None
prefix = key[: pos + 1]
return prefix | METHOD | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/config/config.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/data/transforms/augmentation.py
def _get_aug_input_args(aug, aug_input) -> List[Any]:
"""
Get the arguments to be passed to ``aug.get_... | def wrapped(self, *args, **kwargs):
try:
from_config_func = type(self).from_config
except AttributeError as e:
raise AttributeError(
"Class with @configurable must have a 'from_config' classmethod."
) from e
if not i... | METHOD | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/structures/masks.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/utils/visualizer.py
def overlay_instances(
self,
*,
boxes=None,
labels=None,
masks=None,
... | def _make_array(t: Union[torch.Tensor, np.ndarray]) -> np.ndarray:
# Use float64 for higher precision, because why not?
# Always put polygons on CPU (self.to is a no-op) since they
# are supposed to be small tensors.
# May need to change this assumption if GPU placement b... | METHOD | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/config/config.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/data/transforms/augmentation.py
def _get_aug_input_args(aug, aug_input) -> List[Any]:
"""
Get the arguments to be passed to ``aug.get_... | def wrapped(*args, **kwargs):
if _called_with_cfg(*args, **kwargs):
explicit_args = _get_args_from_config(from_config, *args, **kwargs)
return orig_func(**explicit_args)
else:
return orig_func(*args, **kwargs) | METHOD | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/utils/registry.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/data/catalog.py
def get(self, name):
"""
Call the registered function and return its results.
Args:
... | try:
# from hydra.utils import get_method - will print many errors
from hydra.utils import _locate | TRY | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/config/instantiate.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/config/lazy.py
def __call__(self, **kwargs):
if is_dataclass(self._target):
# omegaconf object cannot hold datacl... | try:
return cls(**cfg) | TRY | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/config/instantiate.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/config/lazy.py
def __call__(self, **kwargs):
if is_dataclass(self._target):
# omegaconf object cannot hold datacl... | try:
cls_name = cls.__module__ + "." + cls.__qualname__ | TRY | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/config/config.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/data/transforms/augmentation.py
def _get_aug_input_args(aug, aug_input) -> List[Any]:
"""
Get the arguments to be passed to ``aug.get_... | try:
from_config_func = type(self).from_config | TRY | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/config/instantiate.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/config/lazy.py
def __call__(self, **kwargs):
if is_dataclass(self._target):
# omegaconf object cannot hold datacl... | except Exception:
# target could be anything, so the above could fail
cls_name = str(cls) | CATCH | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/utils/registry.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/data/catalog.py
def get(self, name):
"""
Call the registered function and return its results.
Args:
... | except ImportError as e:
raise ImportError(f"Cannot dynamically locate object {name}!") from e | CATCH | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/config/config.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/data/transforms/augmentation.py
def _get_aug_input_args(aug, aug_input) -> List[Any]:
"""
Get the arguments to be passed to ``aug.get_... | except AttributeError as e:
raise AttributeError(
"Class with @configurable must have a 'from_config' classmethod."
) from e | CATCH | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>UniRef/detectron2/config/instantiate.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# UniRef/detectron2/config/lazy.py
def __call__(self, **kwargs):
if is_dataclass(self._target):
# omegaconf object cannot hold datacl... | except TypeError:
logger = logging.getLogger(__name__)
logger.error(f"Error when instantiating {cls_name}!")
raise | CATCH | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>camp_zipnerf/internal/spin_math.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# camp_zipnerf/internal/render.py
def gaussianize_frustum(t0, t1):
"""Convert intervals along a conical frustum into means and variances."""
# A more stable v... | """Maps the input according to the generalized bias and gain function.
References:
https://arxiv.org/abs/2010.09714
Args:
x: The inputs array with values in [0, 1] to map.
slope: The slope parameter of the curve which controls the slope of the
curve at the threshold.
threshold: The value at ... | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>camp_zipnerf/internal/stepfun.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# camp_zipnerf/internal/coord.py
def track_isotropic(fn, mean, scale):
"""Apply function `fn` to a set of means and scales, ala a Kalman filter.
This is the is... | """Compute the cumulative sum of w, assuming all weight vectors sum to 1.
The output's size on the last dimension is one greater than that of the input,
because we're computing the integral corresponding to the endpoints of a step
function, not the integral of the interior/bin values.
Args:
w: Tensor, whi... | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>camp_zipnerf/internal/render.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# camp_zipnerf/internal/math.py
def sorted_interp(
x, xp, fp, device_is_tpu, eps=jnp.finfo(jnp.float32).eps ** 2
):
"""A version of interp() where xp and fp mu... | """Convert intervals along a conical frustum into means and variances.""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>camp_zipnerf/internal/math.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# camp_zipnerf/internal/train_utils.py
def summarize_tree(fn, tree, ancestry=(), max_depth=3):
"""Flatten 'tree' while 'fn'-ing values and formatting keys like/this.... | """fn() with clipped inputs.""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>camp_zipnerf/internal/linspline.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# camp_zipnerf/internal/stepfun.py
def blur_and_resample_weights(tq, t, w, blur_halfwidth):
"""Blur the (t, w) histogram by blur_halfwidth, then resample it int... | """Integrate a linear spline into a piecewise quadratic spline.""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>camp_zipnerf/internal/ref_utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# camp_zipnerf/internal/camera_utils.py
def cast_spherical_rays(
camtoworld,
height,
width,
near,
far,
xnp,
):
"""Generates a spherical ... | """Compute spherical harmonic coefficients.""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>camp_zipnerf/internal/math.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# camp_zipnerf/internal/train_utils.py
def summarize_tree(fn, tree, ancestry=(), max_depth=3):
"""Flatten 'tree' while 'fn'-ing values and formatting keys like/this.... | """Backpropagate using the gradient and clipped inputs.""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>camp_zipnerf/internal/render.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# camp_zipnerf/internal/ref_utils.py
def reflect(viewdirs, normals):
"""Reflect view directions about normals.
The reflection of a vector v about a unit vector ... | """Approximate a cylinder as a Gaussian distribution (mean+cov).
Assumes the ray is originating from the origin, and radius is the
radius. Does not renormalize `d`.
Args:
d: jnp.float32 3-vector, the axis of the cylinder
t0: float, the starting distance of the cylinder.
t1: float, the ending distanc... | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>camp_zipnerf/internal/coord.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# camp_zipnerf/internal/math.py
def safe_sin(x):
"""jnp.sin() on a TPU may NaN out for large values."""
return safe_trig_helper(x, jnp.sin)
# camp_zipnerf/intern... | """Compute the mean of sin(x), x ~ N(mean, var).""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>camp_zipnerf/internal/math.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# camp_zipnerf/internal/geometry.py
def spherical_to_cartesian(
r,
theta,
phi,
):
"""Converts spherical to cartesian coordinates.
For more details see... | """Clamps `x` from below to be positive.""" | BLOCK_COMMENT | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>camp_zipnerf/internal/stepfun.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# camp_zipnerf/internal/rigid_body.py
def exp_so3(
axis_angle, eps=jnp.finfo(jnp.float32).eps
):
"""Exponential map from Lie algebra so3 to Lie group SO3.
... | if deterministic_center:
pad = 1 / (2 * num_samples)
u = jnp.linspace(pad, 1.0 - pad - eps, num_samples)
else:
u = jnp.linspace(0, 1.0 - eps, num_samples) | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>camp_zipnerf/internal/coord.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# camp_zipnerf/internal/stepfun.py
def integrate_weights(w):
"""Compute the cumulative sum of w, assuming all weight vectors sum to 1.
The output's size on the l... | if scale is not None:
# Compute the Jacobian of fn function at the locations of each mean.
jac = jax.vmap(lin_fn, in_axes=-1, out_axes=-1)(
jnp.broadcast_to(jnp.eye(d), mean.shape + (d,))
)
# The cube root of the determinant of the Jacobian is the geometric mean
# of the eigenvalues of the ... | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>camp_zipnerf/internal/stepfun.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# camp_zipnerf/internal/rigid_body.py
def exp_so3(
axis_angle, eps=jnp.finfo(jnp.float32).eps
):
"""Exponential map from Lie algebra so3 to Lie group SO3.
... | if rng is None:
# Match the behavior of jax.random.uniform() by spanning [0, 1-eps].
if deterministic_center:
pad = 1 / (2 * num_samples)
u = jnp.linspace(pad, 1.0 - pad - eps, num_samples)
else:
u = jnp.linspace(0, 1.0 - eps, num_samples)
u = jnp.broadcast_to(u, t.shape[:-1] + (num_sa... | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# camp_zipnerf/internal/datasets.py
def __init__(self, dataset: Dataset):
super().__init__()
self._queue = queue.Queue(3) # Set prefetch buffer to 3 batch... | if not populating_data and results_queue.empty():
break | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>camp_zipnerf/internal/coord.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# camp_zipnerf/internal/spin_math.py
def safe_sqrt(x,
*,
eps = jnp.finfo(jnp.float32).eps,
value_at_zero = 0.0):
"""A safe... | if mode == 'fast':
det = jnp.linalg.det(cov)
diag_val = det ** (1 / d)
is_invalid = (det <= jnp.finfo(jnp.float32).tiny) | ~jnp.isfinite(det)
elif mode == 'accurate':
log_det = jnp.linalg.slogdet(cov)[1]
diag_val = jnp.exp(log_det / d)
is_invalid = ~jnp.isfinite(log_det)
else:
raise Valu... | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you:
# camp_zipnerf/internal/datasets.py
def __init__(self, dataset: Dataset):
super().__init__()
self._queue = queue.Queue(3) # Set prefetch buffer to 3 batch... | if not populating_data and results_queue.empty():
break | IF | prefix_suffix_full_complete_current_block_with_repo_rag_oracle |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.