repo stringlengths 1 99 | file stringlengths 13 215 | code stringlengths 12 59.2M | file_length int64 12 59.2M | avg_line_length float64 3.82 1.48M | max_line_length int64 12 2.51M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
BrAD | BrAD-main/main_brad_test.py | import pickle
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
import warnings
import random
import numpy as np
import time
import os
from utils.helpers import getTransforms
from main_brad import init_ddp
import moco.builder as mb
from config import parser, setup
from utils import domainnet
impor... | 12,952 | 39.352025 | 143 | py |
BrAD | BrAD-main/main_brad.py | #!/usr/bin/env python
import math
import os
import random
import shutil
import time
import warnings
import glob
import numpy as np
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.distributed as dist
import torch.optim
import torch.utils.data
import torch.uti... | 26,697 | 40.073846 | 125 | py |
BrAD | BrAD-main/config.py | import builtins
import warnings
import argparse
import logging
import os
from datetime import datetime
import torchvision.models as models
import torch.distributed as dist
model_names = sorted(name for name in models.__dict__
if name.islower() and not name.startswith("__")
and ... | 9,993 | 48.97 | 144 | py |
BrAD | BrAD-main/moco/builder.py | import itertools
import torch
import torch.nn as nn
import torch.nn.functional as func
import os
import glob
import numpy as np
import utils.torchvision_wrappers as models_wrappers
import lib.hed_pytorch.hed as hed
import torch.distributed as dist
class MoCo(nn.Module):
"""
Build a MoCo model with: a query en... | 16,985 | 36.830735 | 146 | py |
BrAD | BrAD-main/moco/loader.py | from PIL import ImageFilter, Image
import random
import torch
from skimage import feature
from skimage.morphology import dilation, disk
class TwoCropsTransform:
"""Take two random crops of one image as the query and key."""
def __init__(self, base_transform, args):
self.base_transform = base_transfor... | 4,184 | 31.952756 | 118 | py |
BrAD | BrAD-main/utils/torchvision_wrappers.py | import torch
import sys
import os
from torchvision.models import ResNet
from torchvision.models.utils import load_state_dict_from_url
from torchvision.models.resnet import model_urls, Bottleneck
import torchvision.models as torchvision_models
__all__ = ['ResNetWithFeats', 'resnet50']
class ResNetWithFeats(ResNet):
... | 3,676 | 36.520408 | 119 | py |
BrAD | BrAD-main/utils/data.py | import os
import numpy as np
import torch.utils.data
import utils.domainnet
import torchvision.datasets as datasets
class DataCoLoaderIterator(object):
def __init__(self, data_loaders, args):
self.args = args
self.data_loaders = data_loaders
self.data_loaders_iters = [iter(d) for d in dat... | 2,842 | 30.588889 | 98 | py |
BrAD | BrAD-main/utils/domainnet.py | import numpy as np
import os
import os.path
from PIL import Image
import json
# subset of classes used in https://arxiv.org/abs/2103.16765
use_classes = (
"aircraft_carrier",
"alarm_clock",
"ant",
"anvil",
"asparagus",
"axe",
"banana",
"basket",
"bathtub",
"bear",
"bee",
... | 5,222 | 22.527027 | 117 | py |
BrAD | BrAD-main/utils/helpers.py | from PIL import Image
import requests
from io import BytesIO
import torchvision.transforms as transforms
from moco.loader import ToEdges
import skimage
import numpy as np
import torch
from tqdm import tqdm
from utils import domainnet
from sklearn.neighbors import NearestNeighbors
import os
def loadImageOrURL(img)... | 5,194 | 38.356061 | 148 | py |
BrAD | BrAD-main/lib/hed_pytorch/hed.py | import numpy as np
import torch
import PIL.Image
from collections import OrderedDict
# global variable for holding a persistent single copy of a model
netNetwork = None
class Network(torch.nn.Module):
def __init__(self, pretrained_hed=True):
super(Network, self).__init__()
self.netVggOne = torch.... | 6,551 | 49.790698 | 155 | py |
GAN-AE | GAN-AE-main/GAN_AE.py | ###########################################################################
## Provides the GAN_AE class (see docstring for details). ##
## Also provides usefull functions. ##
## To use the GAN_AE class, use `import GAN_AE` in your analysis script. ##
################... | 41,361 | 39.274586 | 170 | py |
morl-baselines | morl-baselines-main/morl_baselines/common/prioritized_buffer.py | """Prioritized Replay Buffer.
Code adapted from https://github.com/sfujim/LAP-PAL
"""
import numpy as np
import torch as th
class SumTree:
"""SumTree with fixed size."""
def __init__(self, max_size):
"""Initialize the SumTree.
Args:
max_size: Maximum size of the SumTree
... | 7,421 | 31.552632 | 151 | py |
morl-baselines | morl-baselines-main/morl_baselines/common/networks.py | """Utilities for Neural Networks."""
from typing import Iterable, List, Type
import numpy as np
import torch as th
from torch import nn
def mlp(
input_dim: int,
output_dim: int,
net_arch: List[int],
activation_fn: Type[nn.Module] = nn.ReLU,
drop_rate: float = 0.0,
layer_norm: bool = False,
)... | 5,376 | 33.031646 | 152 | py |
morl-baselines | morl-baselines-main/morl_baselines/common/buffer.py | """Replay buffer for multi-objective reinforcement learning."""
import numpy as np
import torch as th
class ReplayBuffer:
"""Multi-objective replay buffer for multi-objective reinforcement learning."""
def __init__(
self,
obs_shape,
action_dim,
rew_dim=1,
max_size=1000... | 4,238 | 32.912 | 92 | py |
morl-baselines | morl-baselines-main/morl_baselines/common/accrued_reward_buffer.py | """Accrued reward buffer for ESR algorithms."""
import numpy as np
import torch as th
class AccruedRewardReplayBuffer:
"""Replay buffer with accrued rewards stored (for ESR algorithms)."""
def __init__(
self,
obs_shape,
action_shape,
rew_dim=1,
max_size=100000,
... | 4,416 | 35.204918 | 110 | py |
morl-baselines | morl-baselines-main/morl_baselines/common/evaluation.py | """Utilities related to evaluation."""
import os
import random
from typing import List, Optional, Tuple
import numpy as np
import torch as th
import wandb
from pymoo.util.ref_dirs import get_reference_directions
from morl_baselines.common.pareto import filter_pareto_dominated
from morl_baselines.common.performance_in... | 9,334 | 33.194139 | 160 | py |
morl-baselines | morl-baselines-main/morl_baselines/common/morl_algorithm.py | """MORL algorithm base classes."""
import time
from abc import ABC, abstractmethod
from typing import Dict, Optional, Union
import gymnasium as gym
import numpy as np
import torch as th
import wandb
from gymnasium import spaces
from mo_gymnasium.utils import MOSyncVectorEnv
from morl_baselines.common.evaluation impor... | 8,769 | 33.664032 | 142 | py |
morl-baselines | morl-baselines-main/morl_baselines/common/model_based/utils.py | """Utility functions for the model."""
from typing import Tuple
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import torch as th
import torch.nn.functional as F
from gymnasium.spaces import Discrete
def termination_fn_false(obs, act, next_obs):
"""Returns a vector of False values of th... | 10,751 | 38.240876 | 125 | py |
morl-baselines | morl-baselines-main/morl_baselines/common/model_based/probabilistic_ensemble.py | """Probabilistic ensemble of neural networks."""
import os
import numpy as np
import torch as th
from torch import nn as nn
from torch.nn import functional as F
class EnsembleLayer(nn.Module):
"""Ensemble layer."""
def __init__(self, ensemble_size, input_dim, output_dim):
"""Initialize the ensemble ... | 11,218 | 37.686207 | 118 | py |
morl-baselines | morl-baselines-main/morl_baselines/single_policy/ser/mo_ppo.py | """Multi-Objective PPO Algorithm."""
import time
from copy import deepcopy
from typing import List, Optional, Union
from typing_extensions import override
import gymnasium as gym
import mo_gymnasium as mo_gym
import numpy as np
import torch as th
import wandb
from mo_gymnasium import MORecordEpisodeStatistics
from tor... | 22,504 | 35.954023 | 200 | py |
morl-baselines | morl-baselines-main/morl_baselines/single_policy/esr/eupg.py | """EUPG is an ESR algorithm based on Policy Gradient (REINFORCE like)."""
from typing import List, Optional, Union
from typing_extensions import override
import gymnasium as gym
import numpy as np
import torch as th
import torch.nn as nn
import torch.optim as optim
import wandb
from torch.distributions import Categori... | 8,960 | 33.465385 | 147 | py |
morl-baselines | morl-baselines-main/morl_baselines/multi_policy/pgmorl/pgmorl.py | """PGMORL algorithm implementation.
Some code in this file has been adapted from the original code provided by the authors of the paper https://github.com/mit-gfx/PGMORL.
(!) Limited to 2 objectives for now.
(!) The post-processing phase has not been implemented yet.
"""
import time
from copy import deepcopy
from typi... | 28,251 | 40.243796 | 156 | py |
morl-baselines | morl-baselines-main/morl_baselines/multi_policy/gpi_pd/gpi_pd.py | """GPI-PD algorithm."""
import os
import random
from itertools import chain
from typing import Callable, List, Optional, Union
import gymnasium as gym
import numpy as np
import torch as th
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import wandb
from morl_baselines.common.buffer ... | 39,782 | 44.105442 | 127 | py |
morl-baselines | morl-baselines-main/morl_baselines/multi_policy/gpi_pd/gpi_pd_continuous_action.py | """GPI-PD algorithm with continuous actions."""
import os
import random
from itertools import chain
from typing import List, Optional, Union
import gymnasium
import numpy as np
import torch as th
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import wandb
from morl_baselines.common.... | 32,695 | 46.180375 | 143 | py |
morl-baselines | morl-baselines-main/morl_baselines/multi_policy/envelope/envelope.py | """Envelope Q-Learning implementation."""
import os
from typing import List, Optional, Union
from typing_extensions import override
import gymnasium as gym
import numpy as np
import torch as th
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import wandb
from morl_baselines.common.bu... | 23,679 | 41.36136 | 251 | py |
morl-baselines | morl-baselines-main/morl_baselines/multi_policy/capql/capql.py | """CAPQL algorithm."""
import os
import random
from itertools import chain
from typing import List, Optional, Union
import gymnasium
import numpy as np
import torch as th
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import wandb
from torch.distributions import Normal
from morl_bas... | 18,723 | 39.008547 | 119 | py |
morl-baselines | morl-baselines-main/morl_baselines/multi_policy/pcn/pcn.py | """Pareto Conditioned Network. Code adapted from https://github.com/mathieu-reymond/pareto-conditioned-networks ."""
import heapq
import os
from dataclasses import dataclass
from typing import List, Optional, Union
import gymnasium as gym
import numpy as np
import torch as th
import torch.nn as nn
import torch.nn.func... | 19,707 | 42.60177 | 136 | py |
MedAI | MedAI-main/gan.py | import torch
class ConvBlock(torch.nn.Module):
def __init__(self, input_size, output_size, kernel_size=4, stride=2, padding=1, activation=True, batch_norm=True):
super(ConvBlock, self).__init__()
self.conv = torch.nn.Conv2d(input_size, output_size, kernel_size, stride, padding)
self.activa... | 5,055 | 37.59542 | 118 | py |
AutoST | AutoST-main/pre_s6_dataloader.py |
import torch
from torch_geometric.data import Data
from itertools import product
import numpy as np
import pandas as pd
from torch import nn
import pickle
def load_data(file):
data_load_file = []
file_1 = open(file, "rb")
data_load_file = pickle.load(file_1)
return data_load_file
resol... | 6,455 | 34.668508 | 168 | py |
AutoST | AutoST-main/pre_s14_poi_skip.py |
import torch
from torch import nn
import numpy as np
import torch.nn.functional as F
import torch.optim as optim
import pickle
def load_data(file):
data_load_file = []
file_1 = open(file, "rb")
data_load_file = pickle.load(file_1)
return data_load_file
poi_list = ['drinking_water', 'toilets', 'school... | 4,868 | 39.239669 | 728 | py |
AutoST | AutoST-main/pre_poi_transformer.py |
import pandas as pd
import pickle
from shapely.geometry import Point, LineString
from shapely.geometry import Polygon,MultiPoint
import torch
from torch import nn
import numpy as np
def load_data(file):
data_load_file = []
file_1 = open(file, "rb")
data_load_file = pickle.load(file_1)
return data_l... | 2,381 | 21.055556 | 72 | py |
AutoST | AutoST-main/pre_s10.py |
import pandas as pd
import pickle
from shapely.geometry import Point, LineString
from shapely.geometry import Polygon,MultiPoint #多边形
import torch
from torch import nn
import networkx as nx
import numpy as np
def load_data(file):
data_load_file = []
file_1 = open(file, "rb")
data_load_file = pickle.load... | 2,469 | 24.204082 | 77 | py |
AutoST | AutoST-main/pre_poifrom_osm.py |
import pandas as pd
import pickle
from shapely.geometry import Point, LineString
from shapely.geometry import Polygon,MultiPoint #多边形
import torch
from torch import nn
def load_data(file):
data_load_file = []
file_1 = open(file, "rb")
data_load_file = pickle.load(file_1)
return data_load_file
poi = ... | 2,543 | 33.849315 | 700 | py |
AutoST | AutoST-main/pre_s4.py |
import pickle
import pandas as pd
import numpy as np
import copy
from shapely.geometry import Point, LineString
from shapely.geometry import Polygon,MultiPoint #多边形
import torch
import networkx as nx
import matplotlib.pyplot as pl
def load_data(file):
data_load_file = []
file_1 = open(file, "rb")
... | 1,685 | 13.05 | 134 | py |
AutoST | AutoST-main/data_augmentation/dataloader.py | import torch.utils.data
from torch.utils.data.dataloader import default_collate
class DataLoaderFinetune(torch.utils.data.DataLoader):
r"""Data loader which merges data objects from a
:class:`torch_geometric.data.dataset` to a mini-batch.
Args:
dataset (Dataset): The dataset from which to load th... | 3,226 | 36.523256 | 89 | py |
AutoST | AutoST-main/data_augmentation/model.py | import torch
from torch_geometric.nn import MessagePassing
from torch_geometric.utils import add_self_loops, degree, softmax
from torch_geometric.nn import global_add_pool, global_mean_pool, global_max_pool, GlobalAttention, Set2Set
import torch.nn.functional as F
from loader import BioDataset
from dataloader import Da... | 20,590 | 38.982524 | 153 | py |
AutoST | AutoST-main/data_augmentation/util.py | import random
import torch
import numpy as np
import networkx as nx
from loader import BioDataset, graph_data_obj_to_nx, nx_to_graph_data_obj
def combine_dataset(dataset1, dataset2):
data_list = [data for data in dataset1]
data_list.extend([data for data in dataset2])
root_supervised = 'dataset/supervised'... | 9,064 | 40.0181 | 152 | py |
AutoST | AutoST-main/data_augmentation/loader_aug.py | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 5 19:04:46 2022
@author: User
"""
import os
import torch
import random
import networkx as nx
import pandas as pd
import numpy as np
from torch.utils import data
from torch_geometric.data import Data
from torch_geometric.data import InMemoryDataset
from torch_geometric.... | 11,360 | 39.575 | 162 | py |
AutoST | AutoST-main/data_augmentation/loader.py | import os
import torch
import random
import networkx as nx
import pandas as pd
import numpy as np
from torch.utils import data
from torch_geometric.data import Data
from torch_geometric.data import InMemoryDataset
from torch_geometric.data import Batch
from itertools import repeat, product, chain
from collections impor... | 29,229 | 40.402266 | 152 | py |
AutoST | AutoST-main/data_augmentation/data_pre4_aug_fea.py |
import os
os.environ['CUDA_LAUNCH_BLOCKING'] = "1"
import warnings
warnings.filterwarnings('ignore')
import pickle
import dill
import networkx as nx
import torch
from torch_geometric.data import Data
import numpy as np
from torch_geometric.data import Batch
import argparse
import torch.nn as nn
import torch.nn.functio... | 25,123 | 45.785847 | 461 | py |
tpu | tpu-master/tools/ray_tpu/src/run_hp_search.py | # Copyright 2023 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 8,353 | 29.378182 | 80 | py |
tpu | tpu-master/tools/ray_tpu/src/run_basic_jax.py | # Copyright 2023 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 2,115 | 30.117647 | 80 | py |
tpu | tpu-master/tools/ray_tpu/src/run_pax_autoresume.py | # Copyright 2023 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 4,398 | 28.326667 | 80 | py |
tpu | tpu-master/tools/ray_tpu/src/ipp_tool.py | # Copyright 2023 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 5,565 | 29.751381 | 80 | py |
tpu | tpu-master/tools/ray_tpu/src/ray_tpu_controller.py | # Copyright 2023 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 10,304 | 32.786885 | 80 | py |
tpu | tpu-master/tools/ray_tpu/src/ray_serve_diffusion_flax.py | # Copyright 2023 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 6,014 | 32.232044 | 110 | py |
tpu | tpu-master/models/official/unet3d/unet_model.py | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 17,510 | 37.401316 | 80 | py |
tpu | tpu-master/models/official/unet3d/metrics.py | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 6,314 | 32.412698 | 80 | py |
tpu | tpu-master/models/official/efficientnet/main.py | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 33,559 | 37.310502 | 133 | py |
tpu | tpu-master/models/official/efficientnet/efficientnet_model.py | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 26,328 | 36.293201 | 80 | py |
tpu | tpu-master/models/official/efficientnet/utils.py | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 21,546 | 36.473043 | 91 | py |
tpu | tpu-master/models/official/efficientnet/condconv/condconv_layers.py | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 19,899 | 41.521368 | 80 | py |
tpu | tpu-master/models/official/efficientnet/lite/efficientnet_lite_model_qat_test.py | # Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 3,002 | 38 | 80 | py |
tpu | tpu-master/models/official/efficientnet/lite/efficientnet_lite_model_qat.py | # Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 15,553 | 35.088167 | 80 | py |
tpu | tpu-master/models/official/mobilenet/mobilenet.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 16,971 | 31.575816 | 118 | py |
tpu | tpu-master/models/official/mask_rcnn/mask_rcnn_model.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 27,529 | 39.131195 | 174 | py |
tpu | tpu-master/models/official/mask_rcnn/heads.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 7,450 | 36.822335 | 135 | py |
tpu | tpu-master/models/official/mask_rcnn/tpu_normalization.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 5,305 | 42.85124 | 91 | py |
tpu | tpu-master/models/official/mnasnet/mnasnet_model.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 16,301 | 33.685106 | 80 | py |
tpu | tpu-master/models/official/mnasnet/mnasnet_models.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 11,527 | 32.414493 | 80 | py |
tpu | tpu-master/models/official/mnasnet/mnasnet_main.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 32,387 | 37.193396 | 116 | py |
tpu | tpu-master/models/official/mnasnet/mixnet/mixnet_builder.py | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 9,976 | 32.935374 | 80 | py |
tpu | tpu-master/models/official/mnasnet/mixnet/mixnet_model.py | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 15,134 | 34.116009 | 80 | py |
tpu | tpu-master/models/official/mnasnet/mixnet/custom_layers.py | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 5,182 | 36.021429 | 80 | py |
tpu | tpu-master/models/official/mnasnet/configs/mnasnet_config.py | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 1,613 | 30.647059 | 80 | py |
tpu | tpu-master/models/official/detection/projects/vild/modeling/vild_head.py | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 15,644 | 39.848564 | 84 | py |
tpu | tpu-master/models/official/detection/projects/fashionpedia/modeling/architecture/fast_rcnn_head.py | # Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 6,483 | 37.826347 | 80 | py |
tpu | tpu-master/models/official/detection/modeling/retinanet_model.py | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 7,799 | 38.393939 | 80 | py |
tpu | tpu-master/models/official/detection/modeling/architecture/nn_ops.py | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 26,918 | 36.3875 | 92 | py |
tpu | tpu-master/models/official/detection/modeling/architecture/heads.py | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 46,218 | 38.809647 | 83 | py |
tpu | tpu-master/models/official/resnet/resnet_model.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 36,205 | 40.283922 | 90 | py |
tpu | tpu-master/models/samples/core/get_started/iris_data_tpu.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | 3,450 | 32.833333 | 75 | py |
tpu | tpu-master/models/experimental/resnet50_keras/resnet50_ctl_tf1.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 8,815 | 37.164502 | 91 | py |
tpu | tpu-master/models/experimental/resnet50_keras/resnet50_ctl_tf2.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 9,960 | 36.874525 | 91 | py |
tpu | tpu-master/models/experimental/resnet50_keras/resnet50_test.py | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 6,441 | 33.265957 | 80 | py |
tpu | tpu-master/models/experimental/resnet50_keras/resnet50_tf2.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 8,490 | 35.286325 | 91 | py |
tpu | tpu-master/models/experimental/resnet50_keras/resnet50.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 8,446 | 35.409483 | 80 | py |
tpu | tpu-master/models/experimental/resnet50_keras/resnet_model.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 9,034 | 31.383513 | 80 | py |
tpu | tpu-master/models/experimental/keras_colab/shakespeare_lstm.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 6,246 | 32.767568 | 80 | py |
tpu | tpu-master/models/experimental/embedding/model.py | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 13,423 | 38.023256 | 80 | py |
tpu | tpu-master/models/experimental/keras_application/application_model.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 6,488 | 36.08 | 80 | py |
tpu | tpu-master/models/experimental/ncf/ncf_main.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 18,379 | 36.81893 | 80 | py |
tpu | tpu-master/models/experimental/cifar_keras/cifar_keras.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 6,207 | 37.08589 | 80 | py |
tpu | tpu-master/models/experimental/distribution_strategy/resnet_estimator.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 8,910 | 35.520492 | 80 | py |
tpu | tpu-master/models/experimental/mnist_keras/mnist_tf2_with_summary.py | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 5,954 | 33.824561 | 80 | py |
tpu | tpu-master/models/experimental/mnist_keras/mnist.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 4,633 | 32.57971 | 80 | py |
tpu | tpu-master/models/experimental/densenet_keras/densenet_keras_model.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 5,462 | 32.109091 | 112 | py |
tpu | tpu-master/models/experimental/densenet_keras/densenet_keras_imagenet.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 12,252 | 33.809659 | 90 | py |
psrvlbireduce | psrvlbireduce-master/datareduction/vlbatasks.py | ################################################################################
# AIPS imports
################################################################################
from AIPS import AIPS, AIPSDisk
from AIPSTask import AIPSTask, AIPSList
from AIPSData import AIPSUVData, AIPSImage, AIPSCat
from Wizardry.AIPSD... | 257,256 | 39.322414 | 434 | py |
BiteNet | BiteNet-master/train/BiteNet_mh_RE.py | from utils.configs import cfg
from utils.record_log import RecordLog
import numpy as np
from BiteNet.model_mh import BiteNet as Model
import os
from tensorflow import keras
from dataset.dataset_full import VisitDataset
import warnings
import tensorflow as tf
from utils.evaluation import ConceptEvaluation as CodeEval, \... | 3,129 | 32.655914 | 114 | py |
BiteNet | BiteNet-master/train/BiteNet_mh_DX.py | from utils.configs import cfg
from utils.record_log import RecordLog
import numpy as np
from BiteNet.model_mh import BiteNet as Model
import os
from dataset.dataset_full import VisitDataset
import warnings
import heapq
import operator
import tensorflow as tf
from utils.evaluation import ConceptEvaluation as CodeEval, \... | 3,532 | 32.971154 | 114 | py |
BiteNet | BiteNet-master/BiteNet/model_mh.py | import tensorflow as tf
from tensorflow import keras
from tensorflow.python.ops import math_ops
from model_utils import ap_layer, embedding_layer, common_layer,\
position_encoding_layer as pos_layer
from model_utils.attentionLayers import Flatten
from utils.configs import cfg
from utils.model_utils import Reshape
... | 7,668 | 49.124183 | 120 | py |
BiteNet | BiteNet-master/utils/model_utils.py | import tensorflow as tf
from tensorflow import keras
from model_utils.attentionLayers import Flatten, Reconstruct
class Reshape(keras.layers.Layer):
def __init__(self):
super(Reshape, self).__init__()
def call(self, inputs):
v, ref, embedding_size = inputs
batch_size = tf.shape(ref)[0... | 932 | 28.15625 | 76 | py |
BiteNet | BiteNet-master/model_utils/common_layer.py | import tensorflow as tf
from tensorflow import keras
from model_utils.normalization_layer import LayerNormalization
from model_utils.mh_layer import MultiHeadAttention
from model_utils.ffn_layer import FeedForwardNetwork
from model_utils.attentionLayers import Flatten, Reconstruct
VERY_BIG_NUMBER = 1e30
VERY_SMALL_NUMB... | 5,684 | 38.755245 | 98 | py |
BiteNet | BiteNet-master/model_utils/common_model.py | import tensorflow as tf
from tensorflow import keras
from tensorflow.python.ops import math_ops
from model_utils import embedding_layer
from utils.configs import cfg
class CommonModel(object):
def __init__(self, dataset):
# ------ start ------
self.lr = 0.0001
self.dropout_rate = cfg.dro... | 2,076 | 38.942308 | 120 | py |
BiteNet | BiteNet-master/model_utils/rnn_layer.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow import keras
from utils.model_utils import DenseActivation
from model_utils.attentionLayers import exp_mask_for_high_rank
class BiRNN(keras.layers.Layer):
def __ini... | 840 | 31.346154 | 71 | py |
BiteNet | BiteNet-master/model_utils/ap_layer.py | """Implementation of masked self-attention."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow import keras
from utils.model_utils import DenseActivation
from model_utils.attentionLayers import exp_mask_for_high_rank
... | 910 | 31.535714 | 71 | py |
BiteNet | BiteNet-master/model_utils/normalization_layer.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
class LayerNormalization(tf.keras.layers.Layer):
"""Applies layer normalization."""
def __init__(self, **kwargs):
# Pass dtype=float32, as we have not yet tested if layer norm... | 1,233 | 31.473684 | 80 | py |
BiteNet | BiteNet-master/model_utils/embedding_layer.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow import keras
class EmbeddingSharedWeights(keras.layers.Layer):
"""Calculates input embeddings"""
def __init__(self, vocab_size, hidden_size, **kwargs):
... | 1,911 | 35.075472 | 95 | py |
BiteNet | BiteNet-master/model_utils/ffn_layer.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow import keras
class FeedForwardNetwork(keras.layers.Layer):
"""Fully connected feedforward network."""
def __init__(self, hidden_size, filter_size, relu_dropout, tr... | 1,390 | 29.23913 | 89 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.