python_code
stringlengths
0
4.04M
repo_name
stringlengths
8
58
file_path
stringlengths
5
147
# 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. from typing import Dict as DictType from typing import List, Union from gym.spaces import Dict as GymDict from gym.spaces import Space class...
CompilerGym-development
compiler_gym/spaces/dict.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. from typing import List, Optional, Tuple, Union import numpy as np import compiler_gym from compiler_gym.spaces.scalar import Scalar from com...
CompilerGym-development
compiler_gym/spaces/reward.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. from typing import List, Optional from gym.spaces import Space from compiler_gym.util.gym_type_hints import ActionType class ActionSpace(Sp...
CompilerGym-development
compiler_gym/spaces/action_space.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. from typing import Callable, Iterable, List, Optional from compiler_gym.errors import BenchmarkInitError, ServiceError from compiler_gym.spac...
CompilerGym-development
compiler_gym/spaces/runtime_reward.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. """This package contains modules that can be used for preparing leaderboard submissions. We provide `leaderboards <https://github.com/facebook...
CompilerGym-development
compiler_gym/leaderboard/__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. """LLVM is a popular open source compiler used widely in industry and research. The :code:`llvm-ic-v0` environment exposes LLVM's optimizing pa...
CompilerGym-development
compiler_gym/leaderboard/llvm_instcount.py
# Protoxygen, from https://github.com/lisroach/Protoxygen ## # Doxygen filter for Google Protocol Buffers .proto files. # This script converts .proto files into C++ style ones # and prints the output to standard output. # # version 0.6-beta # # How to enable this filter in Doxygen: # 1. Generate Doxygen configuration...
CompilerGym-development
compiler_gym/third_party/proto2cpp.py
"""This module defines an API for processing LLVM-IR with inst2vec.""" import pickle from typing import List import numpy as np from compiler_gym.third_party.inst2vec import inst2vec_preprocess from compiler_gym.util.runfiles_path import runfiles_path _PICKLED_VOCABULARY = runfiles_path( "compiler_gym/third_part...
CompilerGym-development
compiler_gym/third_party/inst2vec/__init__.py
# NCC: Neural Code Comprehension # https://github.com/spcl/ncc # Copyright 2018 ETH Zurich # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the # following conditions are met: # 1. Redistributions of source code must retain the above...
CompilerGym-development
compiler_gym/third_party/inst2vec/rgx_utils.py
# NCC: Neural Code Comprehension # https://github.com/spcl/ncc # Copyright 2018 ETH Zurich # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the # following conditions are met: # 1. Redistributions of source code must retain the above...
CompilerGym-development
compiler_gym/third_party/inst2vec/inst2vec_preprocess.py
#!/usr/bin/env python3 # # This script compiles and links the sources for a cBench benchmark into a # single unoptimized LLVM module. # # Usage: # # $ make_cBench_llvm_module.py <in_dir> <outpath> [<cflag>...] # # This compiles the code from <in_dir> and generates an LLVM bitcode module at # the given <outpath>, us...
CompilerGym-development
compiler_gym/third_party/cbench/make_llvm_module.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. AUTOPHASE_FEATURE_NAMES = [ "BBNumArgsHi", "BBNumArgsLo", "onePred", "onePredOneSuc", "onePredTwoSuc", "oneSuccessor",...
CompilerGym-development
compiler_gym/third_party/autophase/__init__.py
# Copyright 2013 David Malcolm <dmalcolm@redhat.com> # Copyright 2013 Red Hat, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (...
CompilerGym-development
compiler_gym/third_party/gccinvocation/gccinvocation.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. """Module for resolving paths to LLVM binaries and libraries.""" import io import logging import shutil import sys import tarfile from pathlib ...
CompilerGym-development
compiler_gym/third_party/llvm/__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. """Constants for the InstCount feature space.""" # Generated using: # # $ bazel run //compiler_gym/third_party/llvm:PrintInstCountFeatureN...
CompilerGym-development
compiler_gym/third_party/llvm/instcount.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. """Test that the DeepDataFlow dataset contains the expected numbers of files.""" import pytest from compiler_gym.util.runfiles_path import run...
CompilerGym-development
compiler_gym/third_party/DeepDataFlow/file_count_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. """This module defines validation errors.""" from typing import Any, Dict from pydantic import BaseModel class ValidationError(BaseModel): ...
CompilerGym-development
compiler_gym/errors/validation_errors.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. from compiler_gym.errors.dataset_errors import BenchmarkInitError, DatasetInitError from compiler_gym.errors.download_errors import DownloadFai...
CompilerGym-development
compiler_gym/errors/__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. """This module defines service related errors.""" class ServiceError(Exception): """Error raised from the service.""" class SessionNotF...
CompilerGym-development
compiler_gym/errors/service_errors.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. class DownloadFailed(IOError): """Error thrown if a download fails.""" class TooManyRequests(DownloadFailed): """Error thrown by HT...
CompilerGym-development
compiler_gym/errors/download_errors.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. class BenchmarkInitError(OSError, ValueError): """Base class for errors raised if a benchmark fails to initialize.""" class DatasetInit...
CompilerGym-development
compiler_gym/errors/dataset_errors.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. """Contains an implementation of the :class:`CompilerEnv<compiler_gym.envs.CompilerEnv>` interface as a gRPC client service.""" import logging ...
CompilerGym-development
compiler_gym/service/client_service_compiler_env.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. from compiler_gym.service.compilation_session import CompilationSession from compiler_gym.service.connection import ( CompilerGymServiceCon...
CompilerGym-development
compiler_gym/service/__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. """This module contains the logic for connecting to services.""" import logging import os import subprocess import sys from pathlib import Path...
CompilerGym-development
compiler_gym/service/connection.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. from pathlib import Path from typing import List, Optional, Tuple from compiler_gym.service.proto import ActionSpace, Benchmark from compiler_...
CompilerGym-development
compiler_gym/service/compilation_session.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. """This module defines a filesystem cache for services.""" import os import random import shutil from datetime import datetime from pathlib imp...
CompilerGym-development
compiler_gym/service/service_cache.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. from compiler_gym.service.proto.compiler_gym_service_pb2 import ( ActionSpace, AddBenchmarkReply, AddBenchmarkRequest, Benchmar...
CompilerGym-development
compiler_gym/service/proto/__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. """This module contains converters to/from protobuf messages. For example <compiler_gym.servie.proto.ActionSpace>/<compiler_gym.servie.proto.O...
CompilerGym-development
compiler_gym/service/proto/py_converters.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 logging from typing import Dict, Optional import numpy as np from compiler_gym.service.proto import Benchmark MAX_SIZE_IN_BYTES = 512...
CompilerGym-development
compiler_gym/service/runtime/benchmark_cache.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. from compiler_gym.service.runtime.create_and_run_compiler_gym_service import ( create_and_run_compiler_gym_service, ) __all__ = [ "cr...
CompilerGym-development
compiler_gym/service/runtime/__init__.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. """An example CompilerGym service in python.""" import os import sys from concurrent import futures from multiproces...
CompilerGym-development
compiler_gym/service/runtime/create_and_run_compiler_gym_service.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 logging import traceback from contextlib import contextmanager from pathlib import Path from threading import Lock from typing import Di...
CompilerGym-development
compiler_gym/service/runtime/compiler_gym_service.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.envs.loop_tool # noqa from compiler_gym import config from compiler_gym.envs.compiler_env import CompilerEnv from compiler...
CompilerGym-development
compiler_gym/envs/__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. """This module defines the OpenAI gym interface for compilers.""" from abc import ABC, abstractmethod from typing import Iterable, List, Option...
CompilerGym-development
compiler_gym/envs/compiler_env.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. """Register the loop_tool environment and reward.""" from pathlib import Path from typing import Iterable from compiler_gym.datasets import Be...
CompilerGym-development
compiler_gym/envs/loop_tool/__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. """Define the loop_tool environment.""" import logging import time from functools import reduce from pathlib import Path from typing import Opt...
CompilerGym-development
compiler_gym/envs/loop_tool/service/loop_tool_compilation_session.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. from enum import Enum class observation_spaces(Enum): Ir = "Ir" IrSha1 = "IrSha1" Bitcode = "Bitcode" BitcodeFile = "BitcodeF...
CompilerGym-development
compiler_gym/envs/llvm/specs.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. """This module defines reward spaces used by the LLVM environment.""" from typing import List, Optional from compiler_gym.datasets import Benc...
CompilerGym-development
compiler_gym/envs/llvm/llvm_rewards.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 logging import os import subprocess import tempfile import urllib.parse from compiler_gym.datasets import Benchmark, BenchmarkInitError...
CompilerGym-development
compiler_gym/envs/llvm/benchmark_from_command_line.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. from typing import List from compiler_gym.spaces import ActionSpace from compiler_gym.util.gym_type_hints import ActionType class LlvmComman...
CompilerGym-development
compiler_gym/envs/llvm/llvm_command_line.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. """Register the LLVM environments.""" import sys from itertools import product from compiler_gym.envs.llvm.benchmark_from_command_line import ...
CompilerGym-development
compiler_gym/envs/llvm/__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. """This module defines a utility function for computing LLVM observations.""" import subprocess from pathlib import Path from typing import Lis...
CompilerGym-development
compiler_gym/envs/llvm/compute_observation.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. """This module defines a utility function for constructing LLVM benchmarks.""" import logging import os import random import subprocess import ...
CompilerGym-development
compiler_gym/envs/llvm/llvm_benchmark.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. """Extensions to the ClientServiceCompilerEnv environment for LLVM.""" import logging import os import shlex import shutil import subprocess fr...
CompilerGym-development
compiler_gym/envs/llvm/llvm_env.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. """Utilities for LexedIRTuple derived observation space.""" import subprocess from pathlib import Path from tempfile import NamedTemporaryFile ...
CompilerGym-development
compiler_gym/envs/llvm/lexed_ir.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 enum import io import logging import os import re import shutil import subprocess import sys import tarfile import tempfile from collect...
CompilerGym-development
compiler_gym/envs/llvm/datasets/cbench.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 subprocess from concurrent.futures import as_completed from pathlib import Path from typing import Iterable from compiler_gym.datasets ...
CompilerGym-development
compiler_gym/envs/llvm/datasets/chstone.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 subprocess from concurrent.futures import as_completed from pathlib import Path from compiler_gym.datasets import Benchmark, TarDataset...
CompilerGym-development
compiler_gym/envs/llvm/datasets/jotaibench.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 logging import os import subprocess import sys from concurrent.futures import as_completed from pathlib import Path from compiler_gym.d...
CompilerGym-development
compiler_gym/envs/llvm/datasets/poj104.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 logging import subprocess from pathlib import Path from typing import Iterable, List, Optional import numpy as np from compiler_gym.da...
CompilerGym-development
compiler_gym/envs/llvm/datasets/csmith.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 sys from pathlib import Path from typing import Iterable, Optional from compiler_gym.datasets import Dataset, TarDatasetWithManifest fr...
CompilerGym-development
compiler_gym/envs/llvm/datasets/__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. import subprocess from pathlib import Path from typing import Iterable import numpy as np from compiler_gym.datasets import Benchmark, Datase...
CompilerGym-development
compiler_gym/envs/llvm/datasets/llvm_stress.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 io import logging import os import shutil import subprocess import tarfile from pathlib import Path from threading import Lock from typi...
CompilerGym-development
compiler_gym/envs/llvm/datasets/clgen.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 subprocess import sys from concurrent.futures import as_completed from pathlib import Path from typing import Optional from compiler_gy...
CompilerGym-development
compiler_gym/envs/llvm/datasets/anghabench.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. """This module demonstrates how to """ from pathlib import Path from compiler_gym.envs.gcc.gcc import Gcc, GccSpec, Option from compiler_gym.e...
CompilerGym-development
compiler_gym/envs/gcc/__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. """A CompilerGym environment for GCC.""" import codecs import json import pickle from pathlib import Path from typing import Any, Dict, List, O...
CompilerGym-development
compiler_gym/envs/gcc/gcc_env.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. """Query a GCC binary for version, optimization and param spaces. The goal of this file is to query the available s...
CompilerGym-development
compiler_gym/envs/gcc/gcc.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. """Reward spaces for use in the GCC environments.""" from compiler_gym.spaces import Reward from compiler_gym.views.observation import Observat...
CompilerGym-development
compiler_gym/envs/gcc/gcc_rewards.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 from pathlib import Path from typing import Iterable from compiler_gym.datasets import Benchmark, TarDatasetWithManifest from compil...
CompilerGym-development
compiler_gym/envs/gcc/datasets/chstone.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 logging import shutil import subprocess import tempfile from pathlib import Path from threading import Lock from typing import Iterable,...
CompilerGym-development
compiler_gym/envs/gcc/datasets/csmith.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. from functools import lru_cache from pathlib import Path from typing import Iterable, List, Optional, Union from compiler_gym.datasets import ...
CompilerGym-development
compiler_gym/envs/gcc/datasets/__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. import sys from pathlib import Path from typing import Optional from compiler_gym.datasets import TarDatasetWithManifest # TODO(github.com/f...
CompilerGym-development
compiler_gym/envs/gcc/datasets/anghabench.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. """A CompilerGym service for GCC.""" import codecs import hashlib import json import logging import os import pickle...
CompilerGym-development
compiler_gym/envs/gcc/service/gcc_service.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. """Register the MLIR environments.""" from compiler_gym.envs.mlir.mlir_env import MlirEnv from compiler_gym.util.registration import register ...
CompilerGym-development
compiler_gym/envs/mlir/__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. from pathlib import Path from typing import Iterable, List, Optional, Union import numpy as np from compiler_gym.datasets import Dataset fro...
CompilerGym-development
compiler_gym/envs/mlir/mlir_env.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 logging from pathlib import Path from typing import Iterable, Optional from compiler_gym.datasets import Benchmark, BenchmarkSource, Da...
CompilerGym-development
compiler_gym/envs/mlir/datasets/matmul.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. from pathlib import Path from typing import Iterable, Optional from compiler_gym.datasets import Dataset from compiler_gym.envs.mlir.datasets....
CompilerGym-development
compiler_gym/envs/mlir/datasets/__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. from typing import Callable, Dict, List from compiler_gym.errors import ServiceError from compiler_gym.service.proto import ObservationSpace f...
CompilerGym-development
compiler_gym/views/observation.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. from compiler_gym.views.observation import ObservationView from compiler_gym.views.observation_space_spec import ObservationSpaceSpec from comp...
CompilerGym-development
compiler_gym/views/__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. import warnings from typing import Dict, List from compiler_gym.datasets import Benchmark from compiler_gym.spaces.reward import Reward from c...
CompilerGym-development
compiler_gym/views/reward.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. from typing import Any, Callable, ClassVar, Optional, Union from gym.spaces import Space from compiler_gym.service.proto import Event, Observ...
CompilerGym-development
compiler_gym/views/observation_space_spec.py
# Copyright 2021 The TF-Coder Authors. # Copyright (c) Facebook, Inc. and its affiliates. # # 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 # ...
APIsynth-master
Synthesis_incorporation/filter_group.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. # Lint as: python3 """Functions and arguments used in the PyCoder project.""" import ast import collections import torch ...
APIsynth-master
Synthesis_incorporation/torch_functions.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 import torch as T from torch import nn EMBEDDING_SIZE = 150 SHAPE_EMBEDDING_SIZE = 6 class pycoder_parameters...
APIsynth-master
Synthesis_incorporation/models/models.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. # Lint as: python3 """An interface for predicting operations given input and output.""" import abc import torch import tor...
APIsynth-master
Synthesis_incorporation/models/prediction_model.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. # Lint as: python3 """Creates prediction model from strings.""" import collections from typing import Callable, Dict, List...
APIsynth-master
Synthesis_incorporation/models/prediction_model_factory.py
# Copyright 2021 The TF-Coder Authors. # Copyright (c) Facebook, Inc. and its affiliates. # # 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 # ...
APIsynth-master
Synthesis_incorporation/benchmarks/stackoverflow_benchmarks.py
# Copyright 2021 The TF-Coder Authors. # Copyright (c) Facebook, Inc. and its affiliates. # # 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 # ...
APIsynth-master
Synthesis_incorporation/value_search/value_search.py
# Copyright 2021 The TF-Coder Authors. # Copyright (c) Facebook, Inc. and its affiliates. # # 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 # ...
APIsynth-master
Synthesis_incorporation/value_search/operation_base.py
# Copyright 2021 The TF-Coder Authors. # Copyright (c) Facebook, Inc. and its affiliates. # # 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 # ...
APIsynth-master
Synthesis_incorporation/value_search/value_search_settings.py
# Copyright 2021 The TF-Coder Authors. # Copyright (c) Facebook, Inc. and its affiliates. # # 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 # ...
APIsynth-master
Synthesis_incorporation/value_search/operation_filtering.py
# Copyright (c) Facebook, Inc. and its affiliates. # Copyright (c) Facebook, Inc. and its affiliates. # # 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/L...
APIsynth-master
Synthesis_incorporation/value_search/tensor_member_operations.py
# Copyright 2021 The TF-Coder Authors. # Copyright (c) Facebook, Inc. and its affiliates. # # 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 # ...
APIsynth-master
Synthesis_incorporation/value_search/all_operations.py
# Copyright 2021 The TF-Coder Authors. # Copyright (c) Facebook, Inc. and its affiliates. # # 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 # ...
APIsynth-master
Synthesis_incorporation/value_search/function_operation.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 argparse from logging import getLogger import math import os import shutil import time import torch import torch....
DeeperCluster-main
eval_pretrain.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 argparse import time import numpy as np import torch import torch.nn as nn import torch.optim import torch.utils....
DeeperCluster-main
eval_voc_classif.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 argparse import os import apex import numpy as np import torch import torch.distributed as dist import torch.nn a...
DeeperCluster-main
main.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 argparse from logging import getLogger import os import time import numpy as np from sklearn import metrics impor...
DeeperCluster-main
eval_linear.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. # from logging import getLogger import os import pickle import faiss import torch import torch.distributed as dist from to...
DeeperCluster-main
src/clustering.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. # from logging import getLogger import os import signal import time logger = getLogger() def trigger_job_requeue(checkp...
DeeperCluster-main
src/slurm.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. #
DeeperCluster-main
src/__init__.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 os import logging import time from datetime import timedelta import pandas as pd class LogFormatter(): def _...
DeeperCluster-main
src/logger.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. # from logging import getLogger import os import pickle import time import faiss import numpy as np import torch import to...
DeeperCluster-main
src/distributed_kmeans.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 argparse from logging import getLogger import os import pickle import shutil import time import numpy as np from ...
DeeperCluster-main
src/utils.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. # from logging import getLogger import os import shutil import time import numpy as np import torch import torch.distribut...
DeeperCluster-main
src/trainer.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 os from logging import getLogger import pickle import numpy as np import torch import torch.nn as nn from src.mo...
DeeperCluster-main
src/model/pretrain.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. #
DeeperCluster-main
src/model/__init__.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 math import torch import torch.nn as nn import torch.nn.init as init cfg = { 'D': [64, 64, 'M', 128, 128, 'M...
DeeperCluster-main
src/model/vgg16.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. # from logging import getLogger import torch import torch.nn as nn import torch.optim from .vgg16 import VGG16 logger =...
DeeperCluster-main
src/model/model_factory.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. #
DeeperCluster-main
src/data/__init__.py