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 |
|---|---|---|---|---|---|---|---|---|---|---|
CMVN | import torch
import torch.nn as nn
class CMVN(nn.Module):
__constants__ = ['mode', 'dim', 'eps']
def __init__(self, mode='global', dim=2, eps=1e-10):
super(CMVN, self).__init__()
if mode != 'global':
raise NotImplementedError(
'Only support global mean variance nor... | 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.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | chiluen/s3prl | CMVN | false | 1,688 | [
"Apache-2.0"
] | 0 | c81838f6414d3c4767de355144449e40f86c7066 | https://github.com/chiluen/s3prl/tree/c81838f6414d3c4767de355144449e40f86c7066 |
FFB | import torch
import torch.nn as nn
from math import sqrt as sqrt
from itertools import product as product
class FFB(nn.Module):
def __init__(self, c1, c2, size):
super(FFB, self).__init__()
self.conv_y1 = nn.Conv2d(c1, c1, kernel_size=1)
self.act1 = nn.ReLU(inplace=True)
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
from math import sqrt as sqrt
from itertools import produc... | chickenshawama/CFEnet2 | FFB | false | 1,689 | [
"MIT"
] | 0 | f20dda7ad2923bed4af5d63e705b6849a48e73df | https://github.com/chickenshawama/CFEnet2/tree/f20dda7ad2923bed4af5d63e705b6849a48e73df |
PrecomputedNorm | import torch
import torch.nn as nn
class PrecomputedNorm(nn.Module):
"""Normalization using Pre-computed Mean/Std.
Args:
stats: Precomputed (mean, std).
axis: Axis setting used to calculate mean/variance.
"""
def __init__(self, stats, axis=[1, 2]):
super().__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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | chiluen/s3prl | PrecomputedNorm | false | 1,690 | [
"Apache-2.0"
] | 0 | c81838f6414d3c4767de355144449e40f86c7066 | https://github.com/chiluen/s3prl/tree/c81838f6414d3c4767de355144449e40f86c7066 |
AlReLU | import torch
from torch import nn
class AlReLU(nn.Module):
def __init__(self):
super().__init__()
def forward(self, input):
return self.alrelu(input)
def alrelu(self, x):
alpha = 0.01
return torch.maximum(torch.abs(alpha * x), x)
def get_inputs():
return [torch.ran... | 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
a... | chiranthans23/jigsaw-severity-comments | AlReLU | false | 1,691 | [
"MIT"
] | 0 | b92345ff5bf0c2d2fb243b81edd98adc66a2c4ee | https://github.com/chiranthans23/jigsaw-severity-comments/tree/b92345ff5bf0c2d2fb243b81edd98adc66a2c4ee |
ScaledSiLU | import torch
class ScaledSiLU(torch.nn.Module):
def __init__(self):
super().__init__()
self.scale_factor = 1 / 0.6
self._activation = torch.nn.SiLU()
def forward(self, x):
return self._activation(x) * self.scale_factor
def get_inputs():
return [torch.rand([4, 4, 4, 4])]... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | chris-price19/ocp | ScaledSiLU | false | 1,692 | [
"MIT",
"BSD-3-Clause"
] | 0 | 0175c5a11dd3aaccd4f4780c8cb559401f1ca15e | https://github.com/chris-price19/ocp/tree/0175c5a11dd3aaccd4f4780c8cb559401f1ca15e |
SpatialAttentionGate | import torch
import torch.nn as nn
import torch.nn.functional as F
class SpatialAttentionGate(nn.Module):
def __init__(self, channel, reduction=16):
super(SpatialAttentionGate, self).__init__()
self.fc1 = nn.Conv2d(channel, reduction, kernel_size=1, padding=0)
self.fc2 = nn.Conv2d(reducti... | 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_... | chicm/clouds | SpatialAttentionGate | false | 1,693 | [
"MIT"
] | 0 | 66baff6527a55767ba39a531edec6f230d5e58e8 | https://github.com/chicm/clouds/tree/66baff6527a55767ba39a531edec6f230d5e58e8 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self, num_classes=8):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(3, 10, kernel_size=(3, 3))
self.conv2 = nn.Conv2d(10, 20, kernel_size=(3, 3))
nn.init.xavier_uniform_(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._inductor.runtime.... | chapnitsky/DL | Net | false | 1,694 | [
"MIT"
] | 0 | a91e6abd7abc81261ba6797de9a2c6f95b4dcb71 | https://github.com/chapnitsky/DL/tree/a91e6abd7abc81261ba6797de9a2c6f95b4dcb71 |
MultiHeadAttention | import math
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
def attention(q, k, v, d_k, mask=None, dropout=None):
scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(d_k)
if mask is not None:
mask = mask.unsqueeze(1)
scores = scores.masked_fill(mask ... | 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.... | chenjun-110/WZCQ | MultiHeadAttention | false | 1,695 | [
"Apache-2.0"
] | 0 | e2de7743ad671e8632cfa084638555d7f1deb42f | https://github.com/chenjun-110/WZCQ/tree/e2de7743ad671e8632cfa084638555d7f1deb42f |
ExponentialEnvelope | import torch
class ExponentialEnvelope(torch.nn.Module):
"""
Exponential envelope function that ensures a smooth cutoff,
as proposed in Unke, Chmiela, Gastegger, Schütt, Sauceda, Müller 2021.
SpookyNet: Learning Force Fields with Electronic Degrees of Freedom
and Nonlocal Effects
"""
def ... | 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 math as tl_math
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_str... | chris-price19/ocp | ExponentialEnvelope | false | 1,696 | [
"MIT",
"BSD-3-Clause"
] | 0 | 0175c5a11dd3aaccd4f4780c8cb559401f1ca15e | https://github.com/chris-price19/ocp/tree/0175c5a11dd3aaccd4f4780c8cb559401f1ca15e |
PolynomialEnvelope | import torch
class PolynomialEnvelope(torch.nn.Module):
"""
Polynomial envelope function that ensures a smooth cutoff.
Parameters
----------
exponent: int
Exponent of the envelope function.
"""
def __init__(self, exponent):
super().__init__()
assert expone... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | chris-price19/ocp | PolynomialEnvelope | false | 1,697 | [
"MIT",
"BSD-3-Clause"
] | 0 | 0175c5a11dd3aaccd4f4780c8cb559401f1ca15e | https://github.com/chris-price19/ocp/tree/0175c5a11dd3aaccd4f4780c8cb559401f1ca15e |
SelfAttentionPooling | import torch
import torch.nn as nn
class SelfAttentionPooling(nn.Module):
"""
Implementation of SelfAttentionPooling
Original Paper: Self-Attention Encoding and Pooling for Speaker Recognition
https://arxiv.org/pdf/2008.01077v1.pdf
"""
def __init__(self, input_dim):
super(SelfAttentio... | 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.... | chiluen/s3prl | SelfAttentionPooling | false | 1,698 | [
"Apache-2.0"
] | 0 | c81838f6414d3c4767de355144449e40f86c7066 | https://github.com/chiluen/s3prl/tree/c81838f6414d3c4767de355144449e40f86c7066 |
Sine | import torch
import torch.nn as nn
class Sine(nn.Module):
def __init__(self, w0: 'float'=30.0):
super(Sine, self).__init__()
self.w0 = w0
def forward(self, x: 'torch.Tensor') ->torch.Tensor:
return torch.sin(self.w0 * x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def... | 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 math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | chris-price19/ocp | Sine | false | 1,699 | [
"MIT",
"BSD-3-Clause"
] | 0 | 0175c5a11dd3aaccd4f4780c8cb559401f1ca15e | https://github.com/chris-price19/ocp/tree/0175c5a11dd3aaccd4f4780c8cb559401f1ca15e |
SiQU | import torch
class SiQU(torch.nn.Module):
def __init__(self):
super().__init__()
self._activation = torch.nn.SiLU()
def forward(self, x):
return x * self._activation(x)
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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | chris-price19/ocp | SiQU | false | 1,700 | [
"MIT",
"BSD-3-Clause"
] | 0 | 0175c5a11dd3aaccd4f4780c8cb559401f1ca15e | https://github.com/chris-price19/ocp/tree/0175c5a11dd3aaccd4f4780c8cb559401f1ca15e |
SphericalBesselBasis | import math
import torch
import numpy as np
class SphericalBesselBasis(torch.nn.Module):
"""
1D spherical Bessel basis
Parameters
----------
num_radial: int
Controls maximum frequency.
cutoff: float
Cutoff distance in Angstrom.
"""
def __init__(self, num_radial: 'int'... | 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 math as tl_math
import math
import numpy as np
assert_size_stride = torch._C._dynamo.guar... | chris-price19/ocp | SphericalBesselBasis | false | 1,701 | [
"MIT",
"BSD-3-Clause"
] | 0 | 0175c5a11dd3aaccd4f4780c8cb559401f1ca15e | https://github.com/chris-price19/ocp/tree/0175c5a11dd3aaccd4f4780c8cb559401f1ca15e |
LeNet300 | import torch
from typing import *
import torch.nn as nn
import torch.nn.functional as F
class LeNet300(nn.Module):
def __init__(self, num_classes=10):
super(LeNet300, self).__init__()
self.fc1 = nn.Linear(784, 300)
self.fc2 = nn.Linear(300, 100)
self.fc3 = nn.Linear(100, 10)
... | 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 typing import *
import t... | chomd90/snip | LeNet300 | false | 1,702 | [
"MIT"
] | 0 | 04aa8ca76364c61c3f6013832827fa292402652b | https://github.com/chomd90/snip/tree/04aa8ca76364c61c3f6013832827fa292402652b |
GaussianSmearing | import torch
import torch.nn as nn
class GaussianSmearing(nn.Module):
def __init__(self, in_features, start=0, end=1, num_freqs=50):
super(GaussianSmearing, self).__init__()
self.num_freqs = num_freqs
offset = torch.linspace(start, end, num_freqs)
self.coeff = -0.5 / (offset[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.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | chris-price19/ocp | GaussianSmearing | false | 1,703 | [
"MIT",
"BSD-3-Clause"
] | 0 | 0175c5a11dd3aaccd4f4780c8cb559401f1ca15e | https://github.com/chris-price19/ocp/tree/0175c5a11dd3aaccd4f4780c8cb559401f1ca15e |
PixelWiseModel | import torch
from torch import nn as nn
class PixelWiseModel(nn.Module):
"""
Baseline class for pixelwise models
Args:
"""
def __init__(self, const, **kwargs):
super(PixelWiseModel, self).__init__()
self.const = const
def forward(self, x):
ret = torch.zeros_like(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 import nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._emp... | ciubecca/3dunet-cavity | PixelWiseModel | false | 1,704 | [
"MIT"
] | 0 | cfcc827773b18a95d221ab86c1afc5e2f7c30ecb | https://github.com/ciubecca/3dunet-cavity/tree/cfcc827773b18a95d221ab86c1afc5e2f7c30ecb |
SubPixelConvolutionalBlock | import torch
from torch import nn
class SubPixelConvolutionalBlock(nn.Module):
"""
A subpixel convolutional block, comprising convolutional, pixel-shuffle, and PReLU activation layers.
"""
def __init__(self, kernel_size=3, n_channels=64, scaling_factor=3):
"""
:param kernel_size: kern... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | chilung/NCTU_Adv_DNN_HW4 | SubPixelConvolutionalBlock | false | 1,705 | [
"MIT"
] | 0 | 967f228c6e80cbc703a89ee611b90ef5e037da40 | https://github.com/chilung/NCTU_Adv_DNN_HW4/tree/967f228c6e80cbc703a89ee611b90ef5e037da40 |
LeNet_300_100 | import torch
from typing import *
import torch.nn as nn
import torch.nn.functional as F
class LeNet_300_100(nn.Module):
def __init__(self):
super().__init__()
self.fc1 = nn.Linear(784, 300)
self.fc2 = nn.Linear(300, 100)
self.fc3 = nn.Linear(100, 10)
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
from torch._inductor.runtime.... | chomd90/snip | LeNet_300_100 | false | 1,706 | [
"MIT"
] | 0 | 04aa8ca76364c61c3f6013832827fa292402652b | https://github.com/chomd90/snip/tree/04aa8ca76364c61c3f6013832827fa292402652b |
Conv2d | import torch
import torch.nn as nn
from torch.nn import functional as F
class Conv2d(nn.Conv2d):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, dilation=1, groups=1, bias=True):
super(Conv2d, self).__init__(in_channels, out_channels, kernel_size,
strid... | 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 ... | chris-rgr/image-background-remove-tool | Conv2d | false | 1,707 | [
"Apache-2.0"
] | 0 | b57b44099e0e35c90833bed010b071aa39efdc80 | https://github.com/chris-rgr/image-background-remove-tool/tree/b57b44099e0e35c90833bed010b071aa39efdc80 |
AvgPoolPadding | import torch
import torch.nn as nn
import torch.nn.functional as F
class AvgPoolPadding(nn.Module):
def __init__(self, num_filters, channels_in, stride):
super(AvgPoolPadding, self).__init__()
self.identity = nn.AvgPool2d(stride, stride=stride)
self.num_zeros = num_filters - channels_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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | citelab/fastsync | AvgPoolPadding | false | 1,708 | [
"Apache-2.0"
] | 0 | 8e2166f87fc53479b57fef536a971c3a2e6e4309 | https://github.com/citelab/fastsync/tree/8e2166f87fc53479b57fef536a971c3a2e6e4309 |
QNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class QNetwork(nn.Module):
def __init__(self, num_inputs, num_actions, hidden_size, init_w=0.003):
super(QNetwork, self).__init__()
self.linear1 = nn.Linear(num_inputs + num_actions, hidden_size)
self.linear2 = nn.Linear(h... | 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_... | chagri/SOTA-RL-Algorithms | QNetwork | false | 1,709 | [
"Apache-2.0"
] | 0 | 58b416e7c706d8426dc402482e72ca7283568e71 | https://github.com/chagri/SOTA-RL-Algorithms/tree/58b416e7c706d8426dc402482e72ca7283568e71 |
IdentityPadding | import torch
import torch.nn as nn
import torch.nn.functional as F
class IdentityPadding(nn.Module):
def __init__(self, num_filters, channels_in, stride):
super(IdentityPadding, self).__init__()
self.identity = nn.MaxPool2d(1, stride=stride)
self.num_zeros = num_filters - channels_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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | citelab/fastsync | IdentityPadding | false | 1,710 | [
"Apache-2.0"
] | 0 | 8e2166f87fc53479b57fef536a971c3a2e6e4309 | https://github.com/citelab/fastsync/tree/8e2166f87fc53479b57fef536a971c3a2e6e4309 |
WeightedSmoothL1Loss | import torch
from torch import nn as nn
class WeightedSmoothL1Loss(nn.SmoothL1Loss):
def __init__(self, threshold, initial_weight, apply_below_threshold=True):
super().__init__(reduction='none')
self.threshold = threshold
self.apply_below_threshold = apply_below_threshold
self.wei... | 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 math as tl_math
from torch import nn as nn
assert_size_stride = torch._C._dynamo.guards.a... | ciubecca/3dunet-cavity | WeightedSmoothL1Loss | false | 1,711 | [
"MIT"
] | 0 | cfcc827773b18a95d221ab86c1afc5e2f7c30ecb | https://github.com/ciubecca/3dunet-cavity/tree/cfcc827773b18a95d221ab86c1afc5e2f7c30ecb |
CNN | import torch
import torch.nn as nn
import torch.nn.functional as F
class CNN(nn.Module):
def __init__(self):
super(CNN, self).__init__()
self.conv1 = nn.Conv2d(3, 10, kernel_size=5)
self.conv2 = nn.Conv2d(10, 20, kernel_size=5)
self.conv2_drop = nn.Dropout2d()
self.fc1 = 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.... | chihina/Classification_dogs_and_cats | CNN | false | 1,712 | [
"MIT"
] | 0 | 8797ff688592c148a1c13881394716e117db95a3 | https://github.com/chihina/Classification_dogs_and_cats/tree/8797ff688592c148a1c13881394716e117db95a3 |
GCNModelVAE | from torch.nn import Module
import torch
import torch.nn.functional as F
from torch.nn.modules.module import Module
from torch.nn.parameter import Parameter
import torch.nn as nn
import torch.nn.modules.loss
class GraphConvolution(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
... | 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.... | chundiliu/random_rewrite | GCNModelVAE | false | 1,713 | [
"MIT"
] | 0 | fd106642da82b0ad42b8b0fa405147b321d67cbb | https://github.com/chundiliu/random_rewrite/tree/fd106642da82b0ad42b8b0fa405147b321d67cbb |
MaxMin | import torch
import torch.multiprocessing
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class MaxMin(nn.Module):
def __init__(self):
super(MaxMin, self).__init__()
def forward(self, x):
y = torch.reshape(x, (x.sh... | 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.multiprocessing
import torch.nn as nn
import torch.nn.parallel
import torch.... | ckodser/a_robust_subnetwork_hiddes | MaxMin | false | 1,714 | [
"Apache-2.0"
] | 0 | 171b43dc7b4446ba722a4c51c52bf561f77e5c55 | https://github.com/ckodser/a_robust_subnetwork_hiddes/tree/171b43dc7b4446ba722a4c51c52bf561f77e5c55 |
GCNModelAE | from torch.nn import Module
import torch
import torch.nn.functional as F
from torch.nn.modules.module import Module
from torch.nn.parameter import Parameter
import torch.nn as nn
import torch.nn.modules.loss
class GraphConvolution(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
... | 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.... | chundiliu/random_rewrite | GCNModelAE | false | 1,715 | [
"MIT"
] | 0 | fd106642da82b0ad42b8b0fa405147b321d67cbb | https://github.com/chundiliu/random_rewrite/tree/fd106642da82b0ad42b8b0fa405147b321d67cbb |
ExtResNetBlock | import torch
from torch import nn as nn
def conv3d(in_channels, out_channels, kernel_size, bias, padding):
return nn.Conv3d(in_channels, out_channels, kernel_size, padding=
padding, bias=bias)
def create_conv(in_channels, out_channels, kernel_size, order, num_groups,
padding):
"""
Create a l... | 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 import n... | ciubecca/3dunet-cavity | ExtResNetBlock | false | 1,716 | [
"MIT"
] | 0 | cfcc827773b18a95d221ab86c1afc5e2f7c30ecb | https://github.com/ciubecca/3dunet-cavity/tree/cfcc827773b18a95d221ab86c1afc5e2f7c30ecb |
BCEDiceLoss | import torch
from torch import nn as nn
def flatten(tensor):
"""Flattens a given tensor such that the channel axis is first.
The shapes are transformed as follows:
(N, C, D, H, W) -> (C, N * D * H * W)
"""
C = tensor.size(1)
axis_order = (1, 0) + tuple(range(2, tensor.dim()))
transposed... | 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
from torch ... | ciubecca/3dunet-cavity | BCEDiceLoss | false | 1,717 | [
"MIT"
] | 0 | cfcc827773b18a95d221ab86c1afc5e2f7c30ecb | https://github.com/ciubecca/3dunet-cavity/tree/cfcc827773b18a95d221ab86c1afc5e2f7c30ecb |
LogisticRegression | import torch
from torch import nn as nn
class LogisticRegression(torch.nn.Module):
def __init__(self, **kwargs):
super(LogisticRegression, self).__init__()
self.linear = nn.Linear(1, 1)
def forward(self, x):
xin = x.flatten()[:, None]
output = torch.sigmoid(self.linear(xin))
... | 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 as nn
assert_size_stride = torch._C._dynamo.guards.assert_s... | ciubecca/3dunet-cavity | LogisticRegression | false | 1,718 | [
"MIT"
] | 0 | cfcc827773b18a95d221ab86c1afc5e2f7c30ecb | https://github.com/ciubecca/3dunet-cavity/tree/cfcc827773b18a95d221ab86c1afc5e2f7c30ecb |
SkipLastTargetChannelWrapper | import torch
from torch import nn as nn
from torch.nn import MSELoss
class SkipLastTargetChannelWrapper(nn.Module):
"""
Loss wrapper which removes additional target channel
"""
def __init__(self, loss, squeeze_channel=False):
super(SkipLastTargetChannelWrapper, self).__init__()
self.l... | 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 as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._emp... | ciubecca/3dunet-cavity | SkipLastTargetChannelWrapper | false | 1,719 | [
"MIT"
] | 0 | cfcc827773b18a95d221ab86c1afc5e2f7c30ecb | https://github.com/ciubecca/3dunet-cavity/tree/cfcc827773b18a95d221ab86c1afc5e2f7c30ecb |
GroupWiseLinear | import math
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class GroupWiseLinear(nn.Module):
def __init__(self, num_class, hidden_dim, bias=True):
super().__init__()
self.num_class = num_class
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 math
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
as... | ckvic3/query2labels | GroupWiseLinear | false | 1,720 | [
"MIT"
] | 0 | e9c30e1b445be773be397a093fa66aef71d54556 | https://github.com/ckvic3/query2labels/tree/e9c30e1b445be773be397a093fa66aef71d54556 |
ConvNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class ConvNet(nn.Module):
"""Small ConvNet for CONIC."""
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(6, 16, 5)
self.fc1 =... | 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.... | citelab/fastsync | ConvNet | false | 1,721 | [
"Apache-2.0"
] | 0 | 8e2166f87fc53479b57fef536a971c3a2e6e4309 | https://github.com/citelab/fastsync/tree/8e2166f87fc53479b57fef536a971c3a2e6e4309 |
BCEDiceProbLoss | import torch
from torch import nn as nn
def flatten(tensor):
"""Flattens a given tensor such that the channel axis is first.
The shapes are transformed as follows:
(N, C, D, H, W) -> (C, N * D * H * W)
"""
C = tensor.size(1)
axis_order = (1, 0) + tuple(range(2, tensor.dim()))
transposed... | 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
from torch ... | ciubecca/3dunet-cavity | BCEDiceProbLoss | false | 1,722 | [
"MIT"
] | 0 | cfcc827773b18a95d221ab86c1afc5e2f7c30ecb | https://github.com/ciubecca/3dunet-cavity/tree/cfcc827773b18a95d221ab86c1afc5e2f7c30ecb |
AsymmetricLoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class AsymmetricLoss(nn.Module):
def __init__(self, gamma_neg=4, gamma_pos=1, clip=0.05, eps=1e-08,
disable_torch_grad_focal_loss=False):
super(AsymmetricLoss... | 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... | ckvic3/query2labels | AsymmetricLoss | false | 1,723 | [
"MIT"
] | 0 | e9c30e1b445be773be397a093fa66aef71d54556 | https://github.com/ckvic3/query2labels/tree/e9c30e1b445be773be397a093fa66aef71d54556 |
RMSPool | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.utils.data
class RMSPool(nn.Module):
def __init__(self, kernel_size, stride):
super(RMSPool, self).__init__()
self.kernel_size = kernel_size
self.stride = stride
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.triton_helpers import libdevice
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
assert_s... | cleverhans-lab/model-extraction-iclr | RMSPool | false | 1,724 | [
"MIT"
] | 0 | 805205287876423621baca9d5e990edfe68ea803 | https://github.com/cleverhans-lab/model-extraction-iclr/tree/805205287876423621baca9d5e990edfe68ea803 |
eca_channel | import torch
import torch.nn as nn
import torch.utils
class eca_channel(nn.Module):
def __init__(self, channel, k_size=3):
super(eca_channel, self).__init__()
self.avg_pool = nn.AdaptiveAvgPool2d(1)
self.conv = nn.Conv1d(1, 1, kernel_size=k_size, padding=(k_size - 1
) // 2, 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
import torch.nn as nn
import torch.utils
assert_size_stride = torch._C._dynamo.g... | closest-git/QuantumFold | eca_channel | false | 1,725 | [
"Apache-2.0"
] | 0 | 2dc6afa96cdee91b58f66543b440a2d7a8d32a8a | https://github.com/closest-git/QuantumFold/tree/2dc6afa96cdee91b58f66543b440a2d7a8d32a8a |
LinearActivation | from torch.nn import Module
import torch
import torch.nn as nn
class LinearActivation(Module):
def __init__(self, in_features, out_features, act='gelu', bias=True):
super(LinearActivation, self).__init__()
self.Linear = nn.Linear(in_features, out_features, bias=bias)
if act == '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
from torch._inductor.runtime.triton_helpers import libdevice
from torch.nn impor... | codecaution/Hetu | LinearActivation | false | 1,726 | [
"Apache-2.0"
] | 0 | e278732c2fe3554c8d576585f5bcbf79ade31b68 | https://github.com/codecaution/Hetu/tree/e278732c2fe3554c8d576585f5bcbf79ade31b68 |
BertLayerNorm | from torch.nn import Module
import torch
import torch.nn as nn
class BertLayerNorm(Module):
def __init__(self, hidden_size, eps=1e-12):
super(BertLayerNorm, self).__init__()
self.shape = torch.Size((hidden_size,))
self.eps = eps
self.weight = nn.Parameter(torch.ones(hidden_size))
... | 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.nn import Module
import torch.nn as nn
assert_size_stride = torch._C... | codecaution/Hetu | BertLayerNorm | false | 1,727 | [
"Apache-2.0"
] | 0 | e278732c2fe3554c8d576585f5bcbf79ade31b68 | https://github.com/codecaution/Hetu/tree/e278732c2fe3554c8d576585f5bcbf79ade31b68 |
AsymmetricLossOptimized | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class AsymmetricLossOptimized(nn.Module):
""" Notice - optimized version, minimizes memory allocation and gpu uploading,
favors inplace operations"""
def __init__(sel... | 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... | ckvic3/query2labels | AsymmetricLossOptimized | false | 1,728 | [
"MIT"
] | 0 | e9c30e1b445be773be397a093fa66aef71d54556 | https://github.com/ckvic3/query2labels/tree/e9c30e1b445be773be397a093fa66aef71d54556 |
BertSelfOutput | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class BertSelfOutput(nn.Module):
def __init__(self, config):
super(BertSelfOutput, self).__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.layer_norm = nn.LayerNorm(config.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 libdevice
import torch.nn as ... | cjinchao/mner | BertSelfOutput | false | 1,729 | [
"MIT"
] | 0 | 12776280da314eb7ef22511aa18ca9af0764fb32 | https://github.com/cjinchao/mner/tree/12776280da314eb7ef22511aa18ca9af0764fb32 |
Qnet | import random
import torch
import torch.nn as nn
import torch.nn.functional as F
class Qnet(nn.Module):
def __init__(self):
super(Qnet, self).__init__()
self.fc1 = nn.Linear(4, 128)
self.fc2 = nn.Linear(128, 128)
self.fc3 = nn.Linear(128, 2)
def forward(self, x):
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 random
import torch.nn... | co24428/minimalRL | Qnet | false | 1,730 | [
"MIT"
] | 0 | c758e733438fce1d8421551e75f2117ec3f82028 | https://github.com/co24428/minimalRL/tree/c758e733438fce1d8421551e75f2117ec3f82028 |
BertOutput | from _paritybench_helpers import _mock_config
from torch.nn import Module
import torch
import torch.nn as nn
class BertLayerNorm(Module):
def __init__(self, hidden_size, eps=1e-12):
super(BertLayerNorm, self).__init__()
self.shape = torch.Size((hidden_size,))
self.eps = eps
self.w... | 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... | codecaution/Hetu | BertOutput | false | 1,731 | [
"Apache-2.0"
] | 0 | e278732c2fe3554c8d576585f5bcbf79ade31b68 | https://github.com/codecaution/Hetu/tree/e278732c2fe3554c8d576585f5bcbf79ade31b68 |
Triangle | import torch
import torch.nn as nn
class Triangle(nn.Module):
def forward(self, x):
return x.abs()
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.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | continual-ml/mpcl | Triangle | false | 1,732 | [
"Apache-2.0"
] | 0 | 3b7112882ee832212494072e2f5ea7779e3b8aa6 | https://github.com/continual-ml/mpcl/tree/3b7112882ee832212494072e2f5ea7779e3b8aa6 |
RightSVDLayer | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
class RightSVDLayer(nn.Module):
def __init__(self, iw, ow, dropout=None, bias=True):
super().__init__()
self.weight = Parameter(torch.Tensor(iw, ow))
self.dropout = drop... | 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
import torch.nn as nn
from torch.nn.parameter import Parameter
asser... | collodi/ml_svd | RightSVDLayer | false | 1,733 | [
"MIT"
] | 0 | 67a608ca10d3d37bf861e4e7490e62d298fa83b9 | https://github.com/collodi/ml_svd/tree/67a608ca10d3d37bf861e4e7490e62d298fa83b9 |
Critic | import torch
import torch.nn as nn
import torch.nn.functional as F
class Critic(nn.Module):
def __init__(self, state_dim, action_dim):
super(Critic, self).__init__()
self.l1 = nn.Linear(state_dim + action_dim, 256)
self.l2 = nn.Linear(256, 256)
self.l3 = nn.Linear(256, 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 ... | clairecw/TD3 | Critic | false | 1,734 | [
"MIT"
] | 0 | 22840c0ee1620086c2495d859be2c3b7a4c70f3f | https://github.com/clairecw/TD3/tree/22840c0ee1620086c2495d859be2c3b7a4c70f3f |
NormalizeLinear | import torch
from torch.nn import functional as F
from torch import nn
import torch.utils.data
import torch.utils.data.distributed
class NormalizeLinear(nn.Module):
def __init__(self, act_dim, k_value):
super().__init__()
self.lin = nn.Linear(act_dim, k_value)
def normalize(self):
se... | 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.... | coupriec/enc_dec | NormalizeLinear | false | 1,735 | [
"MIT"
] | 0 | 5e31a1cd384f24ac48e932b623780bd0c70103d9 | https://github.com/coupriec/enc_dec/tree/5e31a1cd384f24ac48e932b623780bd0c70103d9 |
_ConvReLU_ | import torch
from torch import nn
class _ConvReLU_(nn.Sequential):
def __init__(self, in_channels, out_channels, kernel_size, stride,
padding, dilation, relu=True):
super(_ConvReLU_, self).__init__()
self.add_module('conv', nn.Conv2d(in_channels=in_channels,
out_channels=out_c... | 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... | cplusx/SIGN | _ConvReLU_ | false | 1,736 | [
"Apache-2.0"
] | 0 | 9777fc3ddd4c6f799caeefe1e72482d5b1ecd8ae | https://github.com/cplusx/SIGN/tree/9777fc3ddd4c6f799caeefe1e72482d5b1ecd8ae |
LeftSVDLayer | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
class LeftSVDLayer(nn.Module):
def __init__(self, ih, oh, dropout=None, bias=True):
super().__init__()
self.weight = Parameter(torch.Tensor(oh, ih))
self.dropout = dropo... | 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
import torch.nn as nn
from torch.nn.parameter import Parameter
asser... | collodi/ml_svd | LeftSVDLayer | false | 1,737 | [
"MIT"
] | 0 | 67a608ca10d3d37bf861e4e7490e62d298fa83b9 | https://github.com/collodi/ml_svd/tree/67a608ca10d3d37bf861e4e7490e62d298fa83b9 |
BertAttention | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
class BertSelfAttention(nn.Module):
def __init__(self, config):
super(BertSelfAttention, self).__init__()
if config.hidden_size % config.num_attention_heads != 0:
raise ValueError(
... | 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.... | cjinchao/mner | BertAttention | false | 1,738 | [
"MIT"
] | 0 | 12776280da314eb7ef22511aa18ca9af0764fb32 | https://github.com/cjinchao/mner/tree/12776280da314eb7ef22511aa18ca9af0764fb32 |
_ASPPModule | import torch
from torch import nn
class _ASPPModule(nn.Module):
"""Atrous Spatial Pyramid Pooling"""
def __init__(self, in_channels, out_channels, pyramids):
super(_ASPPModule, self).__init__()
self.stages = nn.Module()
for i, (dilation, padding) in enumerate(zip(pyramids, pyramids)):... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | cplusx/SIGN | _ASPPModule | false | 1,739 | [
"Apache-2.0"
] | 0 | 9777fc3ddd4c6f799caeefe1e72482d5b1ecd8ae | https://github.com/cplusx/SIGN/tree/9777fc3ddd4c6f799caeefe1e72482d5b1ecd8ae |
Conv2dBlock | import torch
import torch.nn.functional as F
from torch import nn
class AdaptiveInstanceNorm2d(nn.Module):
def __init__(self, num_features, eps=1e-05, momentum=0.1):
super(AdaptiveInstanceNorm2d, self).__init__()
self.num_features = num_features
self.eps = eps
self.momentum = mome... | 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 as... | cplusx/SIGN | Conv2dBlock | false | 1,740 | [
"Apache-2.0"
] | 0 | 9777fc3ddd4c6f799caeefe1e72482d5b1ecd8ae | https://github.com/cplusx/SIGN/tree/9777fc3ddd4c6f799caeefe1e72482d5b1ecd8ae |
BertSelfAttention | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn.functional as F
import torch.nn as nn
class BertSelfAttention(nn.Module):
def __init__(self, config):
super(BertSelfAttention, self).__init__()
if config.hidden_size % config.num_attention_heads != 0:
... | 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.... | codecaution/Hetu | BertSelfAttention | false | 1,741 | [
"Apache-2.0"
] | 0 | e278732c2fe3554c8d576585f5bcbf79ade31b68 | https://github.com/codecaution/Hetu/tree/e278732c2fe3554c8d576585f5bcbf79ade31b68 |
Q | import torch
import torch.nn as nn
import torch.nn.functional as F
class Q(nn.Module):
def __init__(self, state_dim, action_dim, hidden):
super(Q, self).__init__()
self.fc1 = nn.Linear(state_dim + action_dim, hidden)
self.fc2 = nn.Linear(hidden, hidden)
self.fc3 = nn.Linear(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 import triton_helpers
import torch.nn as nn
assert_... | crislmfroes/Parallel-Manipulation-DRL | Q | false | 1,742 | [
"MIT"
] | 0 | b63bd17b933feb5d2844f1db596cd4126380244b | https://github.com/crislmfroes/Parallel-Manipulation-DRL/tree/b63bd17b933feb5d2844f1db596cd4126380244b |
_SelfAttention_ | import torch
from torch import nn
class _SelfAttention_(nn.Module):
def __init__(self, in_planes):
super(_SelfAttention_, self).__init__()
self.f = nn.Conv2d(in_planes, in_planes, (1, 1))
self.g = nn.Conv2d(in_planes, in_planes, (1, 1))
self.h = nn.Conv2d(in_planes, in_planes, (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.... | cplusx/SIGN | _SelfAttention_ | false | 1,743 | [
"Apache-2.0"
] | 0 | 9777fc3ddd4c6f799caeefe1e72482d5b1ecd8ae | https://github.com/cplusx/SIGN/tree/9777fc3ddd4c6f799caeefe1e72482d5b1ecd8ae |
TransformerEncoderLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
def Linear(in_features, out_features, bias=True):
m = nn.Linear(in_features, out_features, bias)
nn.init.xavier_uniform_(m.weight)
if bias:
nn.init.constant_(m.bias, 0.0)
return m
class TransformerEncoderLayer(nn.Module):
... | 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.... | cimeister/neural-transducer | TransformerEncoderLayer | false | 1,744 | [
"MIT"
] | 0 | e4dfc718bbcf93254ce23750e5428c5131ddfb98 | https://github.com/cimeister/neural-transducer/tree/e4dfc718bbcf93254ce23750e5428c5131ddfb98 |
BertAttention | from _paritybench_helpers import _mock_config
from torch.nn import Module
import math
import torch
import torch.nn.functional as F
import torch.nn as nn
class BertLayerNorm(Module):
def __init__(self, hidden_size, eps=1e-12):
super(BertLayerNorm, self).__init__()
self.shape = torch.Size((hidden_s... | 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.... | codecaution/Hetu | BertAttention | false | 1,745 | [
"Apache-2.0"
] | 0 | e278732c2fe3554c8d576585f5bcbf79ade31b68 | https://github.com/codecaution/Hetu/tree/e278732c2fe3554c8d576585f5bcbf79ade31b68 |
TransformerDecoderLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
def Linear(in_features, out_features, bias=True):
m = nn.Linear(in_features, out_features, bias)
nn.init.xavier_uniform_(m.weight)
if bias:
nn.init.constant_(m.bias, 0.0)
return m
class TransformerDecoderLayer(nn.Module):
... | 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.... | cimeister/neural-transducer | TransformerDecoderLayer | false | 1,746 | [
"MIT"
] | 0 | e4dfc718bbcf93254ce23750e5428c5131ddfb98 | https://github.com/cimeister/neural-transducer/tree/e4dfc718bbcf93254ce23750e5428c5131ddfb98 |
Mish | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.optim.lr_scheduler
import torch.utils.data
from torchvision.transforms import *
class Mish(nn.Module):
def forward(self, x):
return x.mul_(F.softplus(x).tanh())
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def ... | 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.optim.lr_scheduler
import t... | csharpshooter/DeepLearning | Mish | false | 1,747 | [
"MIT"
] | 0 | c1d20660c32076468970f7376931e1fcd0d2644e | https://github.com/csharpshooter/DeepLearning/tree/c1d20660c32076468970f7376931e1fcd0d2644e |
SoftBinaryCrossEntropyLoss | import torch
import torch.utils.cpp_extension
class SoftBinaryCrossEntropyLoss(torch.nn.Module):
def __init__(self, tau=1.0):
super().__init__()
self.tau = tau
self.bce_logit = torch.nn.BCEWithLogitsLoss()
def forward(self, pred, true):
logits = pred / self.tau
l = 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 import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | crobbins327/semanticGAN_WSI | SoftBinaryCrossEntropyLoss | false | 1,748 | [
"BSD-2-Clause",
"MIT"
] | 0 | 4046ddc822f463e03952402247f79d540bf7be95 | https://github.com/crobbins327/semanticGAN_WSI/tree/4046ddc822f463e03952402247f79d540bf7be95 |
LogCoshLoss | import torch
import torch.utils.cpp_extension
class LogCoshLoss(torch.nn.Module):
def __init__(self):
super().__init__()
def forward(self, true, pred):
loss = true - pred
return torch.mean(torch.log(torch.cosh(loss + 1e-12)))
def get_inputs():
return [torch.rand([4, 4, 4, 4]), ... | 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... | crobbins327/semanticGAN_WSI | LogCoshLoss | false | 1,749 | [
"BSD-2-Clause",
"MIT"
] | 0 | 4046ddc822f463e03952402247f79d540bf7be95 | https://github.com/crobbins327/semanticGAN_WSI/tree/4046ddc822f463e03952402247f79d540bf7be95 |
DiceLoss | import torch
import torch.optim.lr_scheduler
import torch.utils.data
from torchvision.transforms import *
class DiceLoss(torch.nn.Module):
def init(self):
super(DiceLoss, self).init()
def forward(self, pred, target):
smooth = 1.0
iflat = pred.contiguous().view(-1)
tflat = tar... | 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.optim.lr_scheduler
import torch.utils.data
from torchvision.transforms impor... | csharpshooter/DeepLearning | DiceLoss | false | 1,750 | [
"MIT"
] | 0 | c1d20660c32076468970f7376931e1fcd0d2644e | https://github.com/csharpshooter/DeepLearning/tree/c1d20660c32076468970f7376931e1fcd0d2644e |
WeightedFeatureFusion | import torch
import torch.nn as nn
import torch.optim.lr_scheduler
import torch.utils.data
from torchvision.transforms import *
class WeightedFeatureFusion(nn.Module):
def __init__(self, layers, weight=False):
super(WeightedFeatureFusion, self).__init__()
self.layers = layers
self.weight ... | 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.optim.lr_scheduler
import torch.utils.data
from torchvision.transforms import *
assert_size_stride = torc... | csharpshooter/DeepLearning | WeightedFeatureFusion | false | 1,751 | [
"MIT"
] | 0 | c1d20660c32076468970f7376931e1fcd0d2644e | https://github.com/csharpshooter/DeepLearning/tree/c1d20660c32076468970f7376931e1fcd0d2644e |
CondInjection | import torch
import torch.nn as nn
import torch.utils.cpp_extension
class CondInjection(nn.Module):
def __init__(self):
super().__init__()
self.weight = nn.Parameter(torch.zeros(1))
def forward(self, image, labels, noise=None):
if noise is None:
batch, _, height, width = ... | 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.cpp_extension
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = ... | crobbins327/semanticGAN_WSI | CondInjection | false | 1,752 | [
"BSD-2-Clause",
"MIT"
] | 0 | 4046ddc822f463e03952402247f79d540bf7be95 | https://github.com/crobbins327/semanticGAN_WSI/tree/4046ddc822f463e03952402247f79d540bf7be95 |
Attention | import math
import torch
import torch.nn.functional as F
import torch.utils.data
def restricted_softmax(src, dim=-1, margin=0):
src_max = torch.clamp(src.max(dim=dim, keepdim=True)[0], min=0)
out = (src - src_max).exp()
out = out / (out.sum(dim=dim, keepdim=True) + (margin - src_max).exp())
return out... | 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.... | cshjin/pytorch_geometric | Attention | false | 1,753 | [
"MIT"
] | 0 | 8dd0e76beb72135949a275edd851f80f7b97648f | https://github.com/cshjin/pytorch_geometric/tree/8dd0e76beb72135949a275edd851f80f7b97648f |
ActFirstResBlock | import torch
import torch.nn.functional as F
from torch import nn
class AdaptiveInstanceNorm2d(nn.Module):
def __init__(self, num_features, eps=1e-05, momentum=0.1):
super(AdaptiveInstanceNorm2d, self).__init__()
self.num_features = num_features
self.eps = eps
self.momentum = mome... | 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.... | cplusx/SIGN | ActFirstResBlock | false | 1,754 | [
"Apache-2.0"
] | 0 | 9777fc3ddd4c6f799caeefe1e72482d5b1ecd8ae | https://github.com/cplusx/SIGN/tree/9777fc3ddd4c6f799caeefe1e72482d5b1ecd8ae |
SoftmaxLoss | import torch
import torch.utils.cpp_extension
class SoftmaxLoss(torch.nn.Module):
def __init__(self, tau=1.0):
super().__init__()
self.tau = tau
self.ce_loss = torch.nn.CrossEntropyLoss()
def forward(self, pred, true):
logits = pred / self.tau
l = self.ce_loss(logits,... | 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.utils.cpp... | crobbins327/semanticGAN_WSI | SoftmaxLoss | false | 1,755 | [
"BSD-2-Clause",
"MIT"
] | 0 | 4046ddc822f463e03952402247f79d540bf7be95 | https://github.com/crobbins327/semanticGAN_WSI/tree/4046ddc822f463e03952402247f79d540bf7be95 |
Gate | import torch
import torch.nn as nn
import torch.nn.functional as F
class Gate(nn.Module):
"""Gate Unit
g = sigmoid(Wx)
x = g * x
"""
def __init__(self, input_size):
super(Gate, self).__init__()
self.linear = nn.Linear(input_size, input_size, bias=False)
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
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | csarron/QAModels | Gate | false | 1,756 | [
"BSD-3-Clause"
] | 0 | 2db2d7b0f546b88211e111b42744408bbf9b6f35 | https://github.com/csarron/QAModels/tree/2db2d7b0f546b88211e111b42744408bbf9b6f35 |
Linear | import math
import torch
from torch import Tensor
from torch.nn import Linear
from torch.nn import Parameter
import torch.utils.data
def uniform(size, tensor):
bound = 1.0 / math.sqrt(size)
if tensor is not None:
tensor.data.uniform_(-bound, bound)
def kaiming_uniform(tensor, fan, a):
if tensor ... | 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 Tensor
from torch.nn import Parameter
import torch... | cshjin/pytorch_geometric | Linear | false | 1,757 | [
"MIT"
] | 0 | 8dd0e76beb72135949a275edd851f80f7b97648f | https://github.com/cshjin/pytorch_geometric/tree/8dd0e76beb72135949a275edd851f80f7b97648f |
SFU | import torch
import torch.nn as nn
import torch.nn.functional as F
class SFU(nn.Module):
"""Semantic Fusion Unit
The ouput vector is expected to not only retrieve correlative information from fusion vectors,
but also retain partly unchange as the input vector
"""
def __init__(self, input_size, fu... | 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 ... | csarron/QAModels | SFU | false | 1,758 | [
"BSD-3-Clause"
] | 0 | 2db2d7b0f546b88211e111b42744408bbf9b6f35 | https://github.com/csarron/QAModels/tree/2db2d7b0f546b88211e111b42744408bbf9b6f35 |
DecoderLayer | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
def attention(q, k, v, d_k, mask=None, dropout=None):
scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(d_k)
if mask is not None:
mask = mask.unsqueeze(1)
scores = scores.masked_fill(mask == 0, -1000000000.0... | 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.... | congson1293/Transformer | DecoderLayer | false | 1,759 | [
"Apache-2.0"
] | 0 | 249638f3287e0ed11c71496178fe2ceac2d758df | https://github.com/congson1293/Transformer/tree/249638f3287e0ed11c71496178fe2ceac2d758df |
DenseSAGEConv | import math
import torch
import torch.nn.functional as F
from torch.nn import Parameter
import torch.utils.data
def uniform(size, tensor):
bound = 1.0 / math.sqrt(size)
if tensor is not None:
tensor.data.uniform_(-bound, bound)
class DenseSAGEConv(torch.nn.Module):
"""See :class:`torch_geometric... | 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 math
from torch.nn imp... | cshjin/pytorch_geometric | DenseSAGEConv | false | 1,760 | [
"MIT"
] | 0 | 8dd0e76beb72135949a275edd851f80f7b97648f | https://github.com/cshjin/pytorch_geometric/tree/8dd0e76beb72135949a275edd851f80f7b97648f |
LinearExcitability | import math
import torch
from torch import nn
from torch.nn.parameter import Parameter
def linearExcitability(input, weight, excitability=None, bias=None):
"""Applies a linear transformation to the incoming data: :math:`y = c(xA^T) + b`.
Shape:
- input: :math:`(N, *, in_features)`
- we... | 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
from torch.nn.parameter import Parameter
assert... | cuongpxu/continual-learning | LinearExcitability | false | 1,761 | [
"MIT"
] | 0 | 0f799ddc0efe7e6df7038d2e97303add8d5e01fd | https://github.com/cuongpxu/continual-learning/tree/0f799ddc0efe7e6df7038d2e97303add8d5e01fd |
EncoderLayer | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
def attention(q, k, v, d_k, mask=None, dropout=None):
scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(d_k)
if mask is not None:
mask = mask.unsqueeze(1)
scores = scores.masked_fill(mask == 0, -1000000000.0... | 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.... | congson1293/Transformer | EncoderLayer | false | 1,762 | [
"Apache-2.0"
] | 0 | 249638f3287e0ed11c71496178fe2ceac2d758df | https://github.com/congson1293/Transformer/tree/249638f3287e0ed11c71496178fe2ceac2d758df |
DenseGraphConv | import math
import torch
from torch.nn import Parameter
import torch.utils.data
def uniform(size, tensor):
bound = 1.0 / math.sqrt(size)
if tensor is not None:
tensor.data.uniform_(-bound, bound)
class DenseGraphConv(torch.nn.Module):
"""See :class:`torch_geometric.nn.conv.GraphConv`.
"""
... | 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.nn import Parameter
import torch.utils.data
assert_size_s... | cshjin/pytorch_geometric | DenseGraphConv | false | 1,763 | [
"MIT"
] | 0 | 8dd0e76beb72135949a275edd851f80f7b97648f | https://github.com/cshjin/pytorch_geometric/tree/8dd0e76beb72135949a275edd851f80f7b97648f |
BasicConv | import time
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.tensorboard import SummaryWriter
def singleton(cls):
obj = cls()
cls.__new__ = staticmethod(lambda cls: obj)
try:
del cls.__init__
except AttributeError:
pass
return cls
@singleton
cla... | 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 time
import torch.nn a... | Zikoat/musweeper | BasicConv | false | 1,764 | [
"MIT"
] | 0 | 07e3e5e5e5e4edad4d8b1b6bb05aee2f33f8d9cb | https://github.com/Zikoat/musweeper/tree/07e3e5e5e5e4edad4d8b1b6bb05aee2f33f8d9cb |
DenseGCNConv | import math
import torch
from torch.nn import Parameter
import torch.utils.data
def glorot(tensor):
if tensor is not None:
stdv = math.sqrt(6.0 / (tensor.size(-2) + tensor.size(-1)))
tensor.data.uniform_(-stdv, stdv)
def zeros(tensor):
if tensor is not None:
tensor.data.fill_(0)
cl... | 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.... | cshjin/pytorch_geometric | DenseGCNConv | false | 1,765 | [
"MIT"
] | 0 | 8dd0e76beb72135949a275edd851f80f7b97648f | https://github.com/cshjin/pytorch_geometric/tree/8dd0e76beb72135949a275edd851f80f7b97648f |
InnerProductProbe | import torch
import torch.nn as nn
class InnerProductProbe(nn.Module):
def __init__(self, length: 'int', max_rank: 'int'=None):
super().__init__()
self.length = length
if max_rank is None:
max_rank = length
self.b = nn.Parameter(torch.empty(max_rank, length, dtype=torc... | 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... | daemon/vizbert | InnerProductProbe | false | 1,766 | [
"MIT"
] | 0 | e40b7d1529f8857050313f8d87ff03b1b7226c9e | https://github.com/daemon/vizbert/tree/e40b7d1529f8857050313f8d87ff03b1b7226c9e |
Encoder | import torch
from torch import nn as nn
def conv3d(in_channels, out_channels, kernel_size, bias, padding=1):
return nn.Conv3d(in_channels, out_channels, kernel_size, padding=
padding, bias=bias)
def create_conv(in_channels, out_channels, kernel_size, order, num_groups,
padding=1):
"""
Create... | 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.... | cviaai/TMJ_tracking | Encoder | false | 1,767 | [
"MIT"
] | 0 | 464ca21dbeb538dc9504bd5d0e5c4d92591e69c4 | https://github.com/cviaai/TMJ_tracking/tree/464ca21dbeb538dc9504bd5d0e5c4d92591e69c4 |
MultiHead | import math
import torch
from torch import Tensor
from torch.nn import Linear
import torch.nn.functional as F
from torch.nn import Parameter
import torch.utils.data
def uniform(size, tensor):
bound = 1.0 / math.sqrt(size)
if tensor is not None:
tensor.data.uniform_(-bound, bound)
def kaiming_uniform... | 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.... | cshjin/pytorch_geometric | MultiHead | false | 1,768 | [
"MIT"
] | 0 | 8dd0e76beb72135949a275edd851f80f7b97648f | https://github.com/cshjin/pytorch_geometric/tree/8dd0e76beb72135949a275edd851f80f7b97648f |
MinibatchStdDev | import torch
import torch.nn as nn
class MinibatchStdDev(nn.Module):
"""
Minibatch standard deviation layer for the discriminator, try to prevent mode collapse
From https://github.com/akanimax/BMSG-GAN/
"""
def __init__(self):
"""
derived class constructor
"""
supe... | 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.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | cwza/deep_t2i | MinibatchStdDev | false | 1,769 | [
"Apache-2.0"
] | 0 | 22877fdd28ad407984ddc3bc4d57109c54c22fc0 | https://github.com/cwza/deep_t2i/tree/22877fdd28ad407984ddc3bc4d57109c54c22fc0 |
Linker | import torch
import torch.nn as nn
import torch.nn.functional as F
class Linker(nn.Module):
def __init__(self, inplanes, outplanes, kernel_size, strides):
super(Linker, self).__init__()
self.avgpool = nn.AvgPool2d(kernel_size, strides)
self.pad = (0, 0, 0, 0) + ((outplanes - inplanes) // ... | 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... | daniel03c1/audio_augment | Linker | false | 1,770 | [
"MIT"
] | 0 | ee73bb0844e22c57c9cbeb129560da4a3853f77d | https://github.com/daniel03c1/audio_augment/tree/ee73bb0844e22c57c9cbeb129560da4a3853f77d |
Swish | import torch
import torch.nn
import torch.nn as nn
class Swish(nn.Module):
"""Applies the element-wise function:
.. math::
\\text{Swish}(x) = x * \\text{Sigmoid}(\\alpha * x) for constant value alpha.
Citation: Searching for Activation Functions, Ramachandran et al., 2017, https://arxiv.org/abs/... | 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.... | danielschulz/MONAI | Swish | false | 1,772 | [
"Apache-2.0"
] | 0 | 54ef6e9e700f0de3d50184c0148f953be871a58e | https://github.com/danielschulz/MONAI/tree/54ef6e9e700f0de3d50184c0148f953be871a58e |
DistanceMatrixLoss | import torch
import torch.nn as nn
class DistanceMatrixLoss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, scores, labels, mask):
sq_lengths = mask.view(mask.size(0), -1).sum(1)
l1_diff = (mask * torch.abs(scores - labels)).view(labels.size(0), -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.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | daemon/vizbert | DistanceMatrixLoss | false | 1,773 | [
"MIT"
] | 0 | e40b7d1529f8857050313f8d87ff03b1b7226c9e | https://github.com/daemon/vizbert/tree/e40b7d1529f8857050313f8d87ff03b1b7226c9e |
ExtResNetBlock | import torch
from torch import nn as nn
def conv3d(in_channels, out_channels, kernel_size, bias, padding=1):
return nn.Conv3d(in_channels, out_channels, kernel_size, padding=
padding, bias=bias)
def create_conv(in_channels, out_channels, kernel_size, order, num_groups,
padding=1):
"""
Create... | 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 import n... | cviaai/TMJ_tracking | ExtResNetBlock | false | 1,774 | [
"MIT"
] | 0 | 464ca21dbeb538dc9504bd5d0e5c4d92591e69c4 | https://github.com/cviaai/TMJ_tracking/tree/464ca21dbeb538dc9504bd5d0e5c4d92591e69c4 |
DepthwiseSeparableConv2d | import torch
import torch.nn as nn
import torch.optim.lr_scheduler
import torch.utils.data
from torchvision.transforms import *
class DepthwiseSeparableConv2d(nn.Module):
def __init__(self, input, output, padding=0, bias=False):
super(DepthwiseSeparableConv2d, self).__init__()
self.depthwise = nn... | 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.optim.lr_scheduler
import torch.utils.data
fr... | csharpshooter/DeepLearning | DepthwiseSeparableConv2d | false | 1,775 | [
"MIT"
] | 0 | c1d20660c32076468970f7376931e1fcd0d2644e | https://github.com/csharpshooter/DeepLearning/tree/c1d20660c32076468970f7376931e1fcd0d2644e |
CARAFE | import torch
import torch.nn as nn
import torch.nn.functional as F
class CARAFE(nn.Module):
def __init__(self, inC, outC, Kencoder=3, delta=2, Kup=5, Cm=64):
super(CARAFE, self).__init__()
self.Kencoder = Kencoder
self.delta = delta
self.Kup = Kup
self.down = nn.Conv2d(in_... | 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.... | cs18chen/fbnn | CARAFE | false | 1,776 | [
"MIT"
] | 0 | 1f52c49f8d1e0e1fa7b5a04677351817c4c0e977 | https://github.com/cs18chen/fbnn/tree/1f52c49f8d1e0e1fa7b5a04677351817c4c0e977 |
AMBinaryLoss | import torch
import torch.nn as nn
class AMBinaryLoss(nn.Module):
def __init__(self, m=0.35, k=0.8, t=1, s=30, eps=1e-08, sym_adjustment=
False, auto_balance=False, label_smooth=0.0, gamma_neg=0, gamma_pos=0):
super().__init__()
self.sym_adjustment = sym_adjustment
self.gamma_neg ... | 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
... | daniil-lyakhov/deep-object-reid | AMBinaryLoss | false | 1,777 | [
"Apache-2.0"
] | 0 | b0f7d6a2d4cff8c417a66d82c09d16788d81ec67 | https://github.com/daniil-lyakhov/deep-object-reid/tree/b0f7d6a2d4cff8c417a66d82c09d16788d81ec67 |
MaxPoolBranch | import torch
import torch.nn as nn
class MaxPoolBranch(nn.Module):
"""
InceptionV4 specific max pooling branch block.
"""
def __init__(self, kernel_size=3, stride=2, padding=0):
super(MaxPoolBranch, self).__init__()
self.pool = nn.MaxPool2d(kernel_size=kernel_size, stride=stride,
... | 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... | daniil-lyakhov/deep-object-reid | MaxPoolBranch | false | 1,778 | [
"Apache-2.0"
] | 0 | b0f7d6a2d4cff8c417a66d82c09d16788d81ec67 | https://github.com/daniil-lyakhov/deep-object-reid/tree/b0f7d6a2d4cff8c417a66d82c09d16788d81ec67 |
AsymmetricLoss | import torch
import torch.nn as nn
class AsymmetricLoss(nn.Module):
""" Notice - optimized version, minimizes memory allocation and gpu uploading,
favors inplace operations"""
def __init__(self, gamma_neg=4, gamma_pos=0, probability_margin=0.05,
eps=1e-08, label_smooth=0.0):
super().__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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | daniil-lyakhov/deep-object-reid | AsymmetricLoss | false | 1,779 | [
"Apache-2.0"
] | 0 | b0f7d6a2d4cff8c417a66d82c09d16788d81ec67 | https://github.com/daniil-lyakhov/deep-object-reid/tree/b0f7d6a2d4cff8c417a66d82c09d16788d81ec67 |
CBOW | import torch
import torch.nn as nn
class CBOW(nn.Module):
def __init__(self, input_size, hidden_size):
super().__init__()
self.fc1 = nn.Linear(input_size, hidden_size)
self.fc2 = nn.Linear(hidden_size, input_size)
def forward(self, x):
x = sum([*x]).float()
x = self.f... | 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... | danny-1k/autocomplete_hist | CBOW | false | 1,780 | [
"BSD-2-Clause"
] | 0 | 0a553ea59e08f2ddca60a1f35e9cf14d43370100 | https://github.com/danny-1k/autocomplete_hist/tree/0a553ea59e08f2ddca60a1f35e9cf14d43370100 |
GumbelSigmoid | import torch
import torch.nn as nn
def gumbel(x, eps=1e-20):
return -torch.log(-torch.log(torch.rand_like(x) + eps) + eps)
class GumbelSigmoid(nn.Module):
def __init__(self, scale=1.0):
super().__init__()
self.scale = float(scale)
def forward(self, logits):
y = logits + gumbel(... | 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... | daniil-lyakhov/deep-object-reid | GumbelSigmoid | false | 1,781 | [
"Apache-2.0"
] | 0 | b0f7d6a2d4cff8c417a66d82c09d16788d81ec67 | https://github.com/daniil-lyakhov/deep-object-reid/tree/b0f7d6a2d4cff8c417a66d82c09d16788d81ec67 |
TorchDiceLoss | import torch
from torch import nn
def soft_dice_loss(outputs, targets, per_image=False):
batch_size = outputs.size()[0]
eps = 1e-05
if not per_image:
batch_size = 1
dice_target = targets.contiguous().view(batch_size, -1).float()
dice_output = outputs.contiguous().view(batch_size, -1)
i... | 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... | dannyjeck-matroid/solaris | TorchDiceLoss | false | 1,782 | [
"Apache-2.0"
] | 0 | 463d220c1fe14f811cbbbf528a7353022538006e | https://github.com/dannyjeck-matroid/solaris/tree/463d220c1fe14f811cbbbf528a7353022538006e |
Normalize | import torch
import torch.nn as nn
class Normalize(nn.Module):
"""
Scale Audio to be between -1 and 1
"""
def __init__(self):
super(Normalize, self).__init__()
def forward(self, audio: 'torch.Tensor'):
if len(audio.shape) != 2:
raise ValueError('Audio should be 2D: [... | 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... | dariocazzani/vo-id | Normalize | false | 1,783 | [
"MIT"
] | 0 | 41d0f2779e7909cfa15afcb6c8222c48a5855eb8 | https://github.com/dariocazzani/vo-id/tree/41d0f2779e7909cfa15afcb6c8222c48a5855eb8 |
LCTGate | import torch
import torch.nn as nn
class LCTGate(nn.Module):
def __init__(self, channels, groups=16):
super(LCTGate, self).__init__()
assert channels > 0
assert groups > 0
while channels % groups != 0:
groups //= 2
self.gn = nn.GroupNorm(groups, channels, affin... | 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.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | daniil-lyakhov/deep-object-reid | LCTGate | false | 1,784 | [
"Apache-2.0"
] | 0 | b0f7d6a2d4cff8c417a66d82c09d16788d81ec67 | https://github.com/daniil-lyakhov/deep-object-reid/tree/b0f7d6a2d4cff8c417a66d82c09d16788d81ec67 |
DiceLoss | import collections
import torch
import warnings
from typing import Optional
from typing import Union
from typing import Any
from typing import Callable
from typing import Tuple
import torch.nn
from torch.nn.modules.loss import _Loss
from enum import Enum
import collections.abc
def issequenceiterable(obj: 'Any') ->boo... | 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 collections
from typing import Optional
from typing import Union
from typing import Any
from typing import Callable
from typing impor... | danielschulz/MONAI | DiceLoss | false | 1,785 | [
"Apache-2.0"
] | 0 | 54ef6e9e700f0de3d50184c0148f953be871a58e | https://github.com/danielschulz/MONAI/tree/54ef6e9e700f0de3d50184c0148f953be871a58e |
TorchJaccardLoss | import torch
class TorchJaccardLoss(torch.nn.modules.Module):
def __init__(self):
super(TorchJaccardLoss, self).__init__()
def forward(self, outputs, targets):
eps = 1e-15
jaccard_target = (targets == 1).float()
jaccard_output = torch.sigmoid(outputs)
intersection = (... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | dannyjeck-matroid/solaris | TorchJaccardLoss | false | 1,786 | [
"Apache-2.0"
] | 0 | 463d220c1fe14f811cbbbf528a7353022538006e | https://github.com/dannyjeck-matroid/solaris/tree/463d220c1fe14f811cbbbf528a7353022538006e |
Normalize3D | import torch
import torch.nn as nn
class Normalize3D(nn.Module):
"""
Scale Spectrogram to be between 0 and 1
"""
def __init__(self):
super(Normalize3D, self).__init__()
def forward(self, X: 'torch.Tensor'):
if len(X.shape) != 3:
raise ValueError(
'Inp... | 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... | dariocazzani/vo-id | Normalize3D | false | 1,787 | [
"MIT"
] | 0 | 41d0f2779e7909cfa15afcb6c8222c48a5855eb8 | https://github.com/dariocazzani/vo-id/tree/41d0f2779e7909cfa15afcb6c8222c48a5855eb8 |
BertPooler | from _paritybench_helpers import _mock_config
import torch
from torch import nn
import torch.onnx
class BertPooler(nn.Module):
def __init__(self, config):
super(BertPooler, self).__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.activation = nn.Tanh()
... | 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 import n... | Alwaysproblem/examples-1 | BertPooler | false | 1,788 | [
"MIT"
] | 0 | 9754fa63ed1931489a21ac1f5b299f945e369a5c | https://github.com/Alwaysproblem/examples-1/tree/9754fa63ed1931489a21ac1f5b299f945e369a5c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.