python_code
stringlengths
0
229k
import os import threading from datetime import datetime import torch import torch.distributed.rpc as rpc import torch.multiprocessing as mp import torch.nn as nn from torch import optim import torchvision batch_size = 20 image_w = 64 image_h = 64 num_classes = 30 batch_update_size = 5 num_batches = 6 def timed_l...
import argparse import os from threading import Lock import torch import torch.distributed.autograd as dist_autograd import torch.distributed.rpc as rpc import torch.multiprocessing as mp import torch.nn as nn import torch.nn.functional as F from torch import optim from torch.distributed.optim import DistributedOptimi...
import argparse import gymnasium as gym import numpy as np import os from itertools import count import torch import torch.distributed.rpc as rpc import torch.multiprocessing as mp import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.distributed.rpc import RRef, rpc_sync, rpc_as...
import os import torch import torch.distributed.autograd as dist_autograd import torch.distributed.rpc as rpc import torch.multiprocessing as mp import torch.optim as optim from torch.distributed.optim import DistributedOptimizer import rnn def _run_trainer(): r""" The trainer creates a distributed RNNModel...
import torch import torch.nn as nn import torch.distributed.rpc as rpc from torch.distributed.rpc import RRef def _call_method(method, rref, *args, **kwargs): r""" a helper function to call a method on the given RRef """ return method(rref.local_value(), *args, **kwargs) def _remote_method(method, r...
import torch from torch.fx import symbolic_trace, replace_pattern ''' How to Use the FX Subgraph Rewriter For easy subgraph rewriting, FX exposes the utility function: replace_pattern(gm : GraphModule, pattern : Callable, replacement : Callable) -> Non...
import torch from torch.fx import symbolic_trace, Tracer, Graph, GraphModule, Node from typing import Any, Callable, Dict, Optional, Tuple, Union """ How to Create and Use Custom Tracers `Tracer`--the class that implements the symbolic tracing functionality of `torch.fx.symbolic_trace`--can be subclassed to overrid...
import torch from torch.fx import symbolic_trace import operator """ How to Replace One Op With Another 1. Iterate through all Nodes in your GraphModule's Graph. 2. Determine if the current Node should be replaced. (Suggested: match on the Node's ``target`` attribute). 3. Create a replacement Node and add it to the G...
from enum import Enum, auto import torch from torch.fx import GraphModule, Node, Proxy, symbolic_trace ''' Wrap Graph Output Dynamically The following code demonstrates how change an existing Graph based on parameters specified at runtime. We'll let the user specify an activation function from a predefined Enum lis...
""" This file demonstrates using a custom FX Tracer to override the behavior of `torch.autograd.profiler.record_function` and make profiler ranges appear in FX-traced code. This is done with Python dynamic patching magic, allowing us to explicitly emit calls to `torch.ops.profiler._record_function_enter/_record_functio...
""" Recording Module Hierarchy With a Custom Tracer In this example, we are going to define a custom `fx.Tracer` instance that-- for each recorded operation--also notes down the qualified name of the module from which that operation originated. The _qualified name_ is the path to the Module from the root module. More ...
import torch import torch.fx """ In this example we are going do define a library of "composite" operations. Composite operations are those that are defined as callable functions that are composed of several other operations in their implementation. Composite operations allow you to choose at what level of abstraction...
import torch import torch.fx as fx # An inverse mapping is one that takes a function f(x) and returns a function g # such that f(g(x)) == x. For example,since log(exp(x)) == x, exp and log are # inverses. invert_mapping = {} def add_inverse(a, b): invert_mapping[a] = b invert_mapping[b] = a inverses = [ (...
import torch from torch.fx import Proxy, Graph, GraphModule ''' How to Create a Graph Using Proxy Objects Instead of Tracing It's possible to directly create a Proxy object around a raw Node. This can be used to create a Graph independently of symbolic tracing. The following code demonstrates how to use Proxy with ...
import torch from torch.fx import Proxy, symbolic_trace from torch.fx.node import map_arg ''' How to Inline a Function Into an Existing Graph One reason you might want to inline a function is to get around FX's default tracing behavior. For example, unless you've defined a custom Tracer, the out-of-the-box implement...
import torch import torch.fx import operator # Does this path not exist? Check that you've done the following: # 1) Read README.md and follow the instructions to build libinterpreter. # 2) If this file still does not exist after you've followed those instructions, # check if it is under a different extension (e.g. ...
import torch import torch.nn as nn import torch.nn.init as init class Net(nn.Module): def __init__(self, upscale_factor): super(Net, self).__init__() self.relu = nn.ReLU() self.conv1 = nn.Conv2d(1, 64, (5, 5), (1, 1), (2, 2)) self.conv2 = nn.Conv2d(64, 64, (3, 3), (1, 1), (1, 1)) ...
import torch.utils.data as data from os import listdir from os.path import join from PIL import Image def is_image_file(filename): return any(filename.endswith(extension) for extension in [".png", ".jpg", ".jpeg"]) def load_img(filepath): img = Image.open(filepath).convert('YCbCr') y, _, _ = img.split(...
from __future__ import print_function import argparse from math import log10 import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import DataLoader from model import Net from data import get_training_set, get_test_set # Training settings parser = argparse.ArgumentParser(description='Py...
from os.path import exists, join, basename from os import makedirs, remove from six.moves import urllib import tarfile from torchvision.transforms import Compose, CenterCrop, ToTensor, Resize from dataset import DatasetFromFolder def download_bsd300(dest="dataset"): output_image_dir = join(dest, "BSDS300/images"...
from __future__ import print_function import argparse import torch from PIL import Image from torchvision.transforms import ToTensor import numpy as np # Training settings parser = argparse.ArgumentParser(description='PyTorch Super Res Example') parser.add_argument('--input_image', type=str, required=True, help='inpu...
from __future__ import print_function import argparse import os import random import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.optim as optim import torch.utils.data import torchvision.datasets as dset import torchvision.transforms as transforms import torchv...
import os from argparse import ArgumentParser def makedirs(name): """helper function for python 2 and 3 to call os.makedirs() avoiding an error if the directory to be created already exists""" import os, errno try: os.makedirs(name) except OSError as ex: if ex.errno == errno.EE...
import torch import torch.nn as nn class Bottle(nn.Module): def forward(self, input): if len(input.size()) <= 2: return super(Bottle, self).forward(input) size = input.size()[:2] out = super(Bottle, self).forward(input.view(size[0]*size[1], -1)) return out.view(size[0]...
import os import time import glob import torch import torch.optim as O import torch.nn as nn from torchtext.legacy import data from torchtext.legacy import datasets from model import SNLIClassifier from util import get_args, makedirs args = get_args() if torch.cuda.is_available(): torch.cuda.set_device(args.gp...
import argparse import gym import numpy as np from itertools import count from collections import namedtuple import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.distributions import Categorical # Cart Pole parser = argparse.ArgumentParser(description='PyTorch act...
import argparse import gym import numpy as np from itertools import count from collections import deque import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.distributions import Categorical parser = argparse.ArgumentParser(description='PyTorch REINFORCE example') p...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. # Configuration file for the Sphinx documentation builder. # # This file only contains a...
from __future__ import print_function import argparse import torch import torch.nn as nn import torch.optim as optim import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt class Sequence(nn.Module): def __init__(self): super(Sequence, self).__init__() self.lstm1 ...
import numpy as np import torch np.random.seed(2) T = 20 L = 1000 N = 100 x = np.empty((N, L), 'int64') x[:] = np.array(range(L)) + np.random.randint(-4 * T, 4 * T, N).reshape(N, 1) data = np.sin(x / 1.0 / T).astype('float64') torch.save(data, open('traindata.pt', 'wb'))
import os import zipfile # PyTorch 1.1 moves _download_url_to_file # from torch.utils.model_zoo to torch.hub # PyTorch 1.0 exists another _download_url_to_file # 2 argument # TODO: If you remove support PyTorch 1.0 or older, # You should remove torch.utils.model_zoo # Ref. PyTorch #18758 # http...
import torch class TransformerNet(torch.nn.Module): def __init__(self): super(TransformerNet, self).__init__() # Initial convolution layers self.conv1 = ConvLayer(3, 32, kernel_size=9, stride=1) self.in1 = torch.nn.InstanceNorm2d(32, affine=True) self.conv2 = ConvLayer(32, ...
from collections import namedtuple import torch from torchvision import models class Vgg16(torch.nn.Module): def __init__(self, requires_grad=False): super(Vgg16, self).__init__() vgg_pretrained_features = models.vgg16(pretrained=True).features self.slice1 = torch.nn.Sequential() ...
import argparse import os import sys import time import re import numpy as np import torch from torch.optim import Adam from torch.utils.data import DataLoader from torchvision import datasets from torchvision import transforms import torch.onnx import utils from transformer_net import TransformerNet from vgg import ...
import torch from PIL import Image def load_image(filename, size=None, scale=None): img = Image.open(filename).convert('RGB') if size is not None: img = img.resize((size, size), Image.ANTIALIAS) elif scale is not None: img = img.resize((int(img.size[0] / scale), int(img.size[1] / scale)), ...
from __future__ import division from __future__ import print_function import argparse import gzip import os import sys import urllib try: from urllib.error import URLError from urllib.request import urlretrieve except ImportError: from urllib2 import URLError from urllib import urlretrieve RESOURCES ...
from __future__ import print_function from __future__ import unicode_literals import argparse import matplotlib.pyplot as plt import torch parser = argparse.ArgumentParser() parser.add_argument("-i", "--sample-file", required=True) parser.add_argument("-o", "--out-file", default="out.png") parser.add_argument("-d",...
""" This python script converts the network into Script Module """ import torch from torchvision import models # Download and load the pre-trained model model = models.resnet18(pretrained=True) # Set upgrading the gradients to False for param in model.parameters(): param.requires_grad = False # Save the model excep...
import argparse import os import random import shutil import time import warnings from enum import Enum import torch import torch.backends.cudnn as cudnn import torch.distributed as dist import torch.multiprocessing as mp import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import ...
# This code is based on the implementation of Mohammad Pezeshki available at # https://github.com/mohammadpz/pytorch_forward_forward and licensed under the MIT License. # Modifications/Improvements to the original code have been made by Vivek V Patel. import argparse import torch import torch.nn as nn from torchvision...
from __future__ import print_function import argparse, random, copy import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torchvision from torch.utils.data import Dataset from torchvision import datasets from torchvision import transforms as T from tor...
import os import torch import torch.optim as optim import torch.nn.functional as F def train(rank, args, model, device, dataset, dataloader_kwargs): torch.manual_seed(args.seed + rank) train_loader = torch.utils.data.DataLoader(dataset, **dataloader_kwargs) optimizer = optim.SGD(model.parameters(), lr=a...
from __future__ import print_function import argparse import torch import torch.nn as nn import torch.nn.functional as F import torch.multiprocessing as mp from torch.utils.data.sampler import Sampler from torchvision import datasets, transforms from train import train, test # Training settings parser = argparse.Argu...
#!/usr/bin/env python from __future__ import print_function from itertools import count import torch import torch.nn.functional as F POLY_DEGREE = 4 W_target = torch.randn(POLY_DEGREE, 1) * 5 b_target = torch.randn(1) * 5 def make_features(x): """Builds features i.e. a matrix with columns [x, x^2, x^3, x^4]."""...
import os import time import requests import tarfile import numpy as np import argparse import torch from torch import nn import torch.nn.functional as F from torch.optim import Adam class GraphConv(nn.Module): """ Graph Convolutional Layer described in "Semi-Supervised Classification with Graph Convolut...
from __future__ import print_function import argparse import torch import torch.utils.data from torch import nn, optim from torch.nn import functional as F from torchvision import datasets, transforms from torchvision.utils import save_image parser = argparse.ArgumentParser(description='VAE MNIST Example') parser.add...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and 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 setuptools import find_packages, setup # Minimum required python version REQUIRED_MAJOR =...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and 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 torch from botorch import settings from botorch.logging import LOG_LEVEL_DEFAULT, logger, sha...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import itertools import warnings import torch from botorch.cross_validation import batch_cross_validation, gen_loo_c...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math from contextlib import ExitStack, nullcontext from itertools import filterfalse, product from typing impo...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree.
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math import warnings import torch from botorch.acquisition import ExpectedImprovement, qExpectedImprovement f...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. r""" Monolithic CUDA tests. This implements a single monolithic test for all CUDA functionality. The main reason for ...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and 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 import gpytorch.settings as gp_settings import linear_operator.settings as linop_settings from botor...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from botorch.test_functions.multi_fidelity import ( AugmentedBranin, AugmentedHartmann, AugmentedRosenbro...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree.
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from botorch.test_functions.multi_objective_multi_fidelity import ( MOMFBraninCurrin, MOMFPark, ) from botorch.utils.te...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from botorch.exceptions.errors import InputDataError from botorch.test_functions.synthetic import ( ...
#! /usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math from typing import List import torch from botorch.exceptions.errors import UnsupportedError from botorc...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from botorch.test_functions.sensitivity_analysis import Gsobol, Ishigami, Morris from botorch.utils.test...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from botorch.test_functions.base import BaseTestProblem, ConstrainedBaseTestProblem from botorch.utils.t...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and 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 import torch from botorch.acquisition import LinearMCObjective, ScalarizedPosteriorTransform...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from itertools import product import torch from botorch.acquisition.predictive_entropy_search import qPredictiveEntr...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import itertools from unittest import mock import torch from botorch.acquisition.objective import GenericMCObjective...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from botorch.acquisition import ( ExpectedImprovement, qExpectedImprovement, qMultiStepLook...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and 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 copy import deepcopy from functools import partial from itertools import product from math impor...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and 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, Optional from unittest import mock import torch from botorch.acquisition.cost_aware imp...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from itertools import product import torch from botorch.acquisition.analytic import ExpectedImprovement from botorch...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and 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 copy import deepcopy from itertools import product from math import pi from unittest import mock...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and 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 import torch from botorch import settings from botorch.acquisition.decoupled import DecoupledAcquisi...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and 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 import torch from botorch import settings from botorch.acquisition.cost_aware import ( CostAwar...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations import math from typing import Any, Callable, Sequence, Type from unittest import...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math from unittest import mock import torch from botorch.acquisition import logei, monte_carlo from botorch.a...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and 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 Optional import torch from botorch.acquisition.objective import LinearMCObjective from botorch.a...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree.
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from botorch.acquisition.acquisition import ( AcquisitionFunction, MCSamplerMixin, MultiMode...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math import torch from botorch.acquisition import qAnalyticProbabilityOfImprovement from botorch.acquisition....
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import itertools import warnings from typing import Optional import torch from botorch import settings from botorch....
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from botorch.acquisition.analytic import ExpectedImprovement from botorch.acquisition.monte_carlo import...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from contextlib import ExitStack from unittest import mock import torch from botorch.acquisition.analytic import Pos...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from botorch.acquisition.analytic import ExpectedImprovement from botorch.acquisition.fixed_feature impo...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and 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 unittest import mock import torch from botorch import settings from botorch.acquisition.cached_...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from botorch.acquisition.acquisition import AcquisitionFunction from botorch.acquisition.preference impo...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from itertools import product import torch from botorch.acquisition.joint_entropy_search import qJointEntropySearch ...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from unittest import mock import torch from botorch.acquisition.active_learning import ( PairwiseMCPosteriorVari...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from itertools import product import torch from botorch.acquisition.multi_objective.predictive_entropy_search import...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and 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 itertools import product from unittest import mock import torch from botorch.acquisition.multi_...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and 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 unittest import mock import torch from botorch import settings from botorch.acquisition.multi_o...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and 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 copy import deepcopy from itertools import product from math import pi from unittest import mock...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from itertools import product from unittest import mock import torch from botorch.acquisition.max_value_entropy_sear...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and 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 Optional import torch from botorch import settings from botorch.acquisition.multi...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree.
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from botorch.acquisition.multi_objective.analytic import ( ExpectedHypervolumeImprovement, Mult...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import itertools import warnings import torch from botorch.acquisition.multi_objective.multi_output_risk_measures im...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from itertools import product import torch from botorch.acquisition.multi_objective.joint_entropy_search import ( ...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from botorch.sampling.deterministic import DeterministicSampler from botorch.utils.testing import Botorc...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from unittest import mock import torch from botorch.exceptions.errors import UnsupportedError from botorch.posterior...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from botorch.posteriors.deterministic import DeterministicPosterior from botorch.posteriors.gpytorch imp...
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from unittest import mock import torch from botorch.posteriors.torch import TorchPosterior from botorch.sampling.sto...