python_code
stringlengths
0
4.04M
repo_name
stringlengths
8
58
file_path
stringlengths
5
147
# Copyright (c) 2021-present, Facebook, Inc. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import gym import pytest import bisk @pytest.fixture def env(): env = gym.make('BiskPoleBalance-v1', robot='testcube') obs, _ = env.rese...
bipedal-skills-main
tests/test_polebalance.py
# Copyright (c) 2022-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import gym import pytest import numpy as np import bisk @pytest.fixture def env(): env = gym.make('BiskButterflies-v1', robot='testcube') ...
bipedal-skills-main
tests/test_butterflies.py
# Copyright (c) 2022-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import gym import pytest import numpy as np import bisk @pytest.fixture def env(): env = gym.make('BiskGoToTargets-v1', robot='testcube') ...
bipedal-skills-main
tests/test_gototargets.py
# Copyright (c) 2021-present, Facebook, Inc. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import gym import pytest import bisk from bisk.features.joints import JointsFeaturizer from bisk.single_robot import BiskSingleRobotEnv def test...
bipedal-skills-main
tests/test_features_joints.py
# Copyright (c) 2021-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import gym import pytest import bisk @pytest.fixture def env(): env = gym.make('BiskHurdles-v1', robot='testcube') obs, _ = env.reset(s...
bipedal-skills-main
tests/test_render.py
# Copyright (c) 2021-present, Facebook, Inc. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import gym import pytest import bisk @pytest.fixture def env(): env = gym.make('BiskLimbo-v1', robot='testcube') obs, _ = env.reset(seed...
bipedal-skills-main
tests/test_limbo.py
# Copyright (c) 2021-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import gym import pytest import bisk @pytest.fixture def env(): env = gym.make('BiskStairs-v1', robot='testcube') obs, _ = env.reset(se...
bipedal-skills-main
tests/test_stairs.py
# Copyright (c) 2022-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import gym import numpy as np import pytest import bisk def test_walker_fallover(): env = gym.make('BiskGoalWall-v1', robot='walker') e...
bipedal-skills-main
tests/test_fallover.py
# Copyright (c) 2021-present, Facebook, Inc. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import gym import pytest import bisk @pytest.fixture def env(): env = gym.make('BiskHurdlesLimbo-v1', robot='testcube') obs, _ = env.res...
bipedal-skills-main
tests/test_hurdleslimbo.py
# Copyright (c) 2021-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import gym import pytest import bisk @pytest.fixture def env(): env = gym.make('BiskGaps-v1', robot='testcube') obs, _ = env.reset(seed...
bipedal-skills-main
tests/test_gaps.py
# Copyright (c) 2021-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # __version__ = "2.0" from gym.envs.registration import register from bisk.base import BiskEnv from bisk.single_robot import BiskSingleRobotEnv ...
bipedal-skills-main
bisk/__init__.py
# gym.utils.seeding from gym 0.18.3 # Released under an MIT license # (https://github.com/openai/gym/blob/0.18.3/LICENSE.md) # # This is provided for consistency as seeding changed with gym 0.26. import hashlib import numpy as np import os import random as _random import struct import sys from gym import error def n...
bipedal-skills-main
bisk/legacy_seeding.py
# Copyright (c) 2021-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import logging from typing import Iterable, List import gym import numpy as np from bisk.base import BiskEnv from bisk.features import make_feat...
bipedal-skills-main
bisk/single_robot.py
# Copyright (c) 2021-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import os from typing import Tuple, Iterable import logging import numpy as np from gym.utils import seeding log = logging.getLogger(__name__) ...
bipedal-skills-main
bisk/helpers.py
# Copyright (c) 2021-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import logging from typing import Optional import gym import numpy as np from bisk import legacy_seeding as seeding log = logging.getLogger(__n...
bipedal-skills-main
bisk/base.py
# Copyright (c) 2022-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import logging import gym import numpy as np from dm_control.utils import rewards from bisk.single_robot import BiskSingleRobotEnv log = loggin...
bipedal-skills-main
bisk/tasks/velocitycontrol.py
# Copyright (c) 2021-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import logging from bisect import bisect_left from typing import Dict, List, Union import gym import numpy as np from dm_control import mjcf fro...
bipedal-skills-main
bisk/tasks/hurdleslimbo.py
# Copyright (c) 2022-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import logging from bisect import bisect_left from typing import List import gym import numpy as np from dm_control import mjcf from dm_control.m...
bipedal-skills-main
bisk/tasks/butterflies.py
# Copyright (c) 2021-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import logging from bisect import bisect_left from typing import List import gym import numpy as np from dm_control import mjcf from dm_control.m...
bipedal-skills-main
bisk/tasks/polebalance.py
# Copyright (c) 2021-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import logging from bisect import bisect_left from typing import Dict, List, Union import gym import numpy as np from dm_control import mjcf fro...
bipedal-skills-main
bisk/tasks/limbo.py
# Copyright (c) 2021-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import logging from bisect import bisect_left import gym import numpy as np from dm_control import mjcf from dm_control.utils import rewards fro...
bipedal-skills-main
bisk/tasks/goalwall.py
# Copyright (c) 2021-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import logging from bisect import bisect_left import gym import numpy as np from dm_control import mjcf from bisk.single_robot import BiskSingle...
bipedal-skills-main
bisk/tasks/hurdles.py
# Copyright (c) 2021-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import logging from bisect import bisect_left import gym import numpy as np from dm_control import mjcf from bisk.single_robot import BiskSingle...
bipedal-skills-main
bisk/tasks/stairs.py
bipedal-skills-main
bisk/tasks/__init__.py
# Copyright (c) 2022-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import logging import gym import numpy as np from dm_control import mjcf from dm_control.utils import rewards from bisk.single_robot import Bisk...
bipedal-skills-main
bisk/tasks/gototarget.py
# Copyright (c) 2022-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import numpy as np from bisk.single_robot import BiskSingleRobotEnv class BiskRunDirEnv(BiskSingleRobotEnv): ''' Dense-reward task: mov...
bipedal-skills-main
bisk/tasks/rundir.py
# Copyright (c) 2021-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import logging from bisect import bisect_left import gym import numpy as np from dm_control import mjcf from bisk.helpers import asset_path from...
bipedal-skills-main
bisk/tasks/gaps.py
# Copyright (c) 2021-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # from bisk.features.base import Featurizer _registry = {} def register_featurizer(name, cls): global _registry _registry[name] = cls d...
bipedal-skills-main
bisk/features/__init__.py
# Copyright (c) 2021-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import logging import re from typing import List, Set import gym import numpy as np from bisk.features.base import Featurizer class JointsFeat...
bipedal-skills-main
bisk/features/joints.py
# Copyright (c) 2021-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import logging from typing import Dict, List import gym import numpy as np log = logging.getLogger(__name__) class Featurizer: n_qpos: Dic...
bipedal-skills-main
bisk/features/base.py
# Copyright (c) 2021-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import argparse import time import gym from dm_control import _render from dm_control.viewer import gui, renderer, viewer, views import bisk pa...
bipedal-skills-main
exp/testgui.py
# Copyright (c) Meta Platforms, Inc. and 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 os import yaml def load_configs(file_path, ws_dir): with open(file_path, 'r') as f: config_dict = yaml...
AutoAvatar-main
utils/configs.py
# Copyright (c) Meta Platforms, Inc. and 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 numpy as np import os import torch import pickle from pytorch3d.io import load_ply # Classes ---------------------...
AutoAvatar-main
utils/DFaust.py
# Copyright (c) Meta Platforms, Inc. and 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 numpy as np import os import torch import torch.nn as nn import torch.nn.functional as F from pytorch3d.renderer imp...
AutoAvatar-main
utils/render.py
# Copyright (c) Meta Platforms, Inc. and 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 os import torch def load_components(model, ckpt_dir, ckpt_itr, name): state_dict = model.state_dict() ckpt...
AutoAvatar-main
utils/io.py
# Copyright (c) Meta Platforms, Inc. and 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 openvdb as vdb import numpy as np import os import torch import torch.nn.functional as F import math from skimage ...
AutoAvatar-main
utils/implicit.py
# Copyright (c) Meta Platforms, Inc. and 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 numpy as np import pickle import os import torch import torch.nn.functional as F from pytorch3d.ops import norm_lapl...
AutoAvatar-main
utils/CAPE.py
# Copyright (c) Meta Platforms, Inc. and 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 numpy as np import os import copy import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.m...
AutoAvatar-main
models/nets.py
# Copyright (c) Meta Platforms, Inc. and 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 pickle import numpy as np import os import copy import shutil, inspect import torch import torch.nn.functional as F ...
AutoAvatar-main
models/std/trainbox.py
# Copyright (c) Meta Platforms, Inc. and 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 pickle import numpy as np import os import matplotlib.pyplot as plt import torch import torch.nn as nn import torch....
AutoAvatar-main
models/std/visual.py
# Copyright (c) Meta Platforms, Inc. and 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 numpy as np import os import copy import torch import torch.nn as nn import torch.nn.functional as F import torch.au...
AutoAvatar-main
models/std/nets.py
# Copyright (c) Meta Platforms, Inc. and 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 pickle import numpy as np import os import copy import shutil, inspect import torch import torch.nn.functional as F ...
AutoAvatar-main
models/PosedDecKNN_dPoses_dHs/trainbox.py
# Copyright (c) Meta Platforms, Inc. and 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 numpy as np import os import copy import matplotlib.pyplot as plt import torch import torch.nn as nn import torch.nn...
AutoAvatar-main
models/PosedDecKNN_dPoses_dHs/nets.py
# Copyright (c) Meta Platforms, Inc. and 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 numpy as np import os import torch from torch.utils.data import DataLoader import pickle import datetime import shut...
AutoAvatar-main
exps/PosedDecKNN_dPoses_dHs/implicit_eval_dfaust.py
# Copyright (c) Meta Platforms, Inc. and 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 numpy as np import os import torch from torch.utils.data import DataLoader import pickle import datetime import shut...
AutoAvatar-main
exps/PosedDecKNN_dPoses_dHs/implicit_train_dfaust.py
# Copyright (c) Meta Platforms, Inc. and 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 numpy as np import os import copy import torch from torch.utils.data import Dataset from pytorch3d.io import load_pl...
AutoAvatar-main
data/CAPE_dataset.py
# Copyright (c) Meta Platforms, Inc. and 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 import numpy as np import h5py import sys import os import copy import pickle import yaml import smplx import ...
AutoAvatar-main
data/DFaust_generate.py
# Copyright (c) Meta Platforms, Inc. and 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 numpy as np import os import copy import pickle import torch from torch.utils.data import Dataset from pytorch3d.io ...
AutoAvatar-main
data/DFaust_dataset.py
# Copyright (c) Meta Platforms, Inc. and 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 os import numpy as np import pickle import utils.CAPE as cape_utils def CAPE_parse_raw(raw_dataset_dir, out_dir, ...
AutoAvatar-main
data/CAPE_generate.py
# Copyright (c) Meta Platforms, Inc. and 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 numpy as np import os import copy import pickle import torch from torch.utils.data import Dataset from pytorch3d.io ...
AutoAvatar-main
data/Aist_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import argparse import builtins import math import os import random import shutil import time import warnings import sys import operator from datetime import date import torch import torch.nn as nn #from torch.utils.tensorboard import SummaryWrite...
AttentiveNAS-main
train_attentive_nas.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import argparse import builtins import math import os import random import shutil import time import warnings import sys from datetime import date import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn imp...
AttentiveNAS-main
test_attentive_nas.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # Implementation adapted from Slimmable - https://github.com/JiahuiYu/slimmable_networks import torch class CrossEntropyLossSoft(torch.nn.modules.loss._Loss): """ inplace distillation for image classification """ def forward(self, output, ...
AttentiveNAS-main
utils/loss_ops.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import atexit import builtins import decimal import functools import logging import os import sys from .comm import is_master_process as is_master_proc def _suppress_print(): """ Suppresses printing from the current process. """ d...
AttentiveNAS-main
utils/logging.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # implementation adapted from Slimmable: https://github.com/JiahuiYu/slimmable_networks """config utilities for yml file.""" import os import sys import yaml class LoaderMeta(type): """Constructor for supporting `!include`. """ def __...
AttentiveNAS-main
utils/config.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import functools import logging import pickle import torch import torch.distributed as dist def get_world_size(): if not dist.is_available(): return 1 if not dist.is_initialized(): return 1 return dist.get_world_size()...
AttentiveNAS-main
utils/comm.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from copy import deepcopy import torch import os import shutil import joblib def copy_file(source_path, target_path): shutil.copyfile(source_path, target_path) def save_acc_predictor(args, acc_predictor): args.curr_acc_predictor_path = o...
AttentiveNAS-main
utils/saver.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # Implementation adapted from OFA - https://github.com/mit-han-lab/once-for-all import torch import torch.nn as nn import copy multiply_adds = 1 def count_convNd(m, _, y): cin = m.in_channels kernel_ops = m.weight.size()[2] * m.weight....
AttentiveNAS-main
utils/flops_counter.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import sys import torch import torch.nn as nn 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() ...
AttentiveNAS-main
utils/progress.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # Implementation adapted from OFA: https://github.com/mit-han-lab/once-for-all import copy import random import collections import math import torch import torch.nn as nn from .modules.dynamic_layers import DynamicMBConvLayer, DynamicConvBnActLay...
AttentiveNAS-main
models/attentive_nas_dynamic_model.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from .model_factory import *
AttentiveNAS-main
models/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # adapted from OFA: https://github.com/mit-han-lab/once-for-all import torch import torch.nn as nn from torch.autograd import Variable import torch.nn.functional as F import math from .modules.static_layers import set_layer_from_config, MBInverte...
AttentiveNAS-main
models/attentive_nas_static_model.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from .attentive_nas_dynamic_model import AttentiveNasDynamicModel def create_model(args, arch=None): n_classes = int(getattr(args, 'n_classes', 1000)) bn_momentum = getattr(args, 'bn_momentum', 0.1) bn_eps = getattr(args, 'bn_eps', 1e...
AttentiveNAS-main
models/model_factory.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # adapted from OFA: https://github.com/mit-han-lab/once-for-all from collections import OrderedDict import torch.nn as nn from .nn_utils import get_same_padding, build_activation, make_divisible, drop_connect from .nn_base import MyModule from .act...
AttentiveNAS-main
models/modules/static_layers.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # adapted from OFA: https://github.com/mit-han-lab/once-for-all import math import torch import torch.nn as nn try: from fvcore.common.file_io import PathManager except: pass class MyModule(nn.Module): def forward(self, x): ...
AttentiveNAS-main
models/modules/nn_base.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # adapted from OFA: https://github.com/mit-han-lab/once-for-all import torch import torch.nn as nn import torch.nn.functional as F # A memory-efficient implementation of Swish function class SwishImplementation(torch.autograd.Function): @stati...
AttentiveNAS-main
models/modules/activations.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # adapted from OFA: https://github.com/mit-han-lab/once-for-all from collections import OrderedDict import copy import torch import torch.nn as nn import torch.nn.functional as F from .static_layers import MBInvertedConvLayer, ConvBnActLayer, Lin...
AttentiveNAS-main
models/modules/dynamic_layers.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
AttentiveNAS-main
models/modules/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # adapted from OFA: https://github.com/mit-han-lab/once-for-all import torch.nn as nn from .activations import * def make_divisible(v, divisor=8, min_value=1): """ forked from slim: https://github.com/tensorflow/models/blob/\ 0344...
AttentiveNAS-main
models/modules/nn_utils.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # adapted from OFA: https://github.com/mit-han-lab/once-for-all from torch.autograd.function import Function import torch.nn.functional as F from torch.nn.parameter import Parameter import torch.nn as nn import torch from torch.nn.modules._function...
AttentiveNAS-main
models/modules/dynamic_ops.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import torch import torch.nn as nn from .lr_scheduler import WarmupCosineLR, WarmupMultiStepLR, WarmupLinearDecayLR, ConstantLR def build_optimizer(args, model): """ Build an optimizer from config. """ no_wd_params, wd_params ...
AttentiveNAS-main
solver/build.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import torch import math from bisect import bisect_right from typing import List class WarmupCosineLR(torch.optim.lr_scheduler._LRScheduler): def __init__(self, optimizer, max_iters, warmup_factor = 0.001, warm...
AttentiveNAS-main
solver/lr_scheduler.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from .build import build_optimizer, build_lr_scheduler
AttentiveNAS-main
solver/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 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.multiprocessing as mp import torch.utils.data import torch.utils.data.distributed impo...
AttentiveNAS-main
evaluate/imagenet_eval.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 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.multiprocessing as mp import torch.utils.data import torch.utils.data.distributed imp...
AttentiveNAS-main
evaluate/attentive_nas_eval.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import sys import atexit import os import random import copy def count_helper(v, flops, m): if flops not in m: m[flops] = {} if v not in m[flops]: m[flops][v] = 0 m[flops][v] += 1 def round_flops(flops, step): re...
AttentiveNAS-main
sampler/attentive_nas_sampler.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved """ Auto Augment Implementation adapted from timm: https://github.com/rwightman/pytorch-image-models """ import random import math from PIL import Image, ImageOps, ImageEnhance import PIL _PIL_VER = tuple([int(x) for x in PIL.__version__.split('...
AttentiveNAS-main
data/auto_augment_tf.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from __future__ import print_function import torch import torchvision.transforms.functional as F from torchvision import datasets, transforms from torch.utils.data import Dataset import math import sys import random from PIL import Image from tor...
AttentiveNAS-main
data/data_loader.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
AttentiveNAS-main
data/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import torch from PIL import Image import numpy as np import torchvision.transforms as transforms from .auto_augment_tf import ( auto_augment_policy, AutoAugment, ) IMAGENET_PIXEL_MEAN = [123.675, 116.280, 103.530] IMAGENET_PIXEL_STD = [...
AttentiveNAS-main
data/data_transform.py
#!/usr/bin/env python3 # # 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. import argparse import distutils.command.build import distutils.util import fnmatch import glob import io import os i...
CompilerGym-development
setup.py
# 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. import compiler_gym from compiler_gym.envs import LlvmEnv from tests.test_main import main def test_compiler_gym_make(): """Test that com...
CompilerGym-development
tests/make_test.py
# 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. """Unit tests for //compiler_gym/envs.""" import gym import pytest from flaky import flaky from compiler_gym.envs import llvm from compiler_gy...
CompilerGym-development
tests/compiler_env_test.py
# 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. """Tests for the copy() and deepcopy() operators on ClientServiceCompilerEnv.""" from copy import copy, deepcopy import pytest from compiler_...
CompilerGym-development
tests/env_copy_test.py
# 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. # # tests/**/__init__.py files are needed for pytest Python path resolution. See: # https://docs.pytest.org/en/latest/explanation/pythonpath.ht...
CompilerGym-development
tests/__init__.py
# 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. """Unit tests for //compiler_gym:validate.""" import gym import pytest from compiler_gym import CompilerEnvState, validate_states from tests.t...
CompilerGym-development
tests/validate_test.py
# 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. import pkg_resources import compiler_gym from compiler_gym.util.runfiles_path import runfiles_path from packaging import version from tests.py...
CompilerGym-development
tests/version_test.py
# 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. """Unit tests for //compiler_gym:compiler_env_state.""" import json from io import StringIO from pathlib import Path import pytest import requ...
CompilerGym-development
tests/compiler_env_state_test.py
# 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. """Unit tests for //compiler_gym/bin:random_search.""" import tempfile from pathlib import Path import gym from compiler_gym.random_search im...
CompilerGym-development
tests/random_search_test.py
# 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. import os import sys from getpass import getuser from typing import List, Optional import pytest from compiler_gym.util import debug_util as ...
CompilerGym-development
tests/test_main.py
# 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. """Unit tests for //compiler_gym:validation_result.""" import json import pytest from compiler_gym import CompilerEnvState, ValidationError, ...
CompilerGym-development
tests/validation_result_test.py
# 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. """Unit tests for //compiler_gym/wrappers.""" from compiler_gym.envs.llvm import LlvmEnv from compiler_gym.wrappers import CommandlineWithTermi...
CompilerGym-development
tests/wrappers/commandline_wrappers_test.py
# 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. """Unit tests for compiler_gym.wrappers.llvm.""" import numpy as np import pytest from flaky import flaky from compiler_gym.envs.llvm import L...
CompilerGym-development
tests/wrappers/llvm_test.py
# 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. """Unit tests for //compiler_gym/wrappers.""" from compiler_gym.envs.llvm import LlvmEnv from compiler_gym.wrappers import Counter from tests.t...
CompilerGym-development
tests/wrappers/counter_test.py
# 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. """Unit tests for //compiler_gym/wrappers.""" from compiler_gym.envs.llvm import LlvmEnv from compiler_gym.wrappers import CycleOverBenchmarks,...
CompilerGym-development
tests/wrappers/time_limit_wrappers_test.py
# 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. """Unit tests for //compiler_gym/wrappers.""" import pytest from compiler_gym.envs.llvm import LlvmEnv from compiler_gym.wrappers import ( ...
CompilerGym-development
tests/wrappers/datasets_wrappers_test.py
# 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. # # tests/**/__init__.py files are needed for pytest Python path resolution. See: # https://docs.pytest.org/en/latest/explanation/pythonpath.ht...
CompilerGym-development
tests/wrappers/__init__.py
# 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. """Unit tests for //compiler_gym/wrappers.""" import pytest from pytest import warns from compiler_gym.datasets import Datasets from compiler_...
CompilerGym-development
tests/wrappers/core_wrappers_test.py
# 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. """Unit tests for //compiler_gym/wrappers.""" import pytest from compiler_gym.envs.llvm import LlvmEnv from compiler_gym.wrappers import Compi...
CompilerGym-development
tests/wrappers/sqlite_logger_test.py
# 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. """Unit tests for compiler_gym.wrappers.llvm.""" import pytest from compiler_gym.envs.llvm import LlvmEnv from compiler_gym.wrappers import Va...
CompilerGym-development
tests/wrappers/validation_test.py