entry_point stringlengths 1 65 | original_triton_python_code stringlengths 208 619k | optimised_triton_code stringlengths 1.15k 275k | repo_name stringlengths 7 115 | module_name stringlengths 1 65 | synthetic bool 1
class | uuid int64 0 18.5k | licenses listlengths 1 6 | stars int64 0 19.8k | sha stringlengths 40 40 | repo_link stringlengths 72 180 |
|---|---|---|---|---|---|---|---|---|---|---|
ActorCriticMLP | import torch
from torch import Tensor
from torch import nn
from typing import Tuple
from torch.nn import functional as F
class ActorCriticMLP(nn.Module):
"""MLP network with heads for actor and critic."""
def __init__(self, input_shape: 'Tuple[int]', n_actions: 'int',
hidden_size: 'int'=128):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Benjamin-Etheredge/lightning-bolts | ActorCriticMLP | false | 148 | [
"Apache-2.0"
] | 0 | 1971d6a924729940b98793aa7751bdf769350aca | https://github.com/Benjamin-Etheredge/lightning-bolts/tree/1971d6a924729940b98793aa7751bdf769350aca |
GlobalAveragePool | import torch
from torch import nn
class GlobalAveragePool(nn.Module):
"""
Average pooling in an equivariant network
"""
def __init__(self):
"""
"""
super().__init__()
def forward(self, x):
"""
"""
avg = torch.mean(x, dim=[-2, -1], keepdim=True)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | BeomyeolYu/symmetrizer | GlobalAveragePool | false | 149 | [
"MIT"
] | 0 | 4617c82dc8ab05ac02ac50846799e0b820ff51ce | https://github.com/BeomyeolYu/symmetrizer/tree/4617c82dc8ab05ac02ac50846799e0b820ff51ce |
SpatialAttention2d | import torch
import torch.nn as nn
import torch._utils
class SpatialAttention2d(nn.Module):
def __init__(self, channel):
super(SpatialAttention2d, self).__init__()
self.squeeze = nn.Conv2d(channel, 1, kernel_size=1, bias=False)
self.sigmoid = nn.Sigmoid()
def forward(self, x):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch._utils
assert_size_stride = torch._C._dynamo.... | Bhaskers-Blu-Org2/seismic-deeplearning | SpatialAttention2d | false | 150 | [
"MIT"
] | 0 | 15d45fb8c9cef463fd01fae2e087ba62c98cb799 | https://github.com/Bhaskers-Blu-Org2/seismic-deeplearning/tree/15d45fb8c9cef463fd01fae2e087ba62c98cb799 |
Critic | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Critic(nn.Module):
"""Critic (Value) Model."""
def __init__(self, state_size, action_size, seed, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
import tor... | BenKang34/deep-reinforcement-learning-nanodegree | Critic | false | 151 | [
"MIT"
] | 0 | 17c9007f757dfb1217c869fdee51798c4a21ba92 | https://github.com/BenKang34/deep-reinforcement-learning-nanodegree/tree/17c9007f757dfb1217c869fdee51798c4a21ba92 |
GlobalMaxPool | import torch
from torch import nn
class GlobalMaxPool(nn.Module):
"""
Max pooling in an equivariant network
"""
def __init__(self):
"""
"""
super().__init__()
def forward(self, x):
"""
"""
mx = torch.max(torch.max(x, dim=-1, keepdim=True)[0], dim=-... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | BeomyeolYu/symmetrizer | GlobalMaxPool | false | 152 | [
"MIT"
] | 0 | 4617c82dc8ab05ac02ac50846799e0b820ff51ce | https://github.com/BeomyeolYu/symmetrizer/tree/4617c82dc8ab05ac02ac50846799e0b820ff51ce |
Policy | import torch
import torch.nn.functional as F
import torch.nn as nn
class Policy(nn.Module):
def __init__(self):
super(Policy, self).__init__()
self.conv1 = nn.Conv2d(2, 4, kernel_size=6, stride=2, bias=False)
self.conv2 = nn.Conv2d(4, 16, kernel_size=6, stride=4)
self.size = 9 * 9... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | BenKang34/deep-reinforcement-learning-nanodegree | Policy | false | 153 | [
"MIT"
] | 0 | 17c9007f757dfb1217c869fdee51798c4a21ba92 | https://github.com/BenKang34/deep-reinforcement-learning-nanodegree/tree/17c9007f757dfb1217c869fdee51798c4a21ba92 |
Delta | import torch
import torch.nn as nn
from torchaudio import transforms
class Delta(nn.Module):
def __init__(self, order=2, **kwargs):
super(Delta, self).__init__()
self.order = order
self.compute_delta = transforms.ComputeDeltas(**kwargs)
def forward(self, x):
feats = [x]
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from torchaudio import transforms
assert_size_stride = tor... | B06901052/s3prl | Delta | false | 154 | [
"MIT"
] | 0 | 5f63d2df043d2d7c81580cd042fa2cea34746f48 | https://github.com/B06901052/s3prl/tree/5f63d2df043d2d7c81580cd042fa2cea34746f48 |
ScaledLeakyReLU | import math
import torch
from torch import nn
from torch.nn import functional as F
class ScaledLeakyReLU(nn.Module):
def __init__(self, negative_slope=0.2):
super().__init__()
self.negative_slope = negative_slope
def forward(self, input):
out = F.leaky_relu(input, negative_slope=self... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | BinahHu/stylegan2-pytorch | ScaledLeakyReLU | false | 155 | [
"MIT",
"BSD-2-Clause",
"Apache-2.0"
] | 0 | 9975707ffd93872fce02f7e3654eb588a09e23e4 | https://github.com/BinahHu/stylegan2-pytorch/tree/9975707ffd93872fce02f7e3654eb588a09e23e4 |
HSwish | import torch
from torch import nn
class HSwish(nn.Module):
"""Hard Swish activation function.
See: https://arxiv.org/abs/1905.02244
"""
def forward(self, x):
return x * nn.functional.relu6(x + 3).div_(6)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
re... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | BlueskyFR/determined | HSwish | false | 156 | [
"Apache-2.0"
] | 0 | ac734f0df11565333f9f37480cfc01dda011e349 | https://github.com/BlueskyFR/determined/tree/ac734f0df11565333f9f37480cfc01dda011e349 |
SchedulerTestNet | import torch
from torch.nn import functional as F
class SchedulerTestNet(torch.nn.Module):
"""adapted from: https://github.com/pytorch/pytorch/blob/master/test/test_optim.py."""
def __init__(self):
super().__init__()
self.conv1 = torch.nn.Conv2d(1, 1, 1)
self.conv2 = torch.nn.Conv2d(1... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C... | Benjamin-Etheredge/lightning-bolts | SchedulerTestNet | false | 157 | [
"Apache-2.0"
] | 0 | 1971d6a924729940b98793aa7751bdf769350aca | https://github.com/Benjamin-Etheredge/lightning-bolts/tree/1971d6a924729940b98793aa7751bdf769350aca |
GAB | import torch
import torch.nn as nn
import torch._utils
class GAB(nn.Module):
def __init__(self, input_dim, reduction=4):
super(GAB, self).__init__()
self.global_avgpool = nn.AdaptiveAvgPool2d(1)
self.conv1 = nn.Conv2d(input_dim, input_dim // reduction,
kernel_size=1, stride=1)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | Bhaskers-Blu-Org2/seismic-deeplearning | GAB | false | 158 | [
"MIT"
] | 0 | 15d45fb8c9cef463fd01fae2e087ba62c98cb799 | https://github.com/Bhaskers-Blu-Org2/seismic-deeplearning/tree/15d45fb8c9cef463fd01fae2e087ba62c98cb799 |
CaffeNormalize | import torch
import torch.utils.data
import torch.nn as nn
class CaffeNormalize(nn.Module):
def __init__(self, features, eps=1e-07):
super(CaffeNormalize, self).__init__()
self.scale = nn.Parameter(10.0 * torch.ones(features))
self.eps = eps
def forward(self, x):
x_size = x.s... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dy... | BingjieTang/DepthAwareCNN | CaffeNormalize | false | 159 | [
"MIT"
] | 0 | 9d72a7dc921d1dd550507018d4b51968ef89bbb7 | https://github.com/BingjieTang/DepthAwareCNN/tree/9d72a7dc921d1dd550507018d4b51968ef89bbb7 |
SCse | import torch
import torch.nn as nn
import torch._utils
class SpatialAttention2d(nn.Module):
def __init__(self, channel):
super(SpatialAttention2d, self).__init__()
self.squeeze = nn.Conv2d(channel, 1, kernel_size=1, bias=False)
self.sigmoid = nn.Sigmoid()
def forward(self, x):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | Bhaskers-Blu-Org2/seismic-deeplearning | SCse | false | 160 | [
"MIT"
] | 0 | 15d45fb8c9cef463fd01fae2e087ba62c98cb799 | https://github.com/Bhaskers-Blu-Org2/seismic-deeplearning/tree/15d45fb8c9cef463fd01fae2e087ba62c98cb799 |
ClippedReLU | import torch
import torch.nn as nn
class ClippedReLU(nn.Module):
def __init__(self):
super(ClippedReLU, self).__init__()
def forward(self, x):
return x.clamp(min=0.0, max=255.0)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | Bovbene/WSCCSN | ClippedReLU | false | 161 | [
"Apache-2.0"
] | 0 | 7f454050218e7f2162b0bdc1cdff938d876efc0b | https://github.com/Bovbene/WSCCSN/tree/7f454050218e7f2162b0bdc1cdff938d876efc0b |
Rosenbrock | import torch
import numpy as np
from torch import nn
class Rosenbrock(nn.Module):
def __init__(self, n1, n2, a=1.0 / 20.0, b=5.0):
super(Rosenbrock, self).__init__()
self.n1 = n1
self.n2 = n2
self.a = a
self.b = b
def forward(self, x):
dim2 = x.ndimension() > ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynam... | BrettLeroux/GRIPS-MCMC | Rosenbrock | false | 162 | [
"MIT"
] | 0 | 154457acfc47977e25870aed76c7dc49d70608af | https://github.com/BrettLeroux/GRIPS-MCMC/tree/154457acfc47977e25870aed76c7dc49d70608af |
FakeRKHSConvNet | import math
import torch
import numpy as np
from torch import nn
class MaybeBatchNorm2d(nn.Module):
def __init__(self, n_ftr, affine, use_bn):
super().__init__()
self.bn = nn.BatchNorm2d(n_ftr, affine=affine)
self.use_bn = use_bn
def forward(self, x):
if self.use_bn:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Benjamin-Etheredge/lightning-bolts | FakeRKHSConvNet | false | 163 | [
"Apache-2.0"
] | 0 | 1971d6a924729940b98793aa7751bdf769350aca | https://github.com/Benjamin-Etheredge/lightning-bolts/tree/1971d6a924729940b98793aa7751bdf769350aca |
LayerNorm | import torch
import torch.utils.data
import torch.nn as nn
class LayerNorm(nn.Module):
def __init__(self, features, eps=1e-06, gamma=1.0, beta=0.0, learnable=
False):
super(LayerNorm, self).__init__()
if learnable:
self.gamma = nn.Parameter(torch.ones(features))
se... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dy... | BingjieTang/DepthAwareCNN | LayerNorm | false | 164 | [
"MIT"
] | 0 | 9d72a7dc921d1dd550507018d4b51968ef89bbb7 | https://github.com/BingjieTang/DepthAwareCNN/tree/9d72a7dc921d1dd550507018d4b51968ef89bbb7 |
NoiseInjection | import torch
from torch import nn
class NoiseInjection(nn.Module):
def __init__(self):
super().__init__()
self.weight = nn.Parameter(torch.zeros(1))
def forward(self, image, noise=None):
if noise is None:
batch, _, height, width = image.shape
noise = image.new... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | BinahHu/stylegan2-pytorch | NoiseInjection | false | 165 | [
"MIT",
"BSD-2-Clause",
"Apache-2.0"
] | 0 | 9975707ffd93872fce02f7e3654eb588a09e23e4 | https://github.com/BinahHu/stylegan2-pytorch/tree/9975707ffd93872fce02f7e3654eb588a09e23e4 |
EqualConv2d | import math
import torch
from torch import nn
from torch.nn import functional as F
class EqualConv2d(nn.Module):
def __init__(self, in_channel, out_channel, kernel_size, stride=1,
padding=0, bias=True):
super().__init__()
self.weight = nn.Parameter(torch.randn(out_channel, in_channel,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
from torch import nn
assert_size_stride = torch._C._dynamo.guards.as... | BinahHu/stylegan2-pytorch | EqualConv2d | false | 166 | [
"MIT",
"BSD-2-Clause",
"Apache-2.0"
] | 0 | 9975707ffd93872fce02f7e3654eb588a09e23e4 | https://github.com/BinahHu/stylegan2-pytorch/tree/9975707ffd93872fce02f7e3654eb588a09e23e4 |
InputInjection | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
from torch.cuda.amp import autocast as autocast
import torch._C
import torch.serialization
class InputInjection(nn.Module):
"""Downsampling module for CGNet."""
def __ini... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
from torch.cud... | BostonCrayfish/mmsegmentation | InputInjection | false | 167 | [
"Apache-2.0"
] | 0 | e8b87242b877bfe0c32ea2630c2fd08977d7dd4b | https://github.com/BostonCrayfish/mmsegmentation/tree/e8b87242b877bfe0c32ea2630c2fd08977d7dd4b |
NormalProposal | import torch
from torch import nn
from torch.distributions import Normal
class NormalProposal(nn.Module):
def __init__(self, sigma):
super(NormalProposal, self).__init__()
self.sigma = sigma
def forward(self, x):
return Normal(x, self.sigma).sample()
def get_inputs():
return [t... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | BrettLeroux/GRIPS-MCMC | NormalProposal | false | 168 | [
"MIT"
] | 0 | 154457acfc47977e25870aed76c7dc49d70608af | https://github.com/BrettLeroux/GRIPS-MCMC/tree/154457acfc47977e25870aed76c7dc49d70608af |
Discriminator | import torch
import numpy as np
from torch import nn
from torch.nn import functional as F
class Discriminator(nn.Module):
def __init__(self, img_shape, hidden_dim=1024):
super().__init__()
in_dim = int(np.prod(img_shape))
self.fc1 = nn.Linear(in_dim, hidden_dim)
self.fc2 = nn.Line... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
from torch import nn
assert_size_stride = torch._C._dynamo.gu... | Benjamin-Etheredge/lightning-bolts | Discriminator | false | 169 | [
"Apache-2.0"
] | 0 | 1971d6a924729940b98793aa7751bdf769350aca | https://github.com/Benjamin-Etheredge/lightning-bolts/tree/1971d6a924729940b98793aa7751bdf769350aca |
DDPGActorVersion1 | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class DDPGActorVersion1(nn.Module):
def __init__(self, state_size, action_size, seed, fc1_units=128,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Brandon-HY-Lin/deep-reinforcement-learning | DDPGActorVersion1 | false | 170 | [
"MIT"
] | 0 | d809851b6f98d1089379392d4687e2acaf1c0c79 | https://github.com/Brandon-HY-Lin/deep-reinforcement-learning/tree/d809851b6f98d1089379392d4687e2acaf1c0c79 |
ExampleBackbone | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
from torch.cuda.amp import autocast as autocast
import torch._C
import torch.serialization
class ExampleBackbone(nn.Module):
def __init__(self):
super(ExampleBackbone... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.u... | BostonCrayfish/mmsegmentation | ExampleBackbone | false | 171 | [
"Apache-2.0"
] | 0 | e8b87242b877bfe0c32ea2630c2fd08977d7dd4b | https://github.com/BostonCrayfish/mmsegmentation/tree/e8b87242b877bfe0c32ea2630c2fd08977d7dd4b |
ConvRelu | import torch
import torch.nn as nn
class ConvRelu(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, bias=True):
super(ConvRelu, self).__init__()
self.conv = nn.Conv2d(in_channels, out_channels, kernel_size,
padding=kernel_size // 2, bias=bias)
self.relu = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Bovbene/WSCCSN | ConvRelu | false | 172 | [
"Apache-2.0"
] | 0 | 7f454050218e7f2162b0bdc1cdff938d876efc0b | https://github.com/Bovbene/WSCCSN/tree/7f454050218e7f2162b0bdc1cdff938d876efc0b |
NormalSamples | import torch
import torch.nn as nn
import torch.utils.checkpoint
def norm(x, axis=None, eps=1e-05):
if axis is not None:
return (x - x.mean(axis, True)) / (x.std(axis, keepdim=True) + eps)
else:
return (x - x.mean()) / (x.std() + eps)
class NormalSamples(nn.Module):
"""The [reparameteriz... | import torch
from torch import device
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.utils.checkpoint
as... | Antipurity/sensor-network | NormalSamples | false | 173 | [
"MIT"
] | 0 | c5cc67dee408da831c3ab60a03374da3c4789bd2 | https://github.com/Antipurity/sensor-network/tree/c5cc67dee408da831c3ab60a03374da3c4789bd2 |
Gblock | import torch
import torch.nn as nn
class Gblock(nn.Module):
def __init__(self, in_channels, out_channels, groups):
super(Gblock, self).__init__()
self.conv0 = nn.Conv2d(in_channels, out_channels, kernel_size=3,
padding=1, groups=groups)
self.relu = nn.PReLU()
self.conv... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Bovbene/WSCCSN | Gblock | false | 174 | [
"Apache-2.0"
] | 0 | 7f454050218e7f2162b0bdc1cdff938d876efc0b | https://github.com/Bovbene/WSCCSN/tree/7f454050218e7f2162b0bdc1cdff938d876efc0b |
EqualLinear | from torch.autograd import Function
import math
import torch
from torch import nn
from torch.nn import functional as F
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5):
return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale)
class FusedLeakyReLUFunctionBackward(Function):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.autograd import Function
import math
from torch import nn
assert_size... | BinahHu/stylegan2-pytorch | EqualLinear | false | 175 | [
"MIT",
"BSD-2-Clause",
"Apache-2.0"
] | 0 | 9975707ffd93872fce02f7e3654eb588a09e23e4 | https://github.com/BinahHu/stylegan2-pytorch/tree/9975707ffd93872fce02f7e3654eb588a09e23e4 |
NodeAdaptiveEncoder | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
class NodeAdaptiveEncoder(nn.Module):
def __init__(self, num_features, dropout=0.5):
super(NodeAdaptiveEncoder, self).__init__()
self.fc = nn.Parameter(torch.zeros(size=(num_features, 1)))
nn.init.x... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dyn... | BruceW91/cogdl | NodeAdaptiveEncoder | false | 176 | [
"MIT"
] | 0 | 1ad524375f5ba062103698a0432fc857572a6933 | https://github.com/BruceW91/cogdl/tree/1ad524375f5ba062103698a0432fc857572a6933 |
PPMConcat | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
from torch.cuda.amp import autocast as autocast
import torch._C
import torch.serialization
class PPMConcat(nn.ModuleList):
"""Pyramid Pooling Module that only concat the featu... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
from torch.cud... | BostonCrayfish/mmsegmentation | PPMConcat | false | 177 | [
"Apache-2.0"
] | 0 | e8b87242b877bfe0c32ea2630c2fd08977d7dd4b | https://github.com/BostonCrayfish/mmsegmentation/tree/e8b87242b877bfe0c32ea2630c2fd08977d7dd4b |
Deep_Neural_Network | import torch
import torch.utils.data
import torch.nn as nn
class Deep_Neural_Network(nn.Module):
def __init__(self, D_in, fc1_size=40, fc2_size=20, fc3_size=40,
fc4_size=20, fc5_size=40):
"""
Neural Network model with 1 hidden layer.
D_in: Dimension of input
fc1_size, fc2... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dyn... | Bradnowak/Flowlytic | Deep_Neural_Network | false | 178 | [
"BSD-2-Clause"
] | 0 | d5b0951901b97d5546f2ecd700eee5b78c689646 | https://github.com/Bradnowak/Flowlytic/tree/d5b0951901b97d5546f2ecd700eee5b78c689646 |
MADDPGActorVersion1 | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class MADDPGActorVersion1(nn.Module):
def __init__(self, state_size, action_size, seed, fc1_units, fc2_unit... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Brandon-HY-Lin/deep-reinforcement-learning | MADDPGActorVersion1 | false | 179 | [
"MIT"
] | 0 | d809851b6f98d1089379392d4687e2acaf1c0c79 | https://github.com/Brandon-HY-Lin/deep-reinforcement-learning/tree/d809851b6f98d1089379392d4687e2acaf1c0c79 |
ModulatedConv2d | from torch.autograd import Function
import math
import torch
from torch import nn
from torch.nn import functional as F
def upsample(in_tens, out_H=64):
in_H = in_tens.shape[2]
scale_factor = 1.0 * out_H / in_H
return nn.Upsample(scale_factor=scale_factor, mode='bilinear',
align_corners=False)(in_t... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch.autograd... | BinahHu/stylegan2-pytorch | ModulatedConv2d | false | 180 | [
"MIT",
"BSD-2-Clause",
"Apache-2.0"
] | 0 | 9975707ffd93872fce02f7e3654eb588a09e23e4 | https://github.com/BinahHu/stylegan2-pytorch/tree/9975707ffd93872fce02f7e3654eb588a09e23e4 |
Linear | import torch
import torch.nn.functional as F
import torch.nn as nn
class Linear(nn.Module):
def __init__(self, node_dim, hid_dim, num_class_l1, num_class_l2,
num_class_l3):
super(Linear, self).__init__()
self.linear_l1 = nn.Linear(node_dim, num_class_l1)
self.linear_l2 = nn.Linear... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn.functional as F
import torch.nn as nn
assert_size_stride = torch... | BrandonBian/OSDR-GNN | Linear | false | 181 | [
"MIT"
] | 0 | 0f631d5ddad77df7260c11de3507af014f9447ed | https://github.com/BrandonBian/OSDR-GNN/tree/0f631d5ddad77df7260c11de3507af014f9447ed |
DDPGCriticVersion1 | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class DDPGCriticVersion1(nn.Module):
def __init__(self, state_size, action_size, seed, fcs1_units=128,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
import tor... | Brandon-HY-Lin/deep-reinforcement-learning | DDPGCriticVersion1 | false | 182 | [
"MIT"
] | 0 | d809851b6f98d1089379392d4687e2acaf1c0c79 | https://github.com/Brandon-HY-Lin/deep-reinforcement-learning/tree/d809851b6f98d1089379392d4687e2acaf1c0c79 |
ToRGB | from torch.autograd import Function
import math
import torch
from torch import nn
from torch.nn import functional as F
def upsample(in_tens, out_H=64):
in_H = in_tens.shape[2]
scale_factor = 1.0 * out_H / in_H
return nn.Upsample(scale_factor=scale_factor, mode='bilinear',
align_corners=False)(in_t... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.autograd import Function
import math
from torch import nn
from torch.... | BinahHu/stylegan2-pytorch | ToRGB | false | 183 | [
"MIT",
"BSD-2-Clause",
"Apache-2.0"
] | 0 | 9975707ffd93872fce02f7e3654eb588a09e23e4 | https://github.com/BinahHu/stylegan2-pytorch/tree/9975707ffd93872fce02f7e3654eb588a09e23e4 |
Neural_Net | import torch
import torch.utils.data
import torch.nn as nn
class Neural_Net(nn.Module):
def __init__(self, D_in):
"""
Neural Network model with 1 hidden layer.
D_in: Dimension of input
"""
super(Neural_Net, self).__init__()
self.fc1 = nn.Linear(D_in, 100)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | Bradnowak/Flowlytic | Neural_Net | false | 184 | [
"BSD-2-Clause"
] | 0 | d5b0951901b97d5546f2ecd700eee5b78c689646 | https://github.com/Bradnowak/Flowlytic/tree/d5b0951901b97d5546f2ecd700eee5b78c689646 |
FocalLossBinary | import torch
import torch.jit
import torch.nn.functional as F
import torch.nn.functional
from functools import partial
from torch.nn.modules.loss import _Loss
def reduced_focal_loss(outputs: 'torch.Tensor', targets: 'torch.Tensor',
threshold: 'float'=0.5, gamma: 'float'=2.0, reduction='mean'):
"""
Compute... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | CamilaGL/nnUNet | FocalLossBinary | false | 185 | [
"Apache-2.0"
] | 0 | 471ab73a6e4f67fc72d476183b5344be4cccf7ca | https://github.com/CamilaGL/nnUNet/tree/471ab73a6e4f67fc72d476183b5344be4cccf7ca |
Vgg16 | import torch
from torch import nn
import torch.nn.functional as F
class Vgg16(nn.Module):
def __init__(self):
super(Vgg16, self).__init__()
self.conv1_1 = nn.Conv2d(3, 64, kernel_size=3, stride=1, padding=1)
self.conv1_2 = nn.Conv2d(64, 64, kernel_size=3, stride=1, padding=1)
self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | Arthur1511/CAD-COVID | Vgg16 | false | 186 | [
"MIT"
] | 0 | daab5d70b9f811da41f702e92179a15ca4809fa5 | https://github.com/Arthur1511/CAD-COVID/tree/daab5d70b9f811da41f702e92179a15ca4809fa5 |
Dueling_QNetwork | import torch
import torch.nn.functional as F
import torch.nn as nn
class Dueling_QNetwork(nn.Module):
def __init__(self, state_size, action_size, seed, fc1_units=64,
fc2_units=64):
super().__init__()
self.seed = torch.manual_seed(seed)
self.fc1_a = nn.Linear(state_size, fc1_units)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | Brandon-HY-Lin/deep-reinforcement-learning | Dueling_QNetwork | false | 187 | [
"MIT"
] | 0 | d809851b6f98d1089379392d4687e2acaf1c0c79 | https://github.com/Brandon-HY-Lin/deep-reinforcement-learning/tree/d809851b6f98d1089379392d4687e2acaf1c0c79 |
NAC | from torch.nn import Module
import torch
from torch.nn.parameter import Parameter
from torch.nn import functional
from torch.nn import init
from torch.nn.modules import Module
import torch.utils.data
class NAC(Module):
def __init__(self, n_in, n_out):
super().__init__()
self.W_hat = Parameter(tor... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch.nn impor... | Caerisse/deep_focus | NAC | false | 188 | [
"MIT"
] | 0 | a6549e0b222a01569b224fb651666ef5dbb5072f | https://github.com/Caerisse/deep_focus/tree/a6549e0b222a01569b224fb651666ef5dbb5072f |
AttwNetHead | import torch
import torch.nn as nn
import torch.distributed
import torch.optim.lr_scheduler
import torch.utils.data
class AttwNetHead(nn.Module):
def __init__(self, idim, hdim, odim):
super().__init__()
self.mlp_attn = nn.Linear(idim, 1, bias=False)
self.mlp_out = nn.Linear(idim, odim, bi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | CFM-MSG/SDN | AttwNetHead | false | 189 | [
"MIT"
] | 0 | f309602dc2bb73117355003f3744f8e5450dbccc | https://github.com/CFM-MSG/SDN/tree/f309602dc2bb73117355003f3744f8e5450dbccc |
Embeddings | import math
import torch
import torch.nn as nn
class Embeddings(nn.Module):
def __init__(self, d_model, vocab):
super(Embeddings, self).__init__()
self.lut = nn.Embedding(vocab, d_model)
self.d_model = d_model
def forward(self, x):
newx = x.long()
embeddingMat = self.... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | CallMeSp/My_flowQA | Embeddings | false | 190 | [
"Apache-2.0"
] | 0 | 87d82551f614b089771b22a1992e2be41a2995b3 | https://github.com/CallMeSp/My_flowQA/tree/87d82551f614b089771b22a1992e2be41a2995b3 |
ConvBlockINEDense | import torch
from torch import nn
from torch.nn import init as init
class ConvBlockINEDense(nn.Module):
def __init__(self, n_ch, act='relu', ksize=3, norm='in', padding_mode=
'circular'):
super().__init__()
padding = (ksize - 1) // 2
if act == 'lrelu':
self.act = nn.Le... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | BaekduChoi/Halftoning | ConvBlockINEDense | false | 191 | [
"BSD-3-Clause"
] | 0 | 9459d202c0b3b4e587e6d89af04c4bcfaa604d31 | https://github.com/BaekduChoi/Halftoning/tree/9459d202c0b3b4e587e6d89af04c4bcfaa604d31 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self, n_obs, n_mid, n_action):
super().__init__()
self.fc1 = nn.Linear(n_obs, n_mid)
self.fc2 = nn.Linear(n_mid, n_mid)
self.fc3 = nn.Linear(n_mid, n_action)
def forward(self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | CUSP-NYU/autonomous-drone-swarm | Net | false | 192 | [
"MIT"
] | 0 | 3bad474fd9641521588af61ddc48b84ffc746a74 | https://github.com/CUSP-NYU/autonomous-drone-swarm/tree/3bad474fd9641521588af61ddc48b84ffc746a74 |
HadamardProduct | import torch
import torch.nn as nn
import torch.distributed
import torch.optim.lr_scheduler
import torch.utils.data
class HadamardProduct(nn.Module):
def __init__(self, idim_1, idim_2, hdim):
super(HadamardProduct, self).__init__()
self.fc_1 = nn.Linear(idim_1, hdim)
self.fc_2 = nn.Linear... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | CFM-MSG/SDN | HadamardProduct | false | 193 | [
"MIT"
] | 0 | f309602dc2bb73117355003f3744f8e5450dbccc | https://github.com/CFM-MSG/SDN/tree/f309602dc2bb73117355003f3744f8e5450dbccc |
Classifier | import torch
from torch import nn
import torch.optim.lr_scheduler
class Classifier(nn.Module):
def __init__(self, latent_size, output_size):
super().__init__()
self.fc1 = nn.Linear(latent_size, 100)
self.relu1 = nn.LeakyReLU(0.2)
self.fc2 = nn.Linear(100, 50)
self.relu2 = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.optim.lr_scheduler
assert_size_stride = torch.... | CMU-IDS-2020/fp-index-out-of-bounds | Classifier | false | 194 | [
"BSD-3-Clause"
] | 0 | 1a9fdaac8288a980e759a0c2e46f28294d25c71f | https://github.com/CMU-IDS-2020/fp-index-out-of-bounds/tree/1a9fdaac8288a980e759a0c2e46f28294d25c71f |
LCCALayer | import torch
import torch.nn as nn
def mean_channels(F):
assert F.dim() == 4
spatial_sum = F.sum(3, keepdim=True).sum(2, keepdim=True)
return spatial_sum / (F.size(2) * F.size(3))
def stdv_channels(F):
assert F.dim() == 4
F_mean = mean_channels(F)
F_variance = (F - F_mean).pow(2).sum(3, keep... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | Cai631/PMDN | LCCALayer | false | 195 | [
"Apache-2.0"
] | 0 | 3eca931fbef64f612572d24c856a91342bbdea59 | https://github.com/Cai631/PMDN/tree/3eca931fbef64f612572d24c856a91342bbdea59 |
Generator | import torch
from torch import nn
import torch.nn.functional as F
import torch.optim.lr_scheduler
class Generator(nn.Module):
"""Define standard linear + softmax generation step."""
def __init__(self, d_model, vocab):
super(Generator, self).__init__()
self.proj = nn.Linear(d_model, vocab)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | CMU-IDS-2020/fp-index-out-of-bounds | Generator | false | 196 | [
"BSD-3-Clause"
] | 0 | 1a9fdaac8288a980e759a0c2e46f28294d25c71f | https://github.com/CMU-IDS-2020/fp-index-out-of-bounds/tree/1a9fdaac8288a980e759a0c2e46f28294d25c71f |
BDiceLoss | import torch
import torch.nn as nn
def centercrop(image, w, h):
_nt, _ct, ht, wt = image.size()
padw, padh = (wt - w) // 2, (ht - h) // 2
if padw > 0 and padh > 0:
image = image[:, :, padh:-padh, padw:-padw]
return image
def flatten(x):
x_flat = x.clone()
x_flat = x_flat.view(x.shape... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | CarlosPena00/pytorch-unet | BDiceLoss | false | 197 | [
"MIT"
] | 0 | 8365bace23e4b04b9c5b75cd6720807ea8cac5ab | https://github.com/CarlosPena00/pytorch-unet/tree/8365bace23e4b04b9c5b75cd6720807ea8cac5ab |
BCELoss2c | import torch
import torch.nn as nn
class BCELoss2c(nn.Module):
def __init__(self):
super(BCELoss2c, self).__init__()
self.bce0 = nn.BCEWithLogitsLoss()
self.bce1 = nn.BCEWithLogitsLoss()
None
def forward(self, y_pred, y_true, weights=None):
loss_0 = self.bce0(y_pred[:... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | CarlosPena00/pytorch-unet | BCELoss2c | false | 198 | [
"MIT"
] | 0 | 8365bace23e4b04b9c5b75cd6720807ea8cac5ab | https://github.com/CarlosPena00/pytorch-unet/tree/8365bace23e4b04b9c5b75cd6720807ea8cac5ab |
BCELoss | import torch
import torch.nn as nn
class BCELoss(nn.Module):
def __init__(self):
super(BCELoss, self).__init__()
self.bce = nn.BCEWithLogitsLoss()
def forward(self, y_pred, y_true, weights=None):
loss_0 = self.bce(y_pred[:, 0], y_true[:, 0])
loss_1 = self.bce(y_pred[:, 1], y_... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | CarlosPena00/pytorch-unet | BCELoss | false | 199 | [
"MIT"
] | 0 | 8365bace23e4b04b9c5b75cd6720807ea8cac5ab | https://github.com/CarlosPena00/pytorch-unet/tree/8365bace23e4b04b9c5b75cd6720807ea8cac5ab |
NALU | from torch.nn import Module
import torch
from torch.nn.parameter import Parameter
from torch.nn import functional
from torch.nn import init
from torch.nn.modules import Module
import torch.utils.data
class NAC(Module):
def __init__(self, n_in, n_out):
super().__init__()
self.W_hat = Parameter(tor... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
fr... | Caerisse/deep_focus | NALU | false | 200 | [
"MIT"
] | 0 | a6549e0b222a01569b224fb651666ef5dbb5072f | https://github.com/Caerisse/deep_focus/tree/a6549e0b222a01569b224fb651666ef5dbb5072f |
WeightedBDiceLoss | import torch
import torch.nn as nn
def centercrop(image, w, h):
_nt, _ct, ht, wt = image.size()
padw, padh = (wt - w) // 2, (ht - h) // 2
if padw > 0 and padh > 0:
image = image[:, :, padh:-padh, padw:-padw]
return image
class WeightedBDiceLoss(nn.Module):
def __init__(self):
su... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | CarlosPena00/pytorch-unet | WeightedBDiceLoss | false | 201 | [
"MIT"
] | 0 | 8365bace23e4b04b9c5b75cd6720807ea8cac5ab | https://github.com/CarlosPena00/pytorch-unet/tree/8365bace23e4b04b9c5b75cd6720807ea8cac5ab |
DiceLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class DiceLoss(nn.Module):
def __init__(self, dims=(1, 2, 3)) ->None:
super(DiceLoss, self).__init__()
self.eps: 'float' = 1e-06
self.dims = dims
def forward(self, input: 'torch.Tensor', target: 'torch.Tensor',
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | CarlosPena00/pytorch-unet | DiceLoss | false | 202 | [
"MIT"
] | 0 | 8365bace23e4b04b9c5b75cd6720807ea8cac5ab | https://github.com/CarlosPena00/pytorch-unet/tree/8365bace23e4b04b9c5b75cd6720807ea8cac5ab |
StableBCELoss | import torch
class StableBCELoss(torch.nn.modules.Module):
def __init__(self):
super(StableBCELoss, self).__init__()
def forward(self, input, target):
neg_abs = -input.abs()
loss = input.clamp(min=0) - input * target + (1 + neg_abs.exp()).log()
return loss.mean()
def get_in... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_stride = t... | CarlosPena00/pytorch-unet | StableBCELoss | false | 203 | [
"MIT"
] | 0 | 8365bace23e4b04b9c5b75cd6720807ea8cac5ab | https://github.com/CarlosPena00/pytorch-unet/tree/8365bace23e4b04b9c5b75cd6720807ea8cac5ab |
MultiHeadAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.distributed
import torch.optim.lr_scheduler
import torch.utils.data
class MultiHeadAttention(nn.Module):
def __init__(self, idim, odim, nhead=1, use_bias=True):
super(MultiHeadAttention, self).__init__()
self.idim = i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | CFM-MSG/SDN | MultiHeadAttention | false | 204 | [
"MIT"
] | 0 | f309602dc2bb73117355003f3744f8e5450dbccc | https://github.com/CFM-MSG/SDN/tree/f309602dc2bb73117355003f3744f8e5450dbccc |
MSELoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class MSELoss(nn.Module):
def __init__(self) ->None:
super(MSELoss, self).__init__()
self.mse_loss = nn.MSELoss()
def forward(self, input: 'torch.Tensor', target: 'torch.Tensor', w=None
) ->torch.Tensor:
input... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | CarlosPena00/pytorch-unet | MSELoss | false | 205 | [
"MIT"
] | 0 | 8365bace23e4b04b9c5b75cd6720807ea8cac5ab | https://github.com/CarlosPena00/pytorch-unet/tree/8365bace23e4b04b9c5b75cd6720807ea8cac5ab |
MutiLevelEnhance | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.distributed
import torch.optim.lr_scheduler
import torch.utils.data
class MutiLevelEnhance(nn.Module):
def __init__(self, idim, odim, nhead=1, use_bias=True):
super(MutiLevelEnhance, self).__init__()
self.idim = idim
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | CFM-MSG/SDN | MutiLevelEnhance | false | 206 | [
"MIT"
] | 0 | f309602dc2bb73117355003f3744f8e5450dbccc | https://github.com/CFM-MSG/SDN/tree/f309602dc2bb73117355003f3744f8e5450dbccc |
GDL | import torch
import numpy as np
from torch import nn
import torch.jit
import torch.nn.functional
def sum_tensor(inp, axes, keepdim=False):
axes = np.unique(axes).astype(int)
if keepdim:
for ax in axes:
inp = inp.sum(int(ax), keepdim=True)
else:
for ax in sorted(axes, reverse=Tr... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
from torch import nn
import torch.jit
import torch.nn.functional
assert_size_stride = torch._C._dynamo.guards.assert_size... | CamilaGL/nnUNet | GDL | false | 207 | [
"Apache-2.0"
] | 0 | 471ab73a6e4f67fc72d476183b5344be4cccf7ca | https://github.com/CamilaGL/nnUNet/tree/471ab73a6e4f67fc72d476183b5344be4cccf7ca |
Dice | import torch
import torch.nn as nn
import torch.nn.functional as F
class DiceLoss(nn.Module):
def __init__(self, dims=(1, 2, 3)) ->None:
super(DiceLoss, self).__init__()
self.eps: 'float' = 1e-06
self.dims = dims
def forward(self, input: 'torch.Tensor', target: 'torch.Tensor',
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | CarlosPena00/pytorch-unet | Dice | false | 208 | [
"MIT"
] | 0 | 8365bace23e4b04b9c5b75cd6720807ea8cac5ab | https://github.com/CarlosPena00/pytorch-unet/tree/8365bace23e4b04b9c5b75cd6720807ea8cac5ab |
SDNE_layer | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
class SDNE_layer(nn.Module):
def __init__(self, num_node, hidden_size1, hidden_size2, droput, alpha,
beta, nu1, nu2):
super(SDNE_layer, self).__init__()
self.num_node = num_node
self.hidden_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.... | BruceW91/cogdl | SDNE_layer | false | 209 | [
"MIT"
] | 0 | 1ad524375f5ba062103698a0432fc857572a6933 | https://github.com/BruceW91/cogdl/tree/1ad524375f5ba062103698a0432fc857572a6933 |
WeightedMCEloss | import torch
import torch.nn as nn
import torch.nn.functional as F
def centercrop(image, w, h):
_nt, _ct, ht, wt = image.size()
padw, padh = (wt - w) // 2, (ht - h) // 2
if padw > 0 and padh > 0:
image = image[:, :, padh:-padh, padw:-padw]
return image
class WeightedMCEloss(nn.Module):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | CarlosPena00/pytorch-unet | WeightedMCEloss | false | 210 | [
"MIT"
] | 0 | 8365bace23e4b04b9c5b75cd6720807ea8cac5ab | https://github.com/CarlosPena00/pytorch-unet/tree/8365bace23e4b04b9c5b75cd6720807ea8cac5ab |
SkipConnection | import torch
import torch.nn as nn
import torch.utils.checkpoint
class SkipConnection(nn.Module):
"""Linearize gradients, to make learning easier."""
def __init__(self, *fn):
super().__init__()
self.fn = nn.Sequential(*fn)
def forward(self, x):
y = self.fn(x)
return y if ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.checkpoint
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = tor... | Antipurity/sensor-network | SkipConnection | false | 211 | [
"MIT"
] | 0 | c5cc67dee408da831c3ab60a03374da3c4789bd2 | https://github.com/Antipurity/sensor-network/tree/c5cc67dee408da831c3ab60a03374da3c4789bd2 |
AvgPoolPad | import torch
import torch.nn.functional
import torch.nn as nn
class AvgPoolPad(nn.Module):
def __init__(self, stride=2, padding=1):
super(AvgPoolPad, self).__init__()
self.pad = nn.ZeroPad2d((1, 0, 1, 0))
self.pool = nn.AvgPool2d(3, stride=stride, padding=padding,
count_includ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn.functional
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch.... | CarlosPena00/pytorchvision | AvgPoolPad | false | 212 | [
"MIT"
] | 0 | 824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2 | https://github.com/CarlosPena00/pytorchvision/tree/824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2 |
conv2 | import torch
import torch.nn as nn
class conv2(nn.Module):
def __init__(self, num_classes=2, in_channels=3, is_deconv=False,
is_batchnorm=False, *args, **kwargs):
super(conv2, self).__init__()
self.is_deconv = is_deconv
self.in_channels = in_channels
self.is_batchnorm = is... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | CarlosPena00/pytorch-unet | conv2 | false | 213 | [
"MIT"
] | 0 | 8365bace23e4b04b9c5b75cd6720807ea8cac5ab | https://github.com/CarlosPena00/pytorch-unet/tree/8365bace23e4b04b9c5b75cd6720807ea8cac5ab |
MultiHeadAttn | import torch
import torch.nn as nn
import torch.nn.functional as F
def seq_dropout(x, p=0, training=False):
"""
x: batch * len * input_size
"""
if training is False or p == 0:
return x
dropout_mask = 1.0 / (1 - p) * torch.bernoulli((1 - p) * (x.new_zeros(x
.size(0), x.size(2)) + 1)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | CallMeSp/My_flowQA | MultiHeadAttn | false | 214 | [
"Apache-2.0"
] | 0 | 87d82551f614b089771b22a1992e2be41a2995b3 | https://github.com/CallMeSp/My_flowQA/tree/87d82551f614b089771b22a1992e2be41a2995b3 |
MCCLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class MCCLoss(nn.Module):
def __init__(self, eps=1e-06):
super(MCCLoss, self).__init__()
self.eps = eps
def forward(self, y_pred, y_true, w=None):
y_pred = F.softmax(y_pred, dim=1)
y_true_mean = torch.mean(y_t... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | CarlosPena00/pytorch-unet | MCCLoss | false | 215 | [
"MIT"
] | 0 | 8365bace23e4b04b9c5b75cd6720807ea8cac5ab | https://github.com/CarlosPena00/pytorch-unet/tree/8365bace23e4b04b9c5b75cd6720807ea8cac5ab |
Coder | import torch
import torch.nn.functional
import torch.nn as nn
def conv3x3(in_, out):
return nn.Conv2d(in_, out, 3, padding=1)
class ConvRelu(nn.Module):
def __init__(self, in_, out):
super().__init__()
self.conv = conv3x3(in_, out)
self.activation = nn.ReLU(inplace=True)
def fo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn.functional
im... | CarlosPena00/pytorchvision | Coder | false | 216 | [
"MIT"
] | 0 | 824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2 | https://github.com/CarlosPena00/pytorchvision/tree/824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2 |
ConvRelu2 | import torch
import torch.nn.functional
import torch.nn as nn
def conv3x3(in_, out):
return nn.Conv2d(in_, out, 3, padding=1)
class ConvRelu(nn.Module):
def __init__(self, in_, out):
super().__init__()
self.conv = conv3x3(in_, out)
self.activation = nn.ReLU(inplace=True)
def fo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn.functional
im... | CarlosPena00/pytorchvision | ConvRelu2 | false | 217 | [
"MIT"
] | 0 | 824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2 | https://github.com/CarlosPena00/pytorchvision/tree/824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2 |
WeightedCrossEntropyLoss | import torch
import torch.nn as nn
class WeightedCrossEntropyLoss(nn.Module):
def __init__(self):
super(WeightedCrossEntropyLoss, self).__init__()
self.bce = nn.CrossEntropyLoss(reduction='none')
def forward(self, y_pred, y_true, weight):
y_true_hot = y_true.argmax(1)
loss = ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | CarlosPena00/pytorch-unet | WeightedCrossEntropyLoss | false | 218 | [
"MIT"
] | 0 | 8365bace23e4b04b9c5b75cd6720807ea8cac5ab | https://github.com/CarlosPena00/pytorch-unet/tree/8365bace23e4b04b9c5b75cd6720807ea8cac5ab |
WeightedBCELoss | import torch
import torch.nn as nn
class WeightedBCELoss(nn.Module):
def __init__(self):
super(WeightedBCELoss, self).__init__()
self.bce = nn.BCEWithLogitsLoss(reduction='none')
def forward(self, y_pred, y_true, weights):
loss_0 = self.bce(y_pred[:, 0], y_true[:, 0])
loss_1 ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | CarlosPena00/pytorch-unet | WeightedBCELoss | false | 219 | [
"MIT"
] | 0 | 8365bace23e4b04b9c5b75cd6720807ea8cac5ab | https://github.com/CarlosPena00/pytorch-unet/tree/8365bace23e4b04b9c5b75cd6720807ea8cac5ab |
MaxPoolPad | import torch
import torch.nn.functional
import torch.nn as nn
class MaxPoolPad(nn.Module):
def __init__(self):
super(MaxPoolPad, self).__init__()
self.pad = nn.ZeroPad2d((1, 0, 1, 0))
self.pool = nn.MaxPool2d(3, stride=2, padding=1)
def forward(self, x):
x = self.pad(x)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn.functional
import torch.nn as nn
assert_size_stride = torch._C._dynamo.gu... | CarlosPena00/pytorchvision | MaxPoolPad | false | 220 | [
"MIT"
] | 0 | 824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2 | https://github.com/CarlosPena00/pytorchvision/tree/824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2 |
SoftDiceLossSquared | import torch
import numpy as np
from torch import nn
import torch.jit
import torch.nn.functional
def sum_tensor(inp, axes, keepdim=False):
axes = np.unique(axes).astype(int)
if keepdim:
for ax in axes:
inp = inp.sum(int(ax), keepdim=True)
else:
for ax in sorted(axes, reverse=Tr... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
from torch import nn
import torch.jit
import torch.nn.functional
assert_size_stride = torch._C._dynamo.guards.assert_size... | CamilaGL/nnUNet | SoftDiceLossSquared | false | 221 | [
"Apache-2.0"
] | 0 | 471ab73a6e4f67fc72d476183b5344be4cccf7ca | https://github.com/CamilaGL/nnUNet/tree/471ab73a6e4f67fc72d476183b5344be4cccf7ca |
ClipGlobalAvgPool | import torch
from torch import nn
from torch.optim.lr_scheduler import *
from torch.optim import *
class FastGlobalAvgPool(nn.Module):
def __init__(self, flatten=False, *args, **kwargs):
super().__init__()
self.flatten = flatten
def forward(self, x):
if self.flatten:
in_s... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
from torch.optim.lr_scheduler import *
from torch.optim import *
ass... | Challyfilio/NAIC2021 | ClipGlobalAvgPool | false | 222 | [
"MIT"
] | 0 | 11b38a920dcc902f9b798dc43ae360062862e6e4 | https://github.com/Challyfilio/NAIC2021/tree/11b38a920dcc902f9b798dc43ae360062862e6e4 |
Shifted_softplus | import torch
import torch.nn as nn
import torch.nn.parallel
class Shifted_softplus(nn.Module):
"""
Performs a Shifter softplus loss, which modifies with a value of log(2)
"""
def __init__(self):
super(Shifted_softplus, self).__init__()
self.act = nn.Softplus()
self.shift = nn.Para... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torch.nn as nn
import torch.nn.parallel
assert_size_str... | Chahalprincy/deepchem | Shifted_softplus | false | 223 | [
"MIT"
] | 0 | 9d1a6a879cc74b065694b3ddb763d52151d57b7a | https://github.com/Chahalprincy/deepchem/tree/9d1a6a879cc74b065694b3ddb763d52151d57b7a |
Custom_dropout | import torch
import torch.nn as nn
import torch.nn.parallel
class Custom_dropout(nn.Module):
"""
An implementation for few , Given a task perform a rowise sum of 2-d
matrix , you get a zero out the contribution of few of rows in the matrix
Given, X a 2-d matrix consisting of row vectors (1-d) x1 , x2 ,..xn.... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C... | Chahalprincy/deepchem | Custom_dropout | false | 224 | [
"MIT"
] | 0 | 9d1a6a879cc74b065694b3ddb763d52151d57b7a | https://github.com/Chahalprincy/deepchem/tree/9d1a6a879cc74b065694b3ddb763d52151d57b7a |
AdaptiveAvgMaxPool | import torch
from torch import nn
from torch.optim.lr_scheduler import *
from torch.optim import *
class GlobalMaxPool(nn.AdaptiveMaxPool2d):
def __init__(self, output_size=1, *args, **kwargs):
super().__init__(output_size)
class FastGlobalAvgPool(nn.Module):
def __init__(self, flatten=False, *arg... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
from torch.optim.lr_scheduler import *
from torch.optim import *
ass... | Challyfilio/NAIC2021 | AdaptiveAvgMaxPool | false | 225 | [
"MIT"
] | 0 | 11b38a920dcc902f9b798dc43ae360062862e6e4 | https://github.com/Challyfilio/NAIC2021/tree/11b38a920dcc902f9b798dc43ae360062862e6e4 |
MSEDICELoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class DiceLoss(nn.Module):
def __init__(self, dims=(1, 2, 3)) ->None:
super(DiceLoss, self).__init__()
self.eps: 'float' = 1e-06
self.dims = dims
def forward(self, input: 'torch.Tensor', target: 'torch.Tensor',
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | CarlosPena00/pytorch-unet | MSEDICELoss | false | 226 | [
"MIT"
] | 0 | 8365bace23e4b04b9c5b75cd6720807ea8cac5ab | https://github.com/CarlosPena00/pytorch-unet/tree/8365bace23e4b04b9c5b75cd6720807ea8cac5ab |
AnyHead | import torch
from torch import nn
from torch.optim.lr_scheduler import *
from torch.optim import *
class AnyHead(nn.Module):
"""AnyNet head."""
def __init__(self, w_in, nc):
super(AnyHead, self).__init__()
self.avg_pool = nn.AdaptiveAvgPool2d((1, 1))
self.fc = nn.Linear(w_in, nc, bias... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
from torch.optim.lr_scheduler import *
from torch.optim imp... | Challyfilio/NAIC2021 | AnyHead | false | 227 | [
"MIT"
] | 0 | 11b38a920dcc902f9b798dc43ae360062862e6e4 | https://github.com/Challyfilio/NAIC2021/tree/11b38a920dcc902f9b798dc43ae360062862e6e4 |
ScaleNorm | import math
import torch
import torch.nn as nn
import torch.nn.parallel
class ScaleNorm(nn.Module):
"""Apply Scale Normalization to input.
The ScaleNorm layer first computes the square root of the scale, then computes the matrix/vector norm of the input tensor.
The norm value is calculated as `sqrt(scale) / ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import math
import torch.nn ... | Chahalprincy/deepchem | ScaleNorm | false | 228 | [
"MIT"
] | 0 | 9d1a6a879cc74b065694b3ddb763d52151d57b7a | https://github.com/Chahalprincy/deepchem/tree/9d1a6a879cc74b065694b3ddb763d52151d57b7a |
_Residual_Block_SR | import torch
import torch.nn.functional
import torch.nn as nn
class _Residual_Block_SR(nn.Module):
def __init__(self, num_ft):
super(_Residual_Block_SR, self).__init__()
self.conv1 = nn.Conv2d(in_channels=num_ft, out_channels=num_ft,
kernel_size=3, stride=1, padding=1, bias=True)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn.functional
import torch.nn as nn
assert_size_stride = torch._C._... | CarlosPena00/pytorchvision | _Residual_Block_SR | false | 229 | [
"MIT"
] | 0 | 824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2 | https://github.com/CarlosPena00/pytorchvision/tree/824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2 |
_Residual_Block_DB | import torch
import torch.nn.functional
import torch.nn as nn
class _Residual_Block_DB(nn.Module):
def __init__(self, num_ft):
super(_Residual_Block_DB, self).__init__()
self.conv1 = nn.Conv2d(in_channels=num_ft, out_channels=num_ft,
kernel_size=3, stride=1, padding=1, bias=True)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn.functional
im... | CarlosPena00/pytorchvision | _Residual_Block_DB | false | 230 | [
"MIT"
] | 0 | 824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2 | https://github.com/CarlosPena00/pytorchvision/tree/824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2 |
GELU | import math
import torch
from torch import nn
from torch.optim.lr_scheduler import *
from torch.optim import *
class GELU(nn.Module):
"""
Paper Section 3.4, last paragraph notice that BERT used the GELU instead of RELU
"""
def forward(self, x):
return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / m... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
from torch.optim.lr_scheduler import *
from torch.optim im... | Challyfilio/NAIC2021 | GELU | false | 231 | [
"MIT"
] | 0 | 11b38a920dcc902f9b798dc43ae360062862e6e4 | https://github.com/Challyfilio/NAIC2021/tree/11b38a920dcc902f9b798dc43ae360062862e6e4 |
GeneralizedMeanPooling | import torch
from torch import nn
import torch.nn.functional as F
from torch.optim.lr_scheduler import *
from torch.optim import *
class GeneralizedMeanPooling(nn.Module):
"""Applies a 2D power-average adaptive pooling over an input signal composed of several input planes.
The function computed is: :math:`f(X... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
from to... | Challyfilio/NAIC2021 | GeneralizedMeanPooling | false | 232 | [
"MIT"
] | 0 | 11b38a920dcc902f9b798dc43ae360062862e6e4 | https://github.com/Challyfilio/NAIC2021/tree/11b38a920dcc902f9b798dc43ae360062862e6e4 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
import torch.autograd
class Net(nn.Module):
def __init__(self, STATE_NUM, ACTION_NUM):
super(Net, self).__init__()
self.fc1 = nn.Linear(in_features=STATE_NUM, out_features=128)
self.fc2 = nn.Linear(in_fe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | ChangQingAAS/Deep-Reinforcement-Learning | Net | false | 233 | [
"MIT"
] | 0 | 3bc1381c632b1730a48e63e972aea62086c4287c | https://github.com/ChangQingAAS/Deep-Reinforcement-Learning/tree/3bc1381c632b1730a48e63e972aea62086c4287c |
Critic | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
import torch.autograd
class Critic(nn.Module):
def __init__(self, input_size):
super(Critic, self).__init__()
self.fc1 = nn.Linear(input_size, 128)
self.fc2 = nn.Linear(128, 256)
self.fc3 = nn.Li... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | ChangQingAAS/Deep-Reinforcement-Learning | Critic | false | 234 | [
"MIT"
] | 0 | 3bc1381c632b1730a48e63e972aea62086c4287c | https://github.com/ChangQingAAS/Deep-Reinforcement-Learning/tree/3bc1381c632b1730a48e63e972aea62086c4287c |
TLU | import torch
from torch import nn
from torch.nn.parameter import Parameter
from torch.optim.lr_scheduler import *
from torch.optim import *
class TLU(nn.Module):
def __init__(self, num_features):
"""max(y, tau) = max(y - tau, 0) + tau = ReLU(y - tau) + tau"""
super(TLU, self).__init__()
s... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
from torch.nn.parameter import Parameter
from torch.optim.lr_schedul... | Challyfilio/NAIC2021 | TLU | false | 235 | [
"MIT"
] | 0 | 11b38a920dcc902f9b798dc43ae360062862e6e4 | https://github.com/Challyfilio/NAIC2021/tree/11b38a920dcc902f9b798dc43ae360062862e6e4 |
MDiceLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class DiceLoss(nn.Module):
def __init__(self, dims=(1, 2, 3)) ->None:
super(DiceLoss, self).__init__()
self.eps: 'float' = 1e-06
self.dims = dims
def forward(self, input: 'torch.Tensor', target: 'torch.Tensor',
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | CarlosPena00/pytorch-unet | MDiceLoss | false | 236 | [
"MIT"
] | 0 | 8365bace23e4b04b9c5b75cd6720807ea8cac5ab | https://github.com/CarlosPena00/pytorch-unet/tree/8365bace23e4b04b9c5b75cd6720807ea8cac5ab |
MuNet | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
import torch.autograd
class MuNet(nn.Module):
def __init__(self, in_dim, out_dim):
super(MuNet, self).__init__()
self.fc1 = nn.Linear(in_dim, 128)
self.fc2 = nn.Linear(128, 64)
self.fc_mu = nn.Li... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | ChangQingAAS/Deep-Reinforcement-Learning | MuNet | false | 237 | [
"MIT"
] | 0 | 3bc1381c632b1730a48e63e972aea62086c4287c | https://github.com/ChangQingAAS/Deep-Reinforcement-Learning/tree/3bc1381c632b1730a48e63e972aea62086c4287c |
Atom_Wise_Convolution | import torch
import torch.nn as nn
import torch.nn.parallel
class Shifted_softplus(nn.Module):
"""
Performs a Shifter softplus loss, which modifies with a value of log(2)
"""
def __init__(self):
super(Shifted_softplus, self).__init__()
self.act = nn.Softplus()
self.shift = nn.Para... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
im... | Chahalprincy/deepchem | Atom_Wise_Convolution | false | 238 | [
"MIT"
] | 0 | 9d1a6a879cc74b065694b3ddb763d52151d57b7a | https://github.com/Chahalprincy/deepchem/tree/9d1a6a879cc74b065694b3ddb763d52151d57b7a |
rSoftMax | import torch
from torch import nn
import torch.nn.functional as F
from torch.optim.lr_scheduler import *
from torch.optim import *
class rSoftMax(nn.Module):
def __init__(self, radix, cardinality):
super().__init__()
self.radix = radix
self.cardinality = cardinality
def forward(self,... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
f... | Challyfilio/NAIC2021 | rSoftMax | false | 239 | [
"MIT"
] | 0 | 11b38a920dcc902f9b798dc43ae360062862e6e4 | https://github.com/Challyfilio/NAIC2021/tree/11b38a920dcc902f9b798dc43ae360062862e6e4 |
Hardswish | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class Hardswish(nn.Module):
@staticmethod
def forward(x):
return x * F.hardtanh(x + 3, 0.0, 6.0) / 6.0
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guard... | ChaokunChang/SVAS | Hardswish | false | 240 | [
"Apache-2.0"
] | 0 | 61af6eb39269edff8ea5147311628b3200c3a3d2 | https://github.com/ChaokunChang/SVAS/tree/61af6eb39269edff8ea5147311628b3200c3a3d2 |
SelfAttention | import torch
import torch.nn as nn
import torch.utils.checkpoint
class SelfAttention(nn.Module):
def __init__(self, *args, **kwargs):
super().__init__()
self.fn = nn.MultiheadAttention(*args, **kwargs)
def forward(self, x):
x = torch.unsqueeze(x, -2)
y, _ = self.fn(x, x, x, n... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Antipurity/sensor-network | SelfAttention | false | 241 | [
"MIT"
] | 0 | c5cc67dee408da831c3ab60a03374da3c4789bd2 | https://github.com/Antipurity/sensor-network/tree/c5cc67dee408da831c3ab60a03374da3c4789bd2 |
Contract | import torch
import torch.nn as nn
import torch.utils.data
class Contract(nn.Module):
def __init__(self, gain=2):
super().__init__()
self.gain = gain
def forward(self, x):
N, C, H, W = x.size()
s = self.gain
x = x.view(N, C, H // s, s, W // s, s)
x = x.permute... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | ChaokunChang/SVAS | Contract | false | 242 | [
"Apache-2.0"
] | 0 | 61af6eb39269edff8ea5147311628b3200c3a3d2 | https://github.com/ChaokunChang/SVAS/tree/61af6eb39269edff8ea5147311628b3200c3a3d2 |
GroverAttention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import *
class GroverAttention(nn.Module):
"""
Compute 'Scaled Dot Product SelfAttention
"""
def forward(self, query, key, value, mask=None, dropout=None):
"""
:param query:
:param key:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Changgun-Choi/huggingmolecules | GroverAttention | false | 243 | [
"Apache-2.0"
] | 0 | 6d7c5e7d0acfd3d4725eb0deaeb0413dad9cfde8 | https://github.com/Changgun-Choi/huggingmolecules/tree/6d7c5e7d0acfd3d4725eb0deaeb0413dad9cfde8 |
RSoftmax | import torch
import torch.nn.functional as F
import torch.nn as nn
class RSoftmax(nn.Module):
"""Radix Softmax module in ``SplitAttentionConv2d``.
Args:
radix (int): Radix of input.
groups (int): Groups of input.
"""
def __init__(self, radix, groups):
super().__init__()
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | ChengBo5/mask-text-detector | RSoftmax | false | 244 | [
"Apache-2.0"
] | 0 | ce93e45ed1d982ec0ef6ad977c02e49326bf255a | https://github.com/ChengBo5/mask-text-detector/tree/ce93e45ed1d982ec0ef6ad977c02e49326bf255a |
AttentionNet | import torch
import torch.nn.functional
import torch.nn as nn
from torch.nn import functional as F
def conv3x3(in_, out):
return nn.Conv2d(in_, out, 3, padding=1)
class ConvRelu(nn.Module):
def __init__(self, in_, out):
super().__init__()
self.conv = conv3x3(in_, out)
self.activatio... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn.functional
im... | CarlosPena00/pytorchvision | AttentionNet | false | 245 | [
"MIT"
] | 0 | 824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2 | https://github.com/CarlosPena00/pytorchvision/tree/824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2 |
MyUpsample2 | import torch
import torch.nn as nn
class MyUpsample2(nn.Module):
def forward(self, x):
return x[:, :, :, None, :, None].expand(-1, -1, -1, 2, -1, 2).reshape(x
.size(0), x.size(1), x.size(2) * 2, x.size(3) * 2)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Chenyang-Lu/road-completion | MyUpsample2 | false | 246 | [
"MIT"
] | 0 | 115ca232922d3c48ead324299664a9a71348d2fe | https://github.com/Chenyang-Lu/road-completion/tree/115ca232922d3c48ead324299664a9a71348d2fe |
SqueezeExcitation | import torch
from torch import Tensor
from torch import nn
import torch.nn.functional as F
from torch.optim.lr_scheduler import *
from torch.optim import *
def _make_divisible(v, divisor, min_value=None):
"""
This function is taken from the original tf repo.
It ensures that all layers have a channel numbe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import Tensor
from... | Challyfilio/NAIC2021 | SqueezeExcitation | false | 247 | [
"MIT"
] | 0 | 11b38a920dcc902f9b798dc43ae360062862e6e4 | https://github.com/Challyfilio/NAIC2021/tree/11b38a920dcc902f9b798dc43ae360062862e6e4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.