repo stringlengths 1 99 | file stringlengths 13 215 | code stringlengths 12 59.2M | file_length int64 12 59.2M | avg_line_length float64 3.82 1.48M | max_line_length int64 12 2.51M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
certifiable-distributional-robustness | certifiable-distributional-robustness-master/utils_mnist.py | # Based on code from https://github.com/tensorflow/cleverhans
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import keras
from keras.datasets import mnist
from keras.utils import np_utils
import warnings
import util... | 1,466 | 32.340909 | 74 | py |
adversarial_lipschitz_regularization | adversarial_lipschitz_regularization-master/semisup.py | import argparse
from copy import deepcopy
import datetime
import os
from tensorboardX import SummaryWriter
from tqdm import tqdm
import torch
from torch import nn
import torch.nn.functional as F
from torchvision import datasets, models
import torchvision.transforms as transforms
class ALR(object):
"""
Com... | 21,675 | 40.445507 | 135 | py |
BiOcularGAN | BiOcularGAN-main/make_training_data_DB_SG2.py | """
Copyright (C) 2021 NVIDIA Corporation. All rights reserved.
Licensed under The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitat... | 10,726 | 34.756667 | 122 | py |
BiOcularGAN | BiOcularGAN-main/train_interpreter_DB_SG2.py | """
Copyright (C) 2021 NVIDIA Corporation. All rights reserved.
Licensed under The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitat... | 29,451 | 35.631841 | 195 | py |
BiOcularGAN | BiOcularGAN-main/train_DB_StyleGAN2.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and rel... | 24,172 | 43.68207 | 197 | py |
BiOcularGAN | BiOcularGAN-main/training_scripts_DB_SG2/legacy.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and re... | 16,502 | 50.411215 | 154 | py |
BiOcularGAN | BiOcularGAN-main/training_scripts_DB_SG2/network_preparation.py |
import dnnlib
from models.stylegan1 import Truncation
import torch
from collections import OrderedDict
from training_scripts_DB_SG2 import legacy
from torch_utils import misc
def prepare_SG2(resolution, path_to_pretrained, avg_latent, max_layer, gpus, device, save_intermediate_results=False):
spec = dnnlib.E... | 3,228 | 49.453125 | 192 | py |
BiOcularGAN | BiOcularGAN-main/training_scripts_DB_SG2/loss.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and re... | 27,086 | 55.43125 | 166 | py |
BiOcularGAN | BiOcularGAN-main/training_scripts_DB_SG2/augment.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and re... | 26,409 | 59.993072 | 366 | py |
BiOcularGAN | BiOcularGAN-main/training_scripts_DB_SG2/dataset.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and re... | 11,083 | 36.829352 | 171 | py |
BiOcularGAN | BiOcularGAN-main/training_scripts_DB_SG2/networks.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and re... | 44,330 | 48.093023 | 164 | py |
BiOcularGAN | BiOcularGAN-main/training_scripts_DB_SG2/training_loop.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and re... | 26,382 | 48.592105 | 179 | py |
BiOcularGAN | BiOcularGAN-main/torch_utils/custom_ops.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and rel... | 5,644 | 43.448819 | 146 | py |
BiOcularGAN | BiOcularGAN-main/torch_utils/training_stats.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and rel... | 10,707 | 38.806691 | 118 | py |
BiOcularGAN | BiOcularGAN-main/torch_utils/persistence.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and re... | 9,708 | 37.527778 | 144 | py |
BiOcularGAN | BiOcularGAN-main/torch_utils/misc.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and re... | 11,016 | 40.731061 | 133 | py |
BiOcularGAN | BiOcularGAN-main/torch_utils/utils.py | """
Copyright (C) 2021 NVIDIA Corporation. All rights reserved.
Licensed under The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitat... | 7,303 | 34.803922 | 138 | py |
BiOcularGAN | BiOcularGAN-main/torch_utils/distributed.py | """
Copyright (C) 2021 NVIDIA Corporation. All rights reserved.
Licensed under The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitat... | 3,789 | 24.782313 | 80 | py |
BiOcularGAN | BiOcularGAN-main/torch_utils/inception_utils.py | """
Copyright (C) 2021 NVIDIA Corporation. All rights reserved.
Licensed under The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitat... | 14,427 | 39.301676 | 140 | py |
BiOcularGAN | BiOcularGAN-main/torch_utils/ops/bias_act.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and rel... | 10,047 | 46.173709 | 185 | py |
BiOcularGAN | BiOcularGAN-main/torch_utils/ops/grid_sample_gradfix.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and rel... | 3,299 | 38.285714 | 138 | py |
BiOcularGAN | BiOcularGAN-main/torch_utils/ops/conv2d_gradfix.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and rel... | 7,677 | 43.900585 | 197 | py |
BiOcularGAN | BiOcularGAN-main/torch_utils/ops/upfirdn2d.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and rel... | 16,287 | 41.306494 | 157 | py |
BiOcularGAN | BiOcularGAN-main/torch_utils/ops/conv2d_resample.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and rel... | 7,591 | 47.356688 | 130 | py |
BiOcularGAN | BiOcularGAN-main/torch_utils/ops/fma.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and rel... | 2,034 | 32.360656 | 105 | py |
BiOcularGAN | BiOcularGAN-main/models/stylegan1.py | """
Copyright (C) 2021 NVIDIA Corporation. All rights reserved.
Licensed under The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitat... | 30,403 | 40.994475 | 149 | py |
BiOcularGAN | BiOcularGAN-main/models/utils.py | """
Copyright (C) 2021 NVIDIA Corporation. All rights reserved.
Licensed under The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitat... | 14,062 | 27.013944 | 106 | py |
BiOcularGAN | BiOcularGAN-main/models/stylegan2.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and re... | 37,508 | 50.10218 | 164 | py |
BiOcularGAN | BiOcularGAN-main/interpreter_utils/utils.py | """
Copyright (C) 2021 NVIDIA Corporation. All rights reserved.
Licensed under The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitat... | 7,448 | 34.8125 | 138 | py |
BiOcularGAN | BiOcularGAN-main/interpreter_utils/distributed.py | """
Copyright (C) 2021 NVIDIA Corporation. All rights reserved.
Licensed under The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitat... | 3,789 | 24.782313 | 80 | py |
BiOcularGAN | BiOcularGAN-main/interpreter_utils/inception_utils.py | """
Copyright (C) 2021 NVIDIA Corporation. All rights reserved.
Licensed under The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitat... | 14,427 | 39.301676 | 140 | py |
BiOcularGAN | BiOcularGAN-main/metrics/metric_utils.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and re... | 13,696 | 38.81686 | 167 | py |
BiOcularGAN | BiOcularGAN-main/metrics/kernel_inception_distance.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and re... | 2,302 | 48 | 118 | py |
BiOcularGAN | BiOcularGAN-main/metrics/frechet_inception_distance.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and re... | 3,157 | 42.861111 | 118 | py |
BiOcularGAN | BiOcularGAN-main/metrics/perceptual_path_length.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and re... | 5,538 | 40.962121 | 131 | py |
BiOcularGAN | BiOcularGAN-main/metrics/inception_score.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and re... | 1,874 | 47.076923 | 126 | py |
BiOcularGAN | BiOcularGAN-main/metrics/metric_main.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and re... | 5,959 | 35.790123 | 147 | py |
BiOcularGAN | BiOcularGAN-main/metrics/precision_recall.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and re... | 3,617 | 56.428571 | 159 | py |
BiOcularGAN | BiOcularGAN-main/bonus_scripts/generate_more_options_new.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and rel... | 20,392 | 40.19798 | 181 | py |
BiOcularGAN | BiOcularGAN-main/bonus_scripts/generate.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and rel... | 5,338 | 40.069231 | 132 | py |
BiOcularGAN | BiOcularGAN-main/bonus_scripts/calc_metrics.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and rel... | 8,351 | 42.727749 | 142 | py |
resuneta | resuneta-master/nn/pooling/psp_pooling.py | from mxnet import gluon
from mxnet.gluon import HybridBlock
from resuneta.nn.layers.conv2Dnormed import *
class PSP_Pooling(gluon.HybridBlock):
"""
This is the PSPPooling layer, defined recursively so as to avoid calling ndarray.shape. This form is hybridizable.
"""
def __init__(self, nfilters, dept... | 3,426 | 30.731481 | 125 | py |
resuneta | resuneta-master/nn/pooling/psp_pooling_understanding_nonHybrid.py | """
Use this only to understand the psp pooling. This code is not hybridizable.
TODO: Currently there is a problem: I need the layer size at runtime, but I cannot get it for Symbol,
only for ndarray. This needs to be fixed!!!
"""
from mxnet import gluon
from mxnet.gluon import HybridBlock
from mxnet.ndarray imp... | 2,504 | 32.851351 | 114 | py |
resuneta | resuneta-master/nn/layers/conv2Dnormed.py | from mxnet import gluon
from mxnet.gluon import HybridBlock
class Conv2DNormed(HybridBlock):
"""
Convenience wrapper layer for 2D convolution followed by a normalization layer
(either BatchNorm or InstanceNorm).
norm_type: Either BatchNorm (default) or InstanceNorm strings.
axis ... | 1,902 | 34.90566 | 103 | py |
resuneta | resuneta-master/nn/layers/scale.py | from mxnet import gluon
from mxnet.gluon import HybridBlock
from resuneta.nn.layers.conv2Dnormed import *
class DownSample(HybridBlock):
"""
DownSample a convolutional layer by half, and at the same time double the number of filters.
"""
def __init__(self,_nfilters, _factor=2, _norm_type='BatchNo... | 2,783 | 36.621622 | 142 | py |
resuneta | resuneta-master/nn/layers/combine.py | from mxnet import gluon
from mxnet.gluon import HybridBlock
from resuneta.nn.layers.scale import *
from resuneta.nn.layers.conv2Dnormed import *
class combine_layers(HybridBlock):
"""
This is a function that combines two layers, a low (that is upsampled) and a higher one.
The philosophy is similar to the... | 1,232 | 29.825 | 93 | py |
resuneta | resuneta-master/nn/BBlocks/resnet_blocks.py | from mxnet import gluon
from mxnet.gluon import HybridBlock
class ResNet_v2_block(HybridBlock):
"""
ResNet v2 building block. It is built upon the assumption of ODD kernel
"""
def __init__(self, _nfilters,_kernel_size=(3,3),_dilation_rate=(1,1),
_norm_type='BatchNorm', **kwards):
... | 1,856 | 29.95 | 156 | py |
resuneta | resuneta-master/nn/loss/loss.py | import numpy as np
from mxnet.gluon.loss import Loss
class Tanimoto(Loss):
def __init__(self, _smooth=1.0e-5, _axis=[2,3], _weight = None, _batch_axis= 0, **kwards):
Loss.__init__(self,weight=_weight, batch_axis = _batch_axis, **kwards)
self.axis = _axis
self.smooth = _smooth
def h... | 3,003 | 31.652174 | 140 | py |
resuneta | resuneta-master/nn/Units/resnet_units.py | from resuneta.nn.BBlocks import resnet_blocks
from mxnet.gluon import HybridBlock
class ResNet_v2_unit(HybridBlock):
"""
Following He et al. 2016 -- there is the option to replace BatchNormalization with Instance normalization
"""
def __init__(self, _nfilters,_kernel_size=(3,3),_dilation_rate=(1,1)... | 816 | 30.423077 | 121 | py |
resuneta | resuneta-master/nn/Units/resnet_atrous_units.py | from resuneta.nn.BBlocks import resnet_blocks
from mxnet.gluon import HybridBlock
# TODO: write a more sofisticated version, using HybridBlock as a container
class ResNet_atrous_unit(HybridBlock):
def __init__(self, _nfilters, _kernel_size=(3,3), _dilation_rates=[3,15,31], _norm_type = 'BatchNorm', **kwards):... | 4,594 | 34.346154 | 156 | py |
resuneta | resuneta-master/src/ISPRSDataset.py | """
DataSet reader for the ISPRS data competition. It assumes the structure under the root directory
where the data are saved
/root/
/training/
/imgs/
/masks/
/validation/
/imgs/
/masks/
"""
import os
import numpy as np
from mxnet.gluon.data import dataset
im... | 3,091 | 29.92 | 110 | py |
resuneta | resuneta-master/models/resunet_d6_causal_mtskcolor_ddist.py | import mxnet as mx
from mxnet import gluon
from mxnet.gluon import HybridBlock
from resuneta.nn.Units.resnet_units import *
from resuneta.nn.Units.resnet_atrous_units import *
from resuneta.nn.pooling.psp_pooling import *
from resuneta.nn.layers.scale import *
from resuneta.nn.layers.combine import *
from resune... | 6,943 | 36.535135 | 114 | py |
resuneta | resuneta-master/models/resunet_d7_causal_mtskcolor_ddist.py | import mxnet as mx
from mxnet import gluon
from mxnet.gluon import HybridBlock
from resuneta.nn.Units.resnet_units import *
from resuneta.nn.Units.resnet_atrous_units import *
from resuneta.nn.pooling.psp_pooling import *
from resuneta.nn.layers.scale import *
from resuneta.nn.layers.combine import *
from resunet... | 7,474 | 36.944162 | 111 | py |
resuneta | resuneta-master/models/resunet_d7_encoder.py | import mxnet as mx
from mxnet import gluon
from mxnet.gluon import HybridBlock
from resuneta.nn.Units.resnet_units import *
from resuneta.nn.Units.resnet_atrous_units import *
from resuneta.nn.pooling.psp_pooling import *
from resuneta.nn.layers.scale import *
from resuneta.nn.layers.combine import *
from resuneta... | 4,834 | 34.551471 | 117 | py |
resuneta | resuneta-master/models/resunet_d6_encoder.py | import mxnet as mx
from mxnet import gluon
from mxnet.gluon import HybridBlock
from resuneta.nn.Units.resnet_units import *
from resuneta.nn.Units.resnet_atrous_units import *
from resuneta.nn.pooling.psp_pooling import *
from resuneta.nn.layers.scale import *
from resuneta.nn.layers.combine import *
from resuneta... | 4,237 | 33.737705 | 117 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/functions/_polynomial.py | from __future__ import annotations
from collections.abc import Iterable
from fractions import Fraction
import functools
import itertools
from jax import numpy as jnp
import numpy as np
from probnum.typing import FloatLike
from pykeops.numpy import LazyTensor, Pm
from . import _jax
from ._constant import Constant
c... | 9,590 | 28.693498 | 87 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/functions/_piecewise.py | from __future__ import annotations
from collections.abc import Iterable
import functools
from jax import numpy as jnp
import numpy as np
import probnum as pn
from probnum.typing import ArrayLike
from . import _jax
from ._constant import Constant
from ._polynomial import Polynomial
class Piecewise(_jax.JaxFunction)... | 4,581 | 24.314917 | 88 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/functions/_fourier.py | import functools
from jax import numpy as jnp
import numpy as np
from probnum.typing import ArrayLike
from .. import domains
from ._jax import JaxFunction
class TruncatedSineSeries(JaxFunction):
def __init__(
self,
domain: domains.Interval,
coefficients: ArrayLike,
) -> None:
... | 1,601 | 24.03125 | 79 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/functions/_constant.py | from __future__ import annotations
import functools
from jax import numpy as jnp
import numpy as np
from probnum.typing import ArrayLike, ShapeLike
from ._jax import JaxFunction
class Constant(JaxFunction):
def __init__(self, input_shape: ShapeLike, value: ArrayLike) -> None:
self._value = np.asarray(v... | 2,038 | 28.128571 | 85 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/functions/_jax_arithmetic.py | from __future__ import annotations
from collections.abc import Iterable
import functools
import operator
from jax import numpy as jnp
import numpy as np
from probnum.typing import ScalarLike, ScalarType
from ._jax import JaxFunction
class JaxScaledFunction(JaxFunction):
def __init__(self, function: JaxFunction... | 2,630 | 28.897727 | 80 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/functions/__init__.py | from . import bases
from ._affine import Affine
from ._constant import Constant, Zero
from ._fourier import TruncatedSineSeries
from ._jax import JaxFunction, JaxLambdaFunction
from ._jax_arithmetic import JaxScaledFunction, JaxSumFunction
from ._piecewise import Piecewise, PiecewiseConstant, PiecewiseLinear
from ._pol... | 529 | 39.769231 | 69 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/functions/_stack.py | from collections.abc import Sequence
from jax import numpy as jnp
import numpy as np
import probnum as pn
from . import _jax
class StackedFunction(_jax.JaxFunction):
def __init__(self, *fns: pn.functions.Function, axis: int = -1) -> None:
self._fns = tuple(fns)
self._axis = axis
input_s... | 1,241 | 24.346939 | 83 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/functions/_affine.py | from jax import numpy as jnp
import numpy as np
from probnum.typing import ArrayLike
from . import _jax
class Affine(_jax.JaxFunction):
def __init__(self, A: ArrayLike, b: ArrayLike) -> None:
self._A = np.asarray(A)
self._b = np.asarray(b)
if self._A.ndim == 0:
input_shape = ... | 1,350 | 24.980769 | 59 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/functions/_jax.py | from __future__ import annotations
import abc
from collections.abc import Callable
import functools
from jax import numpy as jnp
import numpy as np
import probnum as pn
from probnum.typing import ArrayLike, ShapeLike
class JaxFunction(pn.functions.Function):
def jax(self, x: ArrayLike) -> jnp.ndarray:
x... | 2,693 | 28.933333 | 87 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/problems/pde/_poisson.py | from jax import numpy as jnp
import numpy as np
import probnum as pn
from probnum.typing import ArrayLike, FloatLike
from linpde_gp import domains, functions
from linpde_gp.linfuncops import diffops
from linpde_gp.typing import DomainLike
from ._bvp import BoundaryValueProblem, DirichletBoundaryCondition
from ._linea... | 6,676 | 29.62844 | 88 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/problems/pde/_heat.py | import functools
from jax import numpy as jnp
import numpy as np
import probnum as pn
from probnum.typing import FloatLike
from linpde_gp import domains, functions
from linpde_gp.linfuncops import diffops
from linpde_gp.typing import DomainLike
from ._bvp import DirichletBoundaryCondition, InitialBoundaryValueProble... | 4,609 | 30.793103 | 146 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/covfuncs/_independent_multi_output.py | from typing import Optional
from jax import numpy as jnp
import numpy as np
import probnum as pn
from probnum.typing import ArrayLike
from ._jax import JaxCovarianceFunction
class IndependentMultiOutputCovarianceFunction(JaxCovarianceFunction):
def __init__(self, *covfuncs: JaxCovarianceFunction):
asser... | 2,274 | 30.597222 | 87 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/covfuncs/_tensor_product.py | from collections.abc import Iterable
import functools
import operator
from typing import Optional, Tuple
from jax import numpy as jnp
import numpy as np
import probnum as pn
from probnum.typing import ArrayLike
from pykeops.numpy import LazyTensor
from ._jax import JaxCovarianceFunctionMixin
class TensorProduct(
... | 4,708 | 30.393333 | 86 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/covfuncs/_zero.py | from typing import Optional
from jax import numpy as jnp
import numpy as np
import probnum as pn
from probnum.randprocs import covfuncs
from ._jax import JaxCovarianceFunctionMixin
class Zero(JaxCovarianceFunctionMixin, covfuncs.CovarianceFunction):
def _evaluate(self, x0: np.ndarray, x1: np.ndarray | None) -> ... | 1,377 | 32.609756 | 84 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/covfuncs/_expquad.py | import functools
from typing import Optional
import jax
from jax import numpy as jnp
import probnum as pn
from ._jax import JaxCovarianceFunctionMixin, JaxIsotropicMixin
class ExpQuad(
JaxCovarianceFunctionMixin, JaxIsotropicMixin, pn.randprocs.covfuncs.ExpQuad
):
@functools.partial(jax.jit, static_argnums=... | 768 | 27.481481 | 97 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/covfuncs/_wendland.py | from collections.abc import Iterable
import fractions
import functools
from typing import Optional
import jax
from jax import numpy as jnp
import numpy as np
from probnum.randprocs.covfuncs import IsotropicMixin
from probnum.typing import ArrayLike, ShapeLike
from linpde_gp import functions
from ._jax import JaxCova... | 7,204 | 28.288618 | 88 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/covfuncs/_matern.py | import functools
from typing import Optional
import jax
from jax import numpy as jnp
import numpy as np
import probnum as pn
from ._jax import JaxCovarianceFunctionMixin, JaxIsotropicMixin
class Matern(
JaxCovarianceFunctionMixin, JaxIsotropicMixin, pn.randprocs.covfuncs.Matern
):
@functools.partial(jax.jit... | 1,431 | 29.468085 | 101 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/covfuncs/_jax_arithmetic.py | import functools
import operator
from typing import Generic, Optional, TypeVar
from jax import numpy as jnp
import numpy as np
from probnum.randprocs.covfuncs._arithmetic_fallbacks import (
ScaledCovarianceFunction,
SumCovarianceFunction,
)
from probnum.typing import ArrayLike, ScalarLike, ScalarType
from ._j... | 1,974 | 28.477612 | 88 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/covfuncs/__init__.py | from ._expquad import ExpQuad
from ._galerkin import GalerkinCovarianceFunction
from ._independent_multi_output import IndependentMultiOutputCovarianceFunction
from ._jax import (
JaxCovarianceFunction,
JaxCovarianceFunctionMixin,
JaxIsotropicMixin,
JaxLambdaCovarianceFunction,
)
from ._jax_arithmetic i... | 785 | 38.3 | 87 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/covfuncs/_stack.py | from typing import Optional
from jax import numpy as jnp
import numpy as np
import probnum as pn
from probnum.randprocs import covfuncs as pn_covfuncs
from probnum.typing import ArrayLike
from linpde_gp.linops import BlockMatrix
from ._jax import JaxCovarianceFunctionMixin
class StackCovarianceFunction(
JaxCov... | 3,350 | 30.914286 | 84 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/covfuncs/_jax.py | from __future__ import annotations
import abc
from collections.abc import Callable
from typing import Optional
from jax import numpy as jnp
import numpy as np
from probnum.randprocs.covfuncs import CovarianceFunction
from probnum.typing import ArrayLike
CovarianceFunction._batched_sum = ( # pylint: disable=protecte... | 5,768 | 30.016129 | 88 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/covfuncs/linfuncops/diffops/_tensor_product.py | import functools
import operator
from typing import Optional
from jax import numpy as jnp
import numpy as np
import probnum as pn
from probnum.utils import ArrayLike
from pykeops.numpy import LazyTensor
from linpde_gp.linfuncops import diffops
from ..._jax_arithmetic import JaxSumCovarianceFunction
from ..._tensor_p... | 5,466 | 33.821656 | 88 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/covfuncs/linfuncops/diffops/_registry.py | import numpy as np
from probnum.randprocs import covfuncs as pn_covfuncs
from linpde_gp.linfuncops import diffops
from linpde_gp.randprocs import covfuncs
from . import _expquad, _matern, _tensor_product
from ..._utils import validate_covfunc_transformation
###########################################################... | 12,390 | 32.398922 | 128 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/covfuncs/linfuncops/diffops/_expquad.py | import functools
from jax import numpy as jnp
import numpy as np
from linpde_gp.linfuncops import diffops
from ... import _jax
from ..._expquad import ExpQuad
class ExpQuad_Identity_DirectionalDerivative(_jax.JaxCovarianceFunction):
def __init__(
self,
expquad: ExpQuad,
direction: np.nd... | 13,608 | 30.429561 | 88 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/covfuncs/linfuncops/diffops/_matern.py | from __future__ import annotations
import functools
from typing import Optional
from jax import numpy as jnp
import numpy as np
from probnum.randprocs import covfuncs
from pykeops.numpy import LazyTensor, Pm, Vi, Vj
from linpde_gp.functions import Monomial, RationalPolynomial
from linpde_gp.linfuncops import diffops... | 20,102 | 30.410938 | 88 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/crosscov/_arithmetic.py | from collections.abc import Sequence
import functools
import operator
from jax import numpy as jnp
import numpy as np
import probnum as pn
from probnum.typing import ScalarLike, ScalarType
from . import _pv_crosscov
class ScaledProcessVectorCrossCovariance(_pv_crosscov.ProcessVectorCrossCovariance):
def __init_... | 4,453 | 33 | 88 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/crosscov/_zero.py | from jax import numpy as jnp
import numpy as np
from ._pv_crosscov import ProcessVectorCrossCovariance
class Zero(ProcessVectorCrossCovariance):
def _evaluate(self, x: np.ndarray) -> np.ndarray:
batch_shape = x.shape[: x.ndim - self.randproc_input_ndim]
return np.zeros_like(
x,
... | 966 | 30.193548 | 82 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/crosscov/_pv_crosscov.py | from __future__ import annotations
import abc
import functools
import operator
from typing import List, Type
from jax import numpy as jnp
import numpy as np
import probnum as pn
from probnum.typing import ArrayLike, ShapeLike, ShapeType
class ProcessVectorCrossCovariance(abc.ABC):
def __init__(
self,
... | 6,609 | 32.05 | 85 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/crosscov/_parametric.py | from jax import numpy as jnp
import numpy as np
import probnum as pn
from linpde_gp.randvars import Covariance
from ._pv_crosscov import ProcessVectorCrossCovariance
class ParametricProcessVectorCrossCovariance(ProcessVectorCrossCovariance):
def __init__(
self,
crosscov: Covariance,
basi... | 1,173 | 25.088889 | 75 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/crosscov/_stack.py | from jax import numpy as jnp
import numpy as np
from probnum.typing import ArrayLike
from linpde_gp.linops import BlockMatrix
from ._pv_crosscov import ProcessVectorCrossCovariance
class StackedProcessVectorCrossCovariance(ProcessVectorCrossCovariance):
def __init__(self, pv_crosscovs: ArrayLike):
self.... | 4,656 | 35.960317 | 88 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/crosscov/linfunctls/projections.py | import functools
from jax import numpy as jnp
import numpy as np
import probnum as pn
import scipy.integrate
import scipy.linalg
import scipy.sparse
from linpde_gp.linfunctls.projections.l2 import (
L2Projection_UnivariateLinearInterpolationBasis,
)
from linpde_gp.randvars import ArrayCovariance, Covariance
from... | 5,112 | 28.554913 | 96 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/crosscov/linfunctls/_dirac.py | from jax import numpy as jnp
import numpy as np
import probnum as pn
from linpde_gp import linfunctls
from linpde_gp.randvars import Covariance, LinearOperatorCovariance
from .._pv_crosscov import ProcessVectorCrossCovariance
@linfunctls.DiracFunctional.__call__.register( # pylint: disable=no-member
ProcessVec... | 10,029 | 33.947735 | 87 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/crosscov/linfunctls/_evaluation.py | from jax import numpy as jnp
import numpy as np
import probnum as pn
from linpde_gp import linfunctls
from linpde_gp.randvars import Covariance, LinearOperatorCovariance
from .._pv_crosscov import ProcessVectorCrossCovariance
@linfunctls._EvaluationFunctional.__call__.register( # pylint: disable=protected-access,n... | 12,298 | 36.611621 | 98 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/crosscov/linfunctls/integrals/_matern_lebesgue.py | from jax import numpy as jnp
import numpy as np
from linpde_gp import functions, linfunctls
from linpde_gp.randprocs import covfuncs
from linpde_gp.randvars import ArrayCovariance, Covariance
from ._radial_lebesgue import (
UnivariateRadialCovarianceFunctionLebesgueIntegral,
univariate_radial_covfunc_lebesgue... | 4,140 | 28.161972 | 88 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/crosscov/linfunctls/integrals/_radial_lebesgue.py | from jax import numpy as jnp
import numpy as np
from probnum.randprocs import covfuncs
from linpde_gp import functions, linfunctls
from .._base import LinearFunctionalProcessVectorCrossCovariance
class UnivariateRadialCovarianceFunctionLebesgueIntegral(
LinearFunctionalProcessVectorCrossCovariance
):
def __... | 2,029 | 28 | 78 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/crosscov/linfunctls/integrals/_covfunc_lebesgue.py | import functools
import types
from jax import numpy as jnp
import numpy as np
import probnum as pn
import scipy.integrate
from linpde_gp import linfunctls
from linpde_gp.randvars import ArrayCovariance, Covariance
from .._base import LinearFunctionalProcessVectorCrossCovariance
class np_vectorize_method(np.vectori... | 2,041 | 27.361111 | 85 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/randprocs/_gaussian_process/_conditional.py | from __future__ import annotations
from collections.abc import Iterator, Sequence
import functools
from typing import Optional
import jax
import jax.numpy as jnp
import numpy as np
from numpy.typing import ArrayLike
import probnum as pn
import scipy.linalg
from linpde_gp import linfunctls
from linpde_gp.functions im... | 15,955 | 32.380753 | 89 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/linfuncops/diffops/_lindiffop.py | from collections.abc import Callable
import functools
from typing import TYPE_CHECKING
import numpy as np
import probnum as pn
from probnum.typing import ShapeLike
import linpde_gp # pylint: disable=unused-import # for type hints
from linpde_gp.functions import JaxFunction, JaxLambdaFunction
from .._arithmetic impo... | 5,787 | 34.078788 | 123 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/linfuncops/diffops/_arithmetic.py | import functools
import numpy as np
import probnum as pn
from probnum.typing import ScalarLike, ScalarType
from ._lindiffop import LinearDifferentialOperator
class ScaledLinearDifferentialOperator(LinearDifferentialOperator):
def __init__(
self, lindiffop: LinearDifferentialOperator, /, scalar: ScalarLi... | 1,827 | 28.015873 | 76 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/linfuncops/diffops/_laplacian.py | from __future__ import annotations
from collections.abc import Callable
import functools
from typing import TYPE_CHECKING
import jax
from jax import numpy as jnp
import numpy as np
import probnum as pn
from probnum.typing import ArrayLike, ShapeLike
from linpde_gp import functions
from ._coefficients import MultiIn... | 3,851 | 29.816 | 96 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/linfuncops/diffops/_partial_derivative.py | from collections.abc import Callable
import functools
import jax
import jax.numpy as jnp
import numpy as np
import probnum as pn
from probnum.typing import ShapeLike
import linpde_gp # pylint: disable=unused-import # for type hints
from .._arithmetic import CompositeLinearFunctionOperator, SumLinearFunctionOperator... | 5,075 | 32.615894 | 125 | py |
linpde-gp | linpde-gp-main/src/linpde_gp/linfuncops/diffops/_directional_derivative.py | from collections.abc import Callable
import functools
import jax
import numpy as np
import probnum as pn
from probnum.typing import ArrayLike
import linpde_gp # pylint: disable=unused-import # for type hints
from ._coefficients import MultiIndex, PartialDerivativeCoefficients
from ._lindiffop import LinearDifferent... | 1,842 | 28.725806 | 88 | py |
linpde-gp | linpde-gp-main/tests/linpde_gp/randprocs/test_posterior_gp.py | from typing import Optional
import jax
import numpy as np
import probnum as pn
from probnum.typing import ShapeType
import scipy.linalg
import pytest
import linpde_gp
jax.config.update("jax_enable_x64", True)
@pytest.fixture(params=[1], scope="module")
def input_dim(request) -> int:
return request.param
@py... | 6,092 | 26.200893 | 86 | py |
linpde-gp | linpde-gp-main/tests/linpde_gp/randprocs/kernels/linfuncops/diffops/test_diffops.py | import functools
import operator
import jax
import numpy as np
from probnum.typing import ShapeType
import scipy.stats
import pytest
from pytest_cases import parametrize_with_cases
from .cases import CovarianceFunctionDiffOpTestCase, case_modules
def X(input_shape: ShapeType) -> np.ndarray:
d = functools.reduc... | 3,296 | 34.836957 | 88 | py |
linpde-gp | linpde-gp-main/tests/linpde_gp/randprocs/kernels/linfuncops/diffops/cases/_test_case.py | import dataclasses
import functools
from typing import Type
import probnum as pn
import linpde_gp
@dataclasses.dataclass(frozen=True)
class CovarianceFunctionDiffOpTestCase:
k: linpde_gp.randprocs.covfuncs.JaxCovarianceFunction
L0: linpde_gp.linfuncops.LinearDifferentialOperator | None
L1: linpde_gp.lin... | 1,434 | 36.763158 | 87 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.