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
mopo
mopo-master/softlearning/policies/gaussian_policy.py
"""GaussianPolicy.""" from collections import OrderedDict import numpy as np import tensorflow as tf import tensorflow_probability as tfp from softlearning.distributions.squash_bijector import SquashBijector from softlearning.models.feedforward import feedforward_model from .base_policy import LatentSpacePolicy SC...
8,809
33.147287
78
py
mopo
mopo-master/softlearning/policies/uniform_policy.py
from collections import OrderedDict import tensorflow as tf from .base_policy import BasePolicy class UniformPolicy(BasePolicy): def __init__(self, input_shapes, output_shape, action_range=(-1.0, 1.0)): super(UniformPolicy, self).__init__() self._Serializable__initialize(locals()) self....
1,887
26.362319
77
py
mopo
mopo-master/softlearning/models/feedforward.py
import tensorflow as tf from softlearning.utils.keras import PicklableKerasModel def feedforward_model(input_shapes, output_size, hidden_layer_sizes, activation='relu', output_activation='linear', preproces...
1,265
26.521739
68
py
mopo
mopo-master/softlearning/algorithms/sac.py
from collections import OrderedDict from numbers import Number import numpy as np import tensorflow as tf from tensorflow.python.training import training_util from .rl_algorithm import RLAlgorithm def td_target(reward, discount, next_value): return reward + discount * next_value class SAC(RLAlgorithm): ""...
14,507
32.897196
80
py
mopo
mopo-master/softlearning/algorithms/sql.py
from collections import OrderedDict import numpy as np import tensorflow as tf from softlearning.misc.kernel import adaptive_isotropic_gaussian_kernel from .rl_algorithm import RLAlgorithm EPS = 1e-6 def assert_shape(tensor, expected_shape): tensor_shape = tensor.shape.as_list() assert len(tensor_shape) =...
16,532
35.098253
86
py
mopo
mopo-master/softlearning/algorithms/rl_algorithm.py
import abc from collections import OrderedDict from itertools import count import gtimer as gt import math import os import pdb import tensorflow as tf import numpy as np from softlearning.samplers import rollouts from softlearning.misc.utils import save_video class RLAlgorithm(tf.contrib.checkpoint.Checkpointable)...
12,728
34.066116
129
py
mopo
mopo-master/softlearning/samplers/remote_sampler.py
import pickle from collections import OrderedDict import ray import tensorflow as tf import numpy as np from .base_sampler import BaseSampler from .utils import rollout class RemoteSampler(BaseSampler): def __init__(self, **kwargs): super(RemoteSampler, self).__init__(**kwargs) self._remote_en...
3,589
29.683761
76
py
mopo
mopo-master/softlearning/utils/keras.py
import tempfile import tensorflow as tf class PicklableKerasModel(tf.keras.Model): def __getstate__(self): with tempfile.NamedTemporaryFile(suffix='.hdf5', delete=True) as fd: tf.keras.models.save_model(self, fd.name, overwrite=True) model_str = fd.read() d = {'model_str':...
1,072
31.515152
76
py
EATA
EATA-main/main.py
from logging import debug import os import time import argparse import json import random import math from utils.utils import get_logger from utils.cli_utils import * from dataset.selectedRotateImageFolder import prepare_test_data import torch import torch.nn.functional as F import numpy as np import tent import...
8,797
43.211055
235
py
EATA
EATA-main/tent.py
""" Copyright to Tent Authors ICLR 2021 Spotlight """ from argparse import ArgumentDefaultsHelpFormatter from copy import deepcopy import torch import torch.nn as nn import torch.jit from torch.autograd import Variable class Tent(nn.Module): """Tent adapts a model by entropy minimization during testing. On...
5,126
33.877551
118
py
EATA
EATA-main/eata.py
""" Copyright to EATA ICML 2022 Authors, 2022.03.20 Based on Tent ICLR 2021 Spotlight. """ from argparse import ArgumentDefaultsHelpFormatter from copy import deepcopy import torch import torch.nn as nn import torch.jit import math import torch.nn.functional as F class EATA(nn.Module): """EATA adapts a model ...
8,585
40.679612
279
py
EATA
EATA-main/dataset/selectedRotateImageFolder.py
import os import copy import random import math import numpy as np import torch import torch.nn as nn import torchvision.transforms as transforms import torchvision.datasets as datasets import torchvision.models as models import torch.utils.data normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229...
7,787
37.94
151
py
EATA
EATA-main/models/Res.py
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # import torch.nn as nn try: from torch.hub import load_state_dict_from_url except ImportError: from torch.utils.mo...
11,645
36.934853
106
py
EATA
EATA-main/utils/utils.py
import os import sys import logging import random import numpy as np import torch import torch.nn as nn device = "cuda:0" if torch.cuda.is_available() else "cpu" def mean(items): return sum(items)/len(items) def max_with_index(values): best_v = values[0] best_i = 0 for i, v in enumerate(values): ...
3,308
25.902439
98
py
EATA
EATA-main/utils/cli_utils.py
import os import shutil import torch import torch.nn as nn import torch.nn.functional as F class AverageMeter(object): """Computes and stores the average and current value""" def __init__(self, name, fmt=':f'): self.name = name self.fmt = fmt self.reset() def reset(self): ...
3,444
30.036036
88
py
WaveRNN
WaveRNN-master/train_wavernn.py
import time import numpy as np import torch from torch import optim import torch.nn.functional as F from utils.display import stream, simple_table from utils.dataset import get_vocoder_datasets from utils.distribution import discretized_mix_logistic_loss from utils import hparams as hp from models.fatchord_version impo...
6,132
37.33125
137
py
WaveRNN
WaveRNN-master/train_tacotron.py
import torch from torch import optim import torch.nn.functional as F from utils import hparams as hp from utils.display import * from utils.dataset import get_tts_datasets from utils.text.symbols import symbols from utils.paths import Paths from models.tacotron import Tacotron import argparse from utils import data_par...
7,541
36.152709
137
py
WaveRNN
WaveRNN-master/gen_tacotron.py
import torch from models.fatchord_version import WaveRNN from utils import hparams as hp from utils.text.symbols import symbols from utils.paths import Paths from models.tacotron import Tacotron import argparse from utils.text import text_to_sequence from utils.display import save_attention, simple_table from utils.dsp...
7,192
41.56213
137
py
WaveRNN
WaveRNN-master/gen_wavernn.py
from utils.dataset import get_vocoder_datasets from utils.dsp import * from models.fatchord_version import WaveRNN from utils.paths import Paths from utils.display import simple_table import torch import argparse from pathlib import Path def gen_testset(model: WaveRNN, test_set, samples, batched, target, overlap, sav...
5,559
37.881119
137
py
WaveRNN
WaveRNN-master/quick_start.py
import torch from models.fatchord_version import WaveRNN from utils import hparams as hp from utils.text.symbols import symbols from models.tacotron import Tacotron import argparse from utils.text import text_to_sequence from utils.display import save_attention, simple_table import zipfile, os os.makedirs('quick_star...
4,707
37.276423
137
py
WaveRNN
WaveRNN-master/models/tacotron.py
import os import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from pathlib import Path from typing import Union class HighwayNetwork(nn.Module): def __init__(self, size): super().__init__() self.W1 = nn.Linear(size, size) self.W2 = nn.Linear(size, size) ...
17,427
36.080851
110
py
WaveRNN
WaveRNN-master/models/deepmind_version.py
import torch import torch.nn as nn import torch.nn.functional as F from utils.display import * from utils.dsp import * import numpy as np class WaveRNN(nn.Module): def __init__(self, hidden_size=896, quantisation=256): super(WaveRNN, self).__init__() self.hidden_size = hidden_size ...
7,340
40.710227
87
py
WaveRNN
WaveRNN-master/models/fatchord_version.py
import torch import torch.nn as nn import torch.nn.functional as F from utils.distribution import sample_from_discretized_mix_logistic from utils.display import * from utils.dsp import * import os import numpy as np from pathlib import Path from typing import Union class ResBlock(nn.Module): def __init__(self, di...
15,271
34.027523
113
py
WaveRNN
WaveRNN-master/utils/checkpoints.py
import torch from utils.paths import Paths from models.tacotron import Tacotron def get_checkpoint_paths(checkpoint_type: str, paths: Paths): """ Returns the correct checkpointing paths depending on whether model is Vocoder or TTS Args: checkpoint_type: Either 'voc' or 'tts' paths: Pa...
5,010
38.148438
93
py
WaveRNN
WaveRNN-master/utils/dataset.py
import pickle import random import torch from torch.utils.data import Dataset, DataLoader from torch.utils.data.sampler import Sampler from utils.dsp import * from utils import hparams as hp from utils.text import text_to_sequence from utils.paths import Paths from pathlib import Path ################################...
6,718
29.130045
100
py
WaveRNN
WaveRNN-master/utils/distribution.py
import numpy as np import torch import torch.nn.functional as F def log_sum_exp(x): """ numerically stable log_sum_exp implementation that prevents overflow """ # TF ordering axis = len(x.size()) - 1 m, _ = torch.max(x, dim=axis) m2, _ = torch.max(x, dim=axis, keepdim=True) return m + torch.lo...
4,812
35.18797
99
py
WaveRNN
WaveRNN-master/utils/__init__.py
# Make it explicit that we do it the Python 3 way from __future__ import absolute_import, division, print_function, unicode_literals from builtins import * import sys import torch import re from importlib.util import spec_from_file_location, module_from_spec from pathlib import Path from typing import Union # Credit...
3,977
37.25
128
py
WaveRNN
WaveRNN-master/notebooks/models/wavernn.py
import torch import torch.nn as nn import torch.nn.functional as F class WaveRNN(nn.Module) : def __init__(self, hidden_size=896, quantisation=256) : super(WaveRNN, self).__init__() self.hidden_size = hidden_size self.split_size = hidden_size // 2 # The main matmu...
7,017
39.802326
87
py
bert-syntax
bert-syntax-master/eval_bert.py
# coding=utf-8 from pytorch_pretrained_bert import BertForMaskedLM,tokenization import torch import sys import csv model_name = 'bert-large-uncased' if 'base' in sys.argv: model_name = 'bert-base-uncased' print("using model:",model_name,file=sys.stderr) bert=BertForMaskedLM.from_pretrained(model_name) tokenizer=tokeni...
4,137
31.077519
170
py
TransCoder
TransCoder-main/translate.py
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # # Translate sentences from the input stream. # The model will be faster is sentences are sorted by length. # Input sentences mus...
7,637
40.51087
133
py
TransCoder
TransCoder-main/XLM/src/optim.py
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # import re import math import inspect import torch from torch import optim class Adam(optim.Optimizer): """ Same as h...
10,577
36.246479
101
py
TransCoder
TransCoder-main/XLM/src/slurm.py
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # from logging import getLogger import os import sys import torch import socket import signal import subprocess logger = getLog...
6,355
35.739884
99
py
TransCoder
TransCoder-main/XLM/src/utils.py
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # import argparse import getpass import os import pickle import random import re import subprocess import sys from concurrent.fut...
29,283
39.391724
198
py
TransCoder
TransCoder-main/XLM/src/trainer.py
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # import os import math import time from logging import getLogger from collections import OrderedDict import numpy as np import t...
38,415
37.725806
140
py
TransCoder
TransCoder-main/XLM/src/evaluation/evaluator.py
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # import sys from logging import getLogger import os import subprocess from collections import OrderedDict import numpy as np impo...
27,320
42.435612
136
py
TransCoder
TransCoder-main/XLM/src/data/dictionary.py
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # import os import numpy as np import torch from logging import getLogger logger = getLogger() BOS_WORD = '<s>' EOS_WORD = '<...
7,880
32.53617
96
py
TransCoder
TransCoder-main/XLM/src/data/dataset.py
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # from logging import getLogger import math import numpy as np import torch logger = getLogger() class StreamDataset(object):...
16,787
34.643312
124
py
TransCoder
TransCoder-main/XLM/src/data/loader.py
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # from logging import getLogger import os import numpy as np import torch from .dataset import StreamDataset, Dataset, ParallelD...
14,870
38.868633
138
py
TransCoder
TransCoder-main/XLM/src/model/pretrain.py
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # from logging import getLogger import io import numpy as np import torch logger = getLogger() def load_fasttext_model(path):...
3,012
29.744898
89
py
TransCoder
TransCoder-main/XLM/src/model/embedder.py
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # from logging import getLogger import torch from .transformer import TransformerModel from ..data.dictionary import Dictionary,...
4,977
33.569444
128
py
TransCoder
TransCoder-main/XLM/src/model/transformer.py
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # from logging import getLogger import math import itertools import numpy as np import torch import torch.nn as nn import torch.n...
30,971
37.379182
147
py
TransCoder
TransCoder-main/XLM/src/model/__init__.py
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # from logging import getLogger import os import torch from .pretrain import load_embeddings # , TRANSFORMER_LAYER_PARAMS from ....
11,449
44.07874
136
py
TransCoder
TransCoder-main/preprocessing/src/test_tokenize_python.py
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # from preprocessing.src.code_tokenizer import tokenize_python, detokenize_python TESTS = [] TESTS.append(( "a = [3.14,4]",...
5,026
22.712264
150
py
QuatE
QuatE-master/quate.py
class QuatE(KBCModel): def __init__( self, sizes: Tuple[int, int, int], rank: int, init_size: float = 1e-3 ): super(QuatE, self).__init__() self.sizes = sizes self.rank = rank self.embeddings = nn.ModuleList([ nn.Embedding(s, 4 * rank, sparse=...
4,200
44.663043
143
py
QuatE
QuatE-master/config/Config.py
# coding:utf-8 import torch import torch.nn as nn from torch.autograd import Variable import torch.optim as optim import os import time import sys import datetime import ctypes import json import numpy as np class MyDataParallel(nn.DataParallel): def _getattr__(self, name): return getattr(self.module, nam...
19,078
35.203036
88
py
QuatE
QuatE-master/models/QuatE.py
import torch import torch.autograd as autograd import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable import numpy as np from .Model import Model from numpy.random import RandomState class QuatE(Model): def __init__(self, config): super(QuatE,...
7,808
41.440217
123
py
QuatE
QuatE-master/models/OctonionE.py
import torch import torch.autograd as autograd import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable import numpy as np from .Model import Model from numpy.random import RandomState class OctonionE(Model): def __init__(self, config): super(Oc...
9,155
43.882353
118
py
QuatE
QuatE-master/models/Model.py
import torch import torch.autograd as autograd import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable class Model(nn.Module): def __init__(self, config): super(Model, self).__init__() self.config = config self.batch_h = None self.batch_t = None ...
1,425
32.952381
84
py
point_cloud_anomaly_detection
point_cloud_anomaly_detection-main/test.py
import argparse import os import random from typing import List import matplotlib.pyplot as plt import numpy as np import pandas as pd import torch import yaml from addict import Dict from sklearn.metrics import auc, roc_curve from torch.utils.data import DataLoader from libs.checkpoint import resume from libs.datase...
10,040
30.280374
85
py
point_cloud_anomaly_detection
point_cloud_anomaly_detection-main/train.py
import argparse import os import random import numpy as np import torch import wandb import yaml from addict import Dict # from emd.emd_module import emdModule from libs.checkpoint import save_checkpoint from libs.dataset import ShapeNeth5pyDataset from libs.foldingnet import SkipValiationalFoldingNet from libs.helpe...
4,094
25.25
102
py
point_cloud_anomaly_detection
point_cloud_anomaly_detection-main/libs/checkpoint.py
import os from typing import Tuple import torch import torch.nn as nn import torch.optim as optim def save_checkpoint( result_path: str, epoch: int, model: nn.Module, optimizer: optim.Optimizer, ) -> None: save_states = { "epoch": epoch, "model_state_dict": model.state_dict(), ...
1,073
23.409091
85
py
point_cloud_anomaly_detection
point_cloud_anomaly_detection-main/libs/loss.py
# from collections import Counter, defaultdict import torch import torch.nn as nn # from ortools.linear_solver import pywraplp class ChamferLoss(nn.Module): def __init__(self): super(ChamferLoss, self).__init__() self.use_cuda = torch.cuda.is_available() def batch_pairwise_dist(self, x, y):...
1,506
32.488889
85
py
point_cloud_anomaly_detection
point_cloud_anomaly_detection-main/libs/helper.py
import os import time from typing import Any, List, Tuple import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd import torch import torch.nn as nn import wandb from torch import optim from torch.distributions import Categorical from torch.utils.data import DataLoader from .emd.emd_m...
15,756
32.033543
88
py
point_cloud_anomaly_detection
point_cloud_anomaly_detection-main/libs/dataset.py
import copy import glob import json import os import random # from .visualize import vis_points_3d from typing import Tuple import h5py import numpy as np import pandas as pd import torch from torch.utils import data from .load_obj import loadOBJ from .sampling import fartherst_point_sampling class ShapeNetDataset...
11,983
31.042781
87
py
point_cloud_anomaly_detection
point_cloud_anomaly_detection-main/libs/foldingnet.py
import itertools import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from .visualize import vis_points_3d def knn(x: torch.tensor, k: int) -> int: batch_size = x.size(0) num_points = x.size(2) inner = -2 * torch.matmul(x.transpose(2, 1), x) xx = torch.sum(x ** 2, d...
13,746
31.88756
88
py
LGG
LGG-main/eeg_dataset.py
# tested 8/9/2020 import os.path as osp import scipy.io as sio import numpy as np import torch import h5py from torch.utils.data import Dataset class eegDataset(Dataset): # x_tensor: (sample, channel, datapoint(feature)) type = torch.tensor # y_tensor: (sample,) type = torch.tensor def __init__(self, x_...
570
20.961538
73
py
LGG
LGG-main/utils.py
import os import time import h5py import numpy as np import pprint import random from networks import * from eeg_dataset import * from torch.utils.data import DataLoader from sklearn.metrics import confusion_matrix, accuracy_score, f1_score def set_gpu(x): torch.set_num_threads(1) os.environ["CUDA_DEVICE_ORDE...
4,036
25.913333
179
py
LGG
LGG-main/train_model.py
from utils import * import torch.nn as nn CUDA = torch.cuda.is_available() def train_one_epoch(data_loader, net, loss_fn, optimizer): net.train() tl = Averager() pred_train = [] act_train = [] for i, (x_batch, y_batch) in enumerate(data_loader): if CUDA: x_batch, y_batch = x_...
7,897
33.33913
104
py
LGG
LGG-main/networks.py
# This is the networks script import torch import math import torch.nn as nn import torch.nn.functional as F from layers import GraphConvolution DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu' class PowerLayer(nn.Module): ''' The power layer: calculates the log-transformed power of the data ''' ...
6,817
37.738636
111
py
LGG
LGG-main/layers.py
import math import torch import torch.nn.functional as F from torch.nn.parameter import Parameter from torch.nn.modules.module import Module class GraphConvolution(Module): """ simple GCN layer """ def __init__(self, in_features, out_features, bias=True): super(GraphConvolution, self).__init_...
1,097
29.5
89
py
LGG
LGG-main/cross_validation.py
import numpy as np import datetime import os import csv import h5py import copy import os.path as osp from train_model import * from utils import Averager, ensure_path from sklearn.model_selection import KFold import pickle ROOT = os.getcwd() class CrossValidation: def __init__(self, args): self.args = a...
12,152
40.477816
115
py
GeneticAlgorithmPython
GeneticAlgorithmPython-master/pygad/kerasga/kerasga.py
import copy import numpy import tensorflow.keras def model_weights_as_vector(model): """ Reshapes the Keras model weight as a vector. Parameters ---------- model : TYPE The Keras model. Returns ------- TYPE The weights as a 1D vector. """ weights_vector = [] ...
4,821
30.723684
183
py
GeneticAlgorithmPython
GeneticAlgorithmPython-master/pygad/kerasga/__init__.py
from .kerasga import * __version__ = "1.3.0"
46
10.75
22
py
GeneticAlgorithmPython
GeneticAlgorithmPython-master/pygad/torchga/__init__.py
from .torchga import * __version__ = "1.3.0"
46
10.75
22
py
GeneticAlgorithmPython
GeneticAlgorithmPython-master/pygad/torchga/torchga.py
import copy import numpy import torch def model_weights_as_vector(model): weights_vector = [] for curr_weights in model.state_dict().values(): # Calling detach() to remove the computational graph from the layer. # cpu() is called for making shore the data is moved from GPU to cpu # num...
3,272
34.967033
185
py
GeneticAlgorithmPython
GeneticAlgorithmPython-master/examples/KerasGA/cancer_dataset_generator.py
import tensorflow as tf import tensorflow.keras import pygad.kerasga import pygad def fitness_func(ga_instanse, solution, sol_idx): global train_generator, data_outputs, keras_ga, model predictions = pygad.kerasga.predict(model=model, solution=solution, ...
3,970
43.122222
152
py
GeneticAlgorithmPython
GeneticAlgorithmPython-master/examples/KerasGA/image_classification_Dense.py
import tensorflow.keras import pygad.kerasga import numpy import pygad def fitness_func(ga_instanse, solution, sol_idx): global data_inputs, data_outputs, keras_ga, model predictions = pygad.kerasga.predict(model=model, solution=solution, ...
3,558
41.879518
161
py
GeneticAlgorithmPython
GeneticAlgorithmPython-master/examples/KerasGA/cancer_dataset.py
import tensorflow as tf import tensorflow.keras import pygad.kerasga import pygad import numpy def fitness_func(ga_instanse, solution, sol_idx): global train_data, data_outputs, keras_ga, model predictions = pygad.kerasga.predict(model=model, solution=solution, ...
3,869
39.3125
152
py
GeneticAlgorithmPython
GeneticAlgorithmPython-master/examples/KerasGA/image_classification_CNN.py
import tensorflow.keras import pygad.kerasga import numpy import pygad def fitness_func(ga_instanse, solution, sol_idx): global data_inputs, data_outputs, keras_ga, model predictions = pygad.kerasga.predict(model=model, solution=solution, ...
4,121
44.296703
161
py
GeneticAlgorithmPython
GeneticAlgorithmPython-master/examples/KerasGA/XOR_classification.py
import tensorflow.keras import pygad.kerasga import numpy import pygad def fitness_func(ga_instanse, solution, sol_idx): global data_inputs, data_outputs, keras_ga, model predictions = pygad.kerasga.predict(model=model, solution=solution, ...
3,648
40.942529
161
py
GeneticAlgorithmPython
GeneticAlgorithmPython-master/examples/KerasGA/regression_example.py
import tensorflow.keras import pygad.kerasga import numpy import pygad def fitness_func(ga_instanse, solution, sol_idx): global data_inputs, data_outputs, keras_ga, model predictions = pygad.kerasga.predict(model=model, solution=solution, ...
3,226
39.3375
161
py
GeneticAlgorithmPython
GeneticAlgorithmPython-master/examples/TorchGA/image_classification_Dense.py
import torch import pygad.torchga import pygad import numpy def fitness_func(ga_instanse, solution, sol_idx): global data_inputs, data_outputs, torch_ga, model, loss_function predictions = pygad.torchga.predict(model=model, solution=solution, ...
3,666
44.271605
161
py
GeneticAlgorithmPython
GeneticAlgorithmPython-master/examples/TorchGA/image_classification_CNN.py
import torch import pygad.torchga import pygad import numpy def fitness_func(ga_instanse, solution, sol_idx): global data_inputs, data_outputs, torch_ga, model, loss_function predictions = pygad.torchga.predict(model=model, solution=solution, ...
4,135
42.536842
161
py
GeneticAlgorithmPython
GeneticAlgorithmPython-master/examples/TorchGA/XOR_classification.py
import torch import pygad.torchga import pygad def fitness_func(ga_instanse, solution, sol_idx): global data_inputs, data_outputs, torch_ga, model, loss_function predictions = pygad.torchga.predict(model=model, solution=solution, ...
3,605
40.448276
161
py
GeneticAlgorithmPython
GeneticAlgorithmPython-master/examples/TorchGA/regression_example.py
import torch import pygad.torchga import pygad def fitness_func(ga_instanse, solution, sol_idx): global data_inputs, data_outputs, torch_ga, model, loss_function predictions = pygad.torchga.predict(model=model, solution=solution, ...
3,102
39.298701
161
py
ml-compiler-opt
ml-compiler-opt-main/compiler_opt/rl/random_net_distillation.py
# coding=utf-8 # Copyright 2020 Google LLC # # 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 applicable law or agreed ...
8,567
39.8
80
py
ml-compiler-opt
ml-compiler-opt-main/compiler_opt/rl/random_net_distillation_test.py
# coding=utf-8 # Copyright 2020 Google LLC # # 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 applicable law or agreed ...
3,948
35.564815
78
py
ml-compiler-opt
ml-compiler-opt-main/compiler_opt/rl/agent_config_test.py
# coding=utf-8 # Copyright 2020 Google LLC # # 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 applicable law or agreed ...
3,287
37.232558
80
py
ml-compiler-opt
ml-compiler-opt-main/compiler_opt/rl/problem_configuration.py
# coding=utf-8 # Copyright 2020 Google LLC # # 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 applicable law or agreed ...
4,459
32.283582
78
py
ml-compiler-opt
ml-compiler-opt-main/compiler_opt/rl/agent_config.py
# coding=utf-8 # Copyright 2020 Google LLC # # 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 applicable law or agreed ...
7,676
33.895455
80
py
ml-compiler-opt
ml-compiler-opt-main/compiler_opt/rl/gin_external_configurables.py
# coding=utf-8 # Copyright 2020 Google LLC # # 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 applicable law or agreed ...
1,437
34.95
74
py
ml-compiler-opt
ml-compiler-opt-main/compiler_opt/rl/trainer_test.py
# coding=utf-8 # Copyright 2020 Google LLC # # 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 applicable law or agreed ...
5,860
35.179012
76
py
ml-compiler-opt
ml-compiler-opt-main/compiler_opt/rl/env.py
# coding=utf-8 # Copyright 2020 Google LLC # # 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 applicable law or agreed ...
11,070
29.498623
80
py
ml-compiler-opt
ml-compiler-opt-main/compiler_opt/rl/trainer.py
# coding=utf-8 # Copyright 2020 Google LLC # # 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 applicable law or agreed ...
7,818
36.591346
80
py
ml-compiler-opt
ml-compiler-opt-main/compiler_opt/rl/regalloc_priority/config.py
# coding=utf-8 # Copyright 2020 Google LLC # # 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 applicable law or agreed ...
1,834
32.981481
74
py
ml-compiler-opt
ml-compiler-opt-main/compiler_opt/rl/distributed/ppo_eval_lib.py
# coding=utf-8 # Copyright 2020 Google LLC # # 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 applicable law or agreed ...
7,384
37.06701
87
py
ml-compiler-opt
ml-compiler-opt-main/compiler_opt/rl/inlining/config.py
# coding=utf-8 # Copyright 2020 Google LLC # # 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 applicable law or agreed ...
3,603
34.333333
79
py
ml-compiler-opt
ml-compiler-opt-main/compiler_opt/rl/regalloc/regalloc_network.py
# coding=utf-8 # Copyright 2020 Google LLC # # 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 applicable law or agreed ...
7,327
40.168539
80
py
ml-compiler-opt
ml-compiler-opt-main/compiler_opt/rl/regalloc/config.py
# coding=utf-8 # Copyright 2020 Google LLC # # 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 applicable law or agreed ...
5,417
35.608108
80
py
ml-compiler-opt
ml-compiler-opt-main/compiler_opt/rl/regalloc/regalloc_network_test.py
# coding=utf-8 # Copyright 2020 Google LLC # # 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 applicable law or agreed ...
2,470
34.3
78
py
IndicXlit
IndicXlit-master/app/ai4bharat/transliteration/rnn/core.py
import os import torch import numpy as np import pandas as pd import json from .network import Encoder, Decoder, Seq2Seq ##===================== Glyph handlers ======================================= class GlyphStrawboss(): def __init__(self, glyphs = 'en'): """ list of letters in a language in unicode ...
9,182
32.637363
104
py
IndicXlit
IndicXlit-master/app/ai4bharat/transliteration/rnn/network.py
import torch import torch.nn as nn class Encoder(nn.Module): def __init__(self, input_dim, embed_dim, hidden_dim , rnn_type = 'gru', layers = 1, bidirectional =False, dropout = 0, device = "cpu"): super(Encoder, self).__init__() ...
13,571
40.378049
152
py
IndicXlit
IndicXlit-master/app/ai4bharat/transliteration/transformer/custom_interactive.py
#!/usr/bin/env python3 -u # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Translate raw text with a trained model. Batches data on-the-fly. """ import ast import fileinput import logging...
14,113
38.757746
150
py
IndicXlit
IndicXlit-master/inference/python/custom_interactive.py
#!/usr/bin/env python3 -u # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Translate raw text with a trained model. Batches data on-the-fly. """ import ast import fileinput import logging...
13,455
38.116279
148
py
signSGD
signSGD-master/gradient_expts/cifarTrainer.py
from __future__ import division import os import random import argparse, time import logging logging.basicConfig(level=logging.INFO) import pickle import mxnet as mx from mxnet import gluon from mxnet.gluon.model_zoo import vision as models from mxnet import autograd as ag from mxnet import nd import numpy as np im...
8,018
34.017467
173
py
signSGD
signSGD-master/gradient_expts/getCifarData.py
#! /usr/bin/python import os from mxnet.test_utils import download import zipfile import mxnet as mx # download cifar def GetCifar10(): if not os.path.isdir("data"): os.makedirs('data') if (not os.path.exists('data/cifar/train.rec')) or \ (not os.path.exists('data/cifar/test.rec')) or \ ...
649
29.952381
79
py
signSGD
signSGD-master/gradient_expts/imagenetTrainer.py
import argparse import os import time import pickle import logging logging.basicConfig(level=logging.INFO) import mxnet as mx from mxnet import gluon from mxnet import autograd as ag from mxnet.gluon.model_zoo import vision import numpy as np import gradient_utils def test(ctx, val_data, net): metric_top1 = mx.m...
4,704
36.047244
115
py
signSGD
signSGD-master/gradient_expts/gradient_utils.py
from mxnet import gluon from mxnet import autograd as ag import logging logging.basicConfig(level=logging.INFO) import numpy as np import random def welfordGradient(ctx, train_data, net): # ctx is training context, i.e. list of CPUs/GPUs # train_data is the training data # net is the network including a ...
2,984
36.78481
139
py
signSGD
signSGD-master/imagenet/train_resnet.py
import argparse import os import time import pickle import logging logging.basicConfig(level=logging.INFO) import mxnet as mx from mxnet import gluon from mxnet import autograd as ag from mxnet.gluon.model_zoo import vision import numpy as np import random def test(ctx, val_data, net): metric_top1 = mx.metric.Ac...
8,470
40.321951
134
py
signSGD
signSGD-master/cifar/networkTrainer.py
from __future__ import division import os import random import argparse, time import logging logging.basicConfig(level=logging.INFO) import pickle import mxnet as mx from mxnet import gluon from mxnet.gluon.model_zoo import vision as models from mxnet import autograd as ag from mxnet import nd import numpy as np cl...
7,056
34.641414
173
py