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 |
|---|---|---|---|---|---|---|---|---|---|---|
NonLinearProbe3 | import torch
from torch import nn
class NonLinearProbe3(nn.Module):
def __init__(self, input_dim, num_classes=255):
super().__init__()
self.linear = nn.Linear(in_features=input_dim, out_features=num_classes
)
self.sigmoid = nn.Sigmoid()
def forward(self, feature_vectors):... | 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... | PAL-ML/atari-representation-learning | NonLinearProbe3 | false | 2,802 | [
"MIT"
] | 0 | 11977da174d9ef74c0b2333322b9f0b28e15239e | https://github.com/PAL-ML/atari-representation-learning/tree/11977da174d9ef74c0b2333322b9f0b28e15239e |
NonLinearProbe1 | import torch
from torch import nn
class NonLinearProbe1(nn.Module):
def __init__(self, input_dim, num_classes=255):
super().__init__()
self.linear = nn.Linear(in_features=input_dim, out_features=num_classes
)
self.relu = nn.ReLU()
def forward(self, feature_vectors):
... | 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... | PAL-ML/atari-representation-learning | NonLinearProbe1 | false | 2,803 | [
"MIT"
] | 0 | 11977da174d9ef74c0b2333322b9f0b28e15239e | https://github.com/PAL-ML/atari-representation-learning/tree/11977da174d9ef74c0b2333322b9f0b28e15239e |
L2N | import torch
import torch.nn as nn
def l2n(x, eps=1e-06):
return x / (torch.norm(x, p=2, dim=1, keepdim=True) + eps).expand_as(x)
class L2N(nn.Module):
def __init__(self, eps=1e-06):
super(L2N, self).__init__()
self.eps = eps
def forward(self, x):
return l2n(x, eps=self.eps)
... | 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_... | SamSweere/CV-PIRE | L2N | false | 2,804 | [
"MIT"
] | 0 | d857167b3058cb51d10662150c6a4ba3c85f2903 | https://github.com/SamSweere/CV-PIRE/tree/d857167b3058cb51d10662150c6a4ba3c85f2903 |
InstanceNorm2d | import torch
from torch import nn as nn
from torch.nn import init as init
from torchvision.models import vgg as vgg
import torch.utils.data
from torch.utils import data as data
from torch import autograd as autograd
class InstanceNorm2d(nn.Module):
def __init__(self, epsilon=1e-08, **kwargs):
super().__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.triton_helpers import libdevice
from torch import nn as nn
from torch.nn import init as init
from torchvision.m... | Lotayou/BasicSR | InstanceNorm2d | false | 2,805 | [
"Apache-2.0",
"MIT"
] | 0 | 6cf9a706dd680d54f7dc26e87318ff79f76c0dbf | https://github.com/Lotayou/BasicSR/tree/6cf9a706dd680d54f7dc26e87318ff79f76c0dbf |
BCE_disc_sm_v2 | import torch
import torch.nn as nn
import torch.nn.functional as F
class BCE_disc_sm_v2(nn.Module):
def __init__(self, weight_list=None, lb_sm=0.2):
super(BCE_disc_sm_v2, self).__init__()
self.weight_list = weight_list
self.lb_sm = lb_sm
def forward(self, x, labels):
assert (... | 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... | Sampson-Lee/SIB-Net | BCE_disc_sm_v2 | false | 2,806 | [
"MIT"
] | 0 | 650399082e9237327fa38168ccfc7d48153a1db5 | https://github.com/Sampson-Lee/SIB-Net/tree/650399082e9237327fa38168ccfc7d48153a1db5 |
SelfAttention0 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class MultiHeadedAttention(nn.Module):
def __init__(self, h, d_model, dropout=0.0):
"""Take in model size and number of heads."""
super(MultiHeadedAttention, self).__init__()
self.d_k = d_model // h
sel... | 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.... | SSussexGit/deepikachu | SelfAttention0 | false | 2,807 | [
"MIT"
] | 0 | 72999c4a3f1767c3e5f332fe64cba9240ef43a79 | https://github.com/SSussexGit/deepikachu/tree/72999c4a3f1767c3e5f332fe64cba9240ef43a79 |
SelfAttention | import torch
from torch import nn
import torch.nn.functional as F
def conv1d(ni: 'int', no: 'int', ks: 'int'=1, stride: 'int'=1, padding:
'int'=0, bias: 'bool'=True):
"""
Create and initialize a `nn.Conv1d` layer with spectral normalization.
"""
conv = nn.Conv1d(ni, no, ks, stride=stride, padding=... | 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.... | STRCSussex-UbiCompSiegen/dl_har_model | SelfAttention | false | 2,808 | [
"MIT"
] | 0 | caac0f87fc7dd08a5d6ad3e4455ee25b35f5e7b4 | https://github.com/STRCSussex-UbiCompSiegen/dl_har_model/tree/caac0f87fc7dd08a5d6ad3e4455ee25b35f5e7b4 |
MSE_disc | import torch
import torch.nn as nn
class MSE_disc(nn.Module):
def __init__(self, weight_list=None):
super(MSE_disc, self).__init__()
self.weight_list = weight_list
def forward(self, x, labels):
loss = (x - labels) ** 2
if self.weight_list is not None:
loss = 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Sampson-Lee/SIB-Net | MSE_disc | false | 2,809 | [
"MIT"
] | 0 | 650399082e9237327fa38168ccfc7d48153a1db5 | https://github.com/Sampson-Lee/SIB-Net/tree/650399082e9237327fa38168ccfc7d48153a1db5 |
QNetwork | import torch
from torch import nn
import torch.nn.functional as F
def weights_init_(m):
if isinstance(m, nn.Linear):
torch.nn.init.xavier_uniform_(m.weight, gain=1)
torch.nn.init.constant_(m.bias, 0)
class QNetwork(nn.Module):
def __init__(self, num_inputs, num_actions, hidden_dim):
... | 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... | SINGROUP/Atom_manipulation_with_RL | QNetwork | false | 2,810 | [
"MIT"
] | 0 | 428e05459ed395f1a5fc00a7c65a9b0c26210ee8 | https://github.com/SINGROUP/Atom_manipulation_with_RL/tree/428e05459ed395f1a5fc00a7c65a9b0c26210ee8 |
BCE_disc_sm_v6 | import torch
import torch.nn as nn
import torch.nn.functional as F
class BCE_disc_sm_v6(nn.Module):
def __init__(self, weight_list=None, lb_sm1=0.5, lb_sm0=0.1):
super(BCE_disc_sm_v6, self).__init__()
self.weight_list = weight_list
self.lb_sm1 = lb_sm1
self.lb_sm0 = lb_sm0
de... | 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... | Sampson-Lee/SIB-Net | BCE_disc_sm_v6 | false | 2,811 | [
"MIT"
] | 0 | 650399082e9237327fa38168ccfc7d48153a1db5 | https://github.com/Sampson-Lee/SIB-Net/tree/650399082e9237327fa38168ccfc7d48153a1db5 |
MultiHeadedAttention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class MultiHeadedAttention(nn.Module):
def __init__(self, h, d_model, dropout=0.0):
"""Take in model size and number of heads."""
super(MultiHeadedAttention, self).__init__()
self.d_k = d_model // h
sel... | 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.... | SSussexGit/deepikachu | MultiHeadedAttention | false | 2,812 | [
"MIT"
] | 0 | 72999c4a3f1767c3e5f332fe64cba9240ef43a79 | https://github.com/SSussexGit/deepikachu/tree/72999c4a3f1767c3e5f332fe64cba9240ef43a79 |
InnerProductModel | import torch
class InnerProductModel(torch.nn.Module):
@staticmethod
def is_valid_model_type(model_type):
raise NotImplementedError
@staticmethod
def get_model_from_type(model_type):
raise NotImplementedError
@property
def loss_criterion(self):
return torch.nn.MSELos... | 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
reinterpret... | SamuelGong/plato | InnerProductModel | false | 2,813 | [
"Apache-2.0"
] | 0 | 726f965620e63dfe18cc2edf07cc010a751f0231 | https://github.com/SamuelGong/plato/tree/726f965620e63dfe18cc2edf07cc010a751f0231 |
BCE_disc_sm_v8 | import torch
import torch.nn as nn
import torch.nn.functional as F
class BCE_disc_sm_v8(nn.Module):
def __init__(self, lb_sm=0.2):
super(BCE_disc_sm_v8, self).__init__()
self.lb_sm = lb_sm
def forward(self, x, labels):
assert (x >= 0).all() and (x <= 1).all(), 'x is wrong'
as... | 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... | Sampson-Lee/SIB-Net | BCE_disc_sm_v8 | false | 2,814 | [
"MIT"
] | 0 | 650399082e9237327fa38168ccfc7d48153a1db5 | https://github.com/Sampson-Lee/SIB-Net/tree/650399082e9237327fa38168ccfc7d48153a1db5 |
InputConv | import torch
import torch.nn as nn
import torch.nn.functional as F
def _get_padding(kernel_size, stride, dilation):
padding = (stride - 1 + dilation * (kernel_size - 1)) // 2
return padding
class InputConv(nn.Module):
def __init__(self, inp, outp, k=3, stride=1, dilation=1):
super(InputConv, 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
import torch.nn as nn
assert_... | Sanjay-Ganeshan/webcam-mouse | InputConv | false | 2,815 | [
"Apache-2.0"
] | 0 | 240d1ee00816440e971c8c747bef02c12f3e5d57 | https://github.com/Sanjay-Ganeshan/webcam-mouse/tree/240d1ee00816440e971c8c747bef02c12f3e5d57 |
BCE_disc_sm_v3 | import torch
import torch.nn as nn
import torch.nn.functional as F
class BCE_disc_sm_v3(nn.Module):
def __init__(self, weight_list=None, lb_sm=0.2):
super(BCE_disc_sm_v3, self).__init__()
self.weight_list = weight_list
self.lb_sm = lb_sm
def forward(self, x, labels):
assert (... | 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... | Sampson-Lee/SIB-Net | BCE_disc_sm_v3 | false | 2,816 | [
"MIT"
] | 0 | 650399082e9237327fa38168ccfc7d48153a1db5 | https://github.com/Sampson-Lee/SIB-Net/tree/650399082e9237327fa38168ccfc7d48153a1db5 |
ResidualSelfAttention0 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class MultiHeadedAttention(nn.Module):
def __init__(self, h, d_model, dropout=0.0):
"""Take in model size and number of heads."""
super(MultiHeadedAttention, self).__init__()
self.d_k = d_model // h
sel... | 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.... | SSussexGit/deepikachu | ResidualSelfAttention0 | false | 2,817 | [
"MIT"
] | 0 | 72999c4a3f1767c3e5f332fe64cba9240ef43a79 | https://github.com/SSussexGit/deepikachu/tree/72999c4a3f1767c3e5f332fe64cba9240ef43a79 |
MaxLayer | import torch
from torch import Tensor
import torch.nn
class MaxLayer(torch.nn.Module):
"""Placeholder Layer for Max operation"""
def __init__(self):
super(MaxLayer, self).__init__()
def forward(self, inputs: 'Tensor'):
return inputs.max(dim=-1)[0]
def get_inputs():
return [torch.ra... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_str... | MoritzWag/LPDN | MaxLayer | false | 2,818 | [
"MIT"
] | 0 | a88a5a03f18c7f87879918369b8dc7a0e3abb02b | https://github.com/MoritzWag/LPDN/tree/a88a5a03f18c7f87879918369b8dc7a0e3abb02b |
BCE_disc_sm_v5 | import torch
import torch.nn as nn
import torch.nn.functional as F
class BCE_disc_sm_v5(nn.Module):
def __init__(self, weight_list=None, lb_sm=0.2):
super(BCE_disc_sm_v5, self).__init__()
self.weight_list = weight_list
self.lb_sm = lb_sm
def forward(self, x, labels):
assert (... | 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
... | Sampson-Lee/SIB-Net | BCE_disc_sm_v5 | false | 2,819 | [
"MIT"
] | 0 | 650399082e9237327fa38168ccfc7d48153a1db5 | https://github.com/Sampson-Lee/SIB-Net/tree/650399082e9237327fa38168ccfc7d48153a1db5 |
SeperableConv | import torch
import torch.nn as nn
import torch.nn.functional as F
def _get_padding(kernel_size, stride, dilation):
padding = (stride - 1 + dilation * (kernel_size - 1)) // 2
return padding
class SeperableConv(nn.Module):
def __init__(self, inp, outp, k=3, stride=1, dilation=1):
super(Seperable... | 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_... | Sanjay-Ganeshan/webcam-mouse | SeperableConv | false | 2,820 | [
"Apache-2.0"
] | 0 | 240d1ee00816440e971c8c747bef02c12f3e5d57 | https://github.com/Sanjay-Ganeshan/webcam-mouse/tree/240d1ee00816440e971c8c747bef02c12f3e5d57 |
CustomInverse | import torch
class CustomTorchOp(torch.autograd.Function):
@staticmethod
def symbolic(g, input):
return g.op('torchcustom::Add10', input)
@staticmethod
def forward(ctx, x):
return x + 10
class CustomInverse(torch.nn.Module):
def forward(self, x, y):
ress = CustomTorchO... | 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... | Sanster/onnxruntime-extensions | CustomInverse | false | 2,821 | [
"MIT"
] | 0 | 6eb41afcb2394d94ee90c7ae409fa96122e4cace | https://github.com/Sanster/onnxruntime-extensions/tree/6eb41afcb2394d94ee90c7ae409fa96122e4cace |
DQN | import torch
import torch.nn as nn
import torch.nn.functional as F
class DQN(nn.Module):
def __init__(self, state_dim, action_dim, fc1_unit=64, fc2_unit=64,
fc3_unit=128):
super(DQN, self).__init__()
self.fc1 = nn.Linear(state_dim, fc1_unit)
self.fc2 = nn.Linear(fc1_unit, 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
import torch.nn as nn
assert_... | ProfessorQu/Reinforcement-Learning | DQN | false | 2,822 | [
"MIT"
] | 0 | e1cd645fc5a7ce60248c1a96c560a38d1b9433cd | https://github.com/ProfessorQu/Reinforcement-Learning/tree/e1cd645fc5a7ce60248c1a96c560a38d1b9433cd |
ScaledDotProductAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class ScaledDotProductAttention(nn.Module):
""" Scaled Dot-Product Attention """
def __init__(self, temperature, attn_dropout=0.1):
super().__init__()
self.temperature = temperature
self.dropout = nn.Dropout(attn_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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | RuaBQ/FEAT | ScaledDotProductAttention | false | 2,823 | [
"MIT"
] | 0 | e46f56b03f8ef820d549cb385600a12bdf224de9 | https://github.com/RuaBQ/FEAT/tree/e46f56b03f8ef820d549cb385600a12bdf224de9 |
MSE_cont | import torch
import torch.nn as nn
class MSE_cont(nn.Module):
def __init__(self, theta=1 / 10):
super(MSE_cont, self).__init__()
self.theta = theta
def forward(self, x, labels):
loss = (x - labels) ** 2
mask = loss.gt(self.theta).float()
loss = loss * mask
ret... | 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... | Sampson-Lee/SIB-Net | MSE_cont | false | 2,824 | [
"MIT"
] | 0 | 650399082e9237327fa38168ccfc7d48153a1db5 | https://github.com/Sampson-Lee/SIB-Net/tree/650399082e9237327fa38168ccfc7d48153a1db5 |
multiloss | import torch
import torch.nn as nn
class multiloss(nn.Module):
def __init__(self, objective_num):
super(multiloss, self).__init__()
self.objective_num = objective_num
self.log_var = nn.Parameter(torch.zeros(self.objective_num))
def forward(self, losses):
for i in range(len(lo... | 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... | ShaharLutatiPersonal/hyperhypernetworks | multiloss | false | 2,825 | [
"MIT"
] | 0 | 16e2595d89ad0533c9d5a2c62870fb90f1b1dc42 | https://github.com/ShaharLutatiPersonal/hyperhypernetworks/tree/16e2595d89ad0533c9d5a2c62870fb90f1b1dc42 |
ScaledDotProductAttention | import torch
import torch.optim.lr_scheduler
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
def __init__(self, d_model, attention_dropout=0.1):
super(ScaledDotProductAttention, self).__init__()
self.temper = d_model ** 0.5
self.dropout = nn.Dropout(attention_dropout)
... | 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.... | Shengqiang-Zhang/self-attentive-parser | ScaledDotProductAttention | false | 2,826 | [
"MIT"
] | 0 | 493f74c7acab9824d593f55d231754c5ac7cbb26 | https://github.com/Shengqiang-Zhang/self-attentive-parser/tree/493f74c7acab9824d593f55d231754c5ac7cbb26 |
conv_block | import torch
import torch.nn as nn
class conv_block(nn.Module):
def __init__(self, init_shape):
super(conv_block, self).__init__()
self.conv0 = nn.Conv2d(in_channels=init_shape[0], out_channels=
init_shape[1], kernel_size=init_shape[2])
self.relu = nn.ELU()
nn.init.kai... | 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 ... | ShaharLutatiPersonal/hyperhypernetworks | conv_block | false | 2,827 | [
"MIT"
] | 0 | 16e2595d89ad0533c9d5a2c62870fb90f1b1dc42 | https://github.com/ShaharLutatiPersonal/hyperhypernetworks/tree/16e2595d89ad0533c9d5a2c62870fb90f1b1dc42 |
FusedLeakyReLU | import torch
from torch import nn
from torch.nn import functional as F
class FusedLeakyReLU(nn.Module):
def __init__(self, channel, negative_slope=0.2, scale=2 ** 0.5):
super().__init__()
self.bias = nn.Parameter(torch.zeros(channel))
self.negative_slope = negative_slope
self.scal... | 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... | ShinoharaHare/stylegan2-pytorch | FusedLeakyReLU | false | 2,828 | [
"MIT",
"BSD-2-Clause",
"Apache-2.0"
] | 0 | 5a4b1c4e9753681bc1694195f3b2391527c1b525 | https://github.com/ShinoharaHare/stylegan2-pytorch/tree/5a4b1c4e9753681bc1694195f3b2391527c1b525 |
BCE_disc_sm_v7 | import torch
import torch.nn as nn
import torch.nn.functional as F
class BCE_disc_sm_v7(nn.Module):
def __init__(self, weight_list=None, lb_sm=0.2):
super(BCE_disc_sm_v7, self).__init__()
self.weight_list = weight_list
self.lb_sm = lb_sm
def forward(self, x, labels):
assert (... | 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... | Sampson-Lee/SIB-Net | BCE_disc_sm_v7 | false | 2,829 | [
"MIT"
] | 0 | 650399082e9237327fa38168ccfc7d48153a1db5 | https://github.com/Sampson-Lee/SIB-Net/tree/650399082e9237327fa38168ccfc7d48153a1db5 |
Down2d | import torch
import torch.nn as nn
class Down2d(nn.Module):
"""docstring for Down2d."""
def __init__(self, in_channel, out_channel, kernel, stride, padding):
super(Down2d, self).__init__()
self.c1 = nn.Conv2d(in_channel, out_channel, kernel_size=kernel,
stride=stride, padding=padd... | 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 ... | Shimamura-Lab-SU/SGV | Down2d | false | 2,830 | [
"MIT"
] | 0 | 8df3c314532528b8597c5dbb28bdfb23155bee82 | https://github.com/Shimamura-Lab-SU/SGV/tree/8df3c314532528b8597c5dbb28bdfb23155bee82 |
GCN | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from itertools import *
from time import *
class GraphConvolution(nn.Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
def __init__(self, in_features, o... | 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
import torch.nn a... | Richard-LYF/SESS-GC | GCN | false | 2,831 | [
"MIT"
] | 0 | 2280e5ec8e5c5e20d0bda629b7d05f61bad0bec7 | https://github.com/Richard-LYF/SESS-GC/tree/2280e5ec8e5c5e20d0bda629b7d05f61bad0bec7 |
EPE | import torch
import torch.nn as nn
class EPE(nn.Module):
def __init__(self):
super(EPE, self).__init__()
def forward(self, flow, gt, loss_mask):
loss_map = (flow - gt.detach()) ** 2
loss_map = (loss_map.sum(1, True) + 1e-06) ** 0.5
return loss_map * loss_mask
def get_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
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | Shreyamkmr/Frame-Interpolation | EPE | false | 2,832 | [
"MIT"
] | 0 | bf5eb768e11fdd55d3f322f0a365db3b190a7903 | https://github.com/Shreyamkmr/Frame-Interpolation/tree/bf5eb768e11fdd55d3f322f0a365db3b190a7903 |
BCE_disc_sm_v4 | import torch
import torch.nn as nn
import torch.nn.functional as F
class BCE_disc_sm_v4(nn.Module):
def __init__(self, weight_list=None, lb_sm=0.2):
super(BCE_disc_sm_v4, self).__init__()
self.weight_list = weight_list
self.lb_sm = lb_sm
def forward(self, x, labels):
assert (... | 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... | Sampson-Lee/SIB-Net | BCE_disc_sm_v4 | false | 2,833 | [
"MIT"
] | 0 | 650399082e9237327fa38168ccfc7d48153a1db5 | https://github.com/Sampson-Lee/SIB-Net/tree/650399082e9237327fa38168ccfc7d48153a1db5 |
HingeLoss | import torch
import torch.nn as nn
class HingeLoss(nn.Module):
def __init__(self):
super(HingeLoss, self).__init__()
self.margin = 1.0
def hinge_loss(self, input, target):
output = self.margin - input.mul(target)
output[output.le(0)] = 0
return output.mean()
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 import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | Siraj-Qazi/BNN-PYNQ | HingeLoss | false | 2,834 | [
"BSD-3-Clause"
] | 0 | b942fe92b3c62b0b877b0a9d5c13e7eb3a234685 | https://github.com/Siraj-Qazi/BNN-PYNQ/tree/b942fe92b3c62b0b877b0a9d5c13e7eb3a234685 |
GradLoss | import torch
import torch.nn as nn
class GradLoss(nn.Module):
def __init__(self):
super(GradLoss, self).__init__()
def forward(self, grad_fake, grad_real):
return torch.mean(torch.abs(grad_real - grad_fake))
def get_inputs():
return [torch.rand([4, 4, 4, 4]), 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 math as tl_math
import torch.nn as nn
... | SiTae9317/Depth-Estimation-PyTorch | GradLoss | false | 2,836 | [
"MIT"
] | 0 | 03b25d5cd2dff665c4435e72aba605a9d710fe01 | https://github.com/SiTae9317/Depth-Estimation-PyTorch/tree/03b25d5cd2dff665c4435e72aba605a9d710fe01 |
Quantizer | import torch
import torch.nn as nn
class QuantizeAct(torch.autograd.Function):
@staticmethod
def forward(ctx, input, numbits):
ctx.save_for_backward(input)
if numbits == 1:
return input.sign()
elif numbits == 2:
return torch.floor(input + 0.5)
else:
... | 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 torch.nn as nn
assert... | Siraj-Qazi/BNN-PYNQ | Quantizer | false | 2,837 | [
"BSD-3-Clause"
] | 0 | b942fe92b3c62b0b877b0a9d5c13e7eb3a234685 | https://github.com/Siraj-Qazi/BNN-PYNQ/tree/b942fe92b3c62b0b877b0a9d5c13e7eb3a234685 |
h_sigmoid | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class h_sigmoid(nn.Module):
def __init__(self, inplace=True, h_max=1):
super(h_sigmoid, self).__init__()
self.relu = nn.ReLU6(inplace=inplace)
self.h_... | 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.nn.parallel
import torch.optim
import torch.utils.data... | SpectrePrediction/micronet | h_sigmoid | false | 2,838 | [
"MIT"
] | 0 | f56269c7a8744f750e9870f0baa9fb6e68f27b9c | https://github.com/SpectrePrediction/micronet/tree/f56269c7a8744f750e9870f0baa9fb6e68f27b9c |
StyledConv | 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_tens)
def make_kernel(k):
k = 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
import math
from to... | ShinoharaHare/stylegan2-pytorch | StyledConv | false | 2,839 | [
"MIT",
"BSD-2-Clause",
"Apache-2.0"
] | 0 | 5a4b1c4e9753681bc1694195f3b2391527c1b525 | https://github.com/ShinoharaHare/stylegan2-pytorch/tree/5a4b1c4e9753681bc1694195f3b2391527c1b525 |
ConvFC | import torch
import torch.nn as nn
import torch.nn.functional as F
class ConvFC(nn.Module):
def __init__(self, conv_in_channels, conv_out_channels, input_size,
hidden_size, output_size, kernel_size=3):
super(ConvFC, self).__init__()
self.conv_out_channels = conv_out_channels
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Silent-Zebra/sequential_social_dilemma_games | ConvFC | false | 2,840 | [
"MIT"
] | 0 | 8cf8faebf7de727bac55bd8020be7cd9cc243ccc | https://github.com/Silent-Zebra/sequential_social_dilemma_games/tree/8cf8faebf7de727bac55bd8020be7cd9cc243ccc |
h_swish | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class h_sigmoid(nn.Module):
def __init__(self, inplace=True, h_max=1):
super(h_sigmoid, self).__init__()
self.relu = nn.ReLU6(inplace=inplace)
self.h_... | 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.nn.parallel
import torch.optim
import torch.utils.data... | SpectrePrediction/micronet | h_swish | false | 2,841 | [
"MIT"
] | 0 | f56269c7a8744f750e9870f0baa9fb6e68f27b9c | https://github.com/SpectrePrediction/micronet/tree/f56269c7a8744f750e9870f0baa9fb6e68f27b9c |
NeuralNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class NeuralNet(nn.Module):
def __init__(self, input_size, hidden_size, output_size):
super(NeuralNet, self).__init__()
self.layer1 = nn.Linear(input_size, hidden_size)
self.layer2 = nn.Linear(hidden_size, hidden_size)
... | 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... | Silent-Zebra/sequential_social_dilemma_games | NeuralNet | false | 2,842 | [
"MIT"
] | 0 | 8cf8faebf7de727bac55bd8020be7cd9cc243ccc | https://github.com/Silent-Zebra/sequential_social_dilemma_games/tree/8cf8faebf7de727bac55bd8020be7cd9cc243ccc |
cSE | import torch
import torch.nn as nn
class cSE(nn.Module):
def __init__(self, out_channels):
super().__init__()
self.linear1 = nn.Linear(in_features=out_channels, out_features=int
(out_channels / 2), bias=False)
self.linear2 = nn.Linear(in_features=int(out_channels / 2),
... | 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_... | Soo95/segmentation_models.pytorch | cSE | false | 2,843 | [
"MIT"
] | 0 | 9131b336d6939dfabbadecd0d56d382283f46803 | https://github.com/Soo95/segmentation_models.pytorch/tree/9131b336d6939dfabbadecd0d56d382283f46803 |
AUXModule | import torch
import torch.nn as nn
import torch.nn.functional as F
class AUXModule(nn.Module):
def __init__(self, in_features, out_features):
super().__init__()
self.linear = nn.Linear(in_features, out_features)
def forward(self, x):
x = F.adaptive_max_pool2d(x, output_size=(1, 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
assert_... | Soo95/segmentation_models.pytorch | AUXModule | false | 2,844 | [
"MIT"
] | 0 | 9131b336d6939dfabbadecd0d56d382283f46803 | https://github.com/Soo95/segmentation_models.pytorch/tree/9131b336d6939dfabbadecd0d56d382283f46803 |
h_tanh | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class h_tanh(nn.Module):
def __init__(self, inplace=True, h_max=1):
super(h_tanh, self).__init__()
self.relu = nn.ReLU6(inplace=inplace)
self.h_max = ... | 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.nn.parallel
import torch.optim
import torch.utils.data... | SpectrePrediction/micronet | h_tanh | false | 2,845 | [
"MIT"
] | 0 | f56269c7a8744f750e9870f0baa9fb6e68f27b9c | https://github.com/SpectrePrediction/micronet/tree/f56269c7a8744f750e9870f0baa9fb6e68f27b9c |
PolarNet | import torch
import torch.utils.data
import torch.nn as nn
class PolarNet(torch.nn.Module):
def __init__(self, num_hid):
super(PolarNet, self).__init__()
self.layer1 = nn.Linear(2, num_hid)
self.layer2 = nn.Linear(num_hid, 1)
def forward(self, input):
r = torch.sqrt(input[:, ... | 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.utils.... | Spacider/comp9444_assignment | PolarNet | false | 2,846 | [
"Apache-2.0"
] | 0 | 149db9a562c579d03b3ea06c9de2020c8f3ef310 | https://github.com/Spacider/comp9444_assignment/tree/149db9a562c579d03b3ea06c9de2020c8f3ef310 |
Conv2dLayer | import torch
import torch.nn as nn
from torch.nn import Parameter
def l2normalize(v, eps=1e-12):
return v / (v.norm() + eps)
class LayerNorm(nn.Module):
def __init__(self, num_features, eps=1e-08, affine=True):
super(LayerNorm, self).__init__()
self.num_features = num_features
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.triton_helpers import libdevice
import torch.nn as ... | Sheroa/Video_Colorization | Conv2dLayer | false | 2,847 | [
"MIT"
] | 0 | 5c772ac0ec944814cd8be0a94b0746116b11ac01 | https://github.com/Sheroa/Video_Colorization/tree/5c772ac0ec944814cd8be0a94b0746116b11ac01 |
NetLin | import torch
import torch.utils.data
import torch.nn.functional as F
import torch.nn as nn
class NetLin(nn.Module):
def __init__(self):
super(NetLin, self).__init__()
self.liner1 = nn.Linear(28 * 28, 10)
def forward(self, x):
x = x.view(-1, 784)
output = self.liner1(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.... | Spacider/comp9444_assignment | NetLin | false | 2,848 | [
"Apache-2.0"
] | 0 | 149db9a562c579d03b3ea06c9de2020c8f3ef310 | https://github.com/Spacider/comp9444_assignment/tree/149db9a562c579d03b3ea06c9de2020c8f3ef310 |
EncModel | import torch
import torch.utils.data
class EncModel(torch.nn.Module):
def __init__(self, num_input, num_hid, num_out):
super(EncModel, self).__init__()
self.in_hid = torch.nn.Linear(num_input, num_hid)
self.hid_out = torch.nn.Linear(num_hid, num_out)
def forward(self, input):
... | 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.utils.... | Spacider/comp9444_assignment | EncModel | false | 2,849 | [
"Apache-2.0"
] | 0 | 149db9a562c579d03b3ea06c9de2020c8f3ef310 | https://github.com/Spacider/comp9444_assignment/tree/149db9a562c579d03b3ea06c9de2020c8f3ef310 |
NetFull | import torch
import torch.utils.data
import torch.nn.functional as F
import torch.nn as nn
class NetFull(nn.Module):
def __init__(self):
super(NetFull, self).__init__()
self.liner1 = nn.Linear(28 * 28, 400)
self.liner2 = nn.Linear(400, 200)
self.liner3 = nn.Linear(200, 10)
de... | 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.... | Spacider/comp9444_assignment | NetFull | false | 2,850 | [
"Apache-2.0"
] | 0 | 149db9a562c579d03b3ea06c9de2020c8f3ef310 | https://github.com/Spacider/comp9444_assignment/tree/149db9a562c579d03b3ea06c9de2020c8f3ef310 |
UpsampleConv | import torch
import torch.nn as nn
def spectral_norm(layer, n_iters=1):
return torch.nn.utils.spectral_norm(layer, n_power_iterations=n_iters)
class UpsampleConv(nn.Module):
def __init__(self, input_dim, output_dim, kernel_size=3, biases=True,
spec_norm=False):
super().__init__()
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Sriram-Ravula/Inverse_Meta | UpsampleConv | false | 2,851 | [
"MIT"
] | 0 | c6c1e4ae0d670093156249c60d74373b22d61f01 | https://github.com/Sriram-Ravula/Inverse_Meta/tree/c6c1e4ae0d670093156249c60d74373b22d61f01 |
VarianceNorm2d | import torch
import torch.nn as nn
class VarianceNorm2d(nn.Module):
def __init__(self, num_features, bias=False):
super().__init__()
self.num_features = num_features
self.bias = bias
self.alpha = nn.Parameter(torch.zeros(num_features))
self.alpha.data.normal_(1, 0.02)
... | 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_... | Sriram-Ravula/Inverse_Meta | VarianceNorm2d | false | 2,852 | [
"MIT"
] | 0 | c6c1e4ae0d670093156249c60d74373b22d61f01 | https://github.com/Sriram-Ravula/Inverse_Meta/tree/c6c1e4ae0d670093156249c60d74373b22d61f01 |
ResConv2dLayer | import torch
import torch.nn as nn
from torch.nn import Parameter
def l2normalize(v, eps=1e-12):
return v / (v.norm() + eps)
class LayerNorm(nn.Module):
def __init__(self, num_features, eps=1e-08, affine=True):
super(LayerNorm, self).__init__()
self.num_features = num_features
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.triton_helpers import libdevice
import torch.nn as ... | Sheroa/Video_Colorization | ResConv2dLayer | false | 2,853 | [
"MIT"
] | 0 | 5c772ac0ec944814cd8be0a94b0746116b11ac01 | https://github.com/Sheroa/Video_Colorization/tree/5c772ac0ec944814cd8be0a94b0746116b11ac01 |
Attention | import torch
import torch.nn as nn
class Attention(nn.Module):
def __init__(self, encoder_dim, hidden_dim):
super(Attention, self).__init__()
self.hidden_lin = nn.Linear(hidden_dim, hidden_dim)
self.tanh = nn.Tanh()
self.img_lin = nn.Linear(encoder_dim, hidden_dim)
self.so... | 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.... | Soumya1612-Rasha/Image-Captioning | Attention | false | 2,854 | [
"MIT"
] | 0 | 63439754567ced2dbe762aed150ba5476029781c | https://github.com/Soumya1612-Rasha/Image-Captioning/tree/63439754567ced2dbe762aed150ba5476029781c |
TransposeConv2dLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Parameter
def l2normalize(v, eps=1e-12):
return v / (v.norm() + eps)
class LayerNorm(nn.Module):
def __init__(self, num_features, eps=1e-08, affine=True):
super(LayerNorm, self).__init__()
self.num_featu... | 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 ... | Sheroa/Video_Colorization | TransposeConv2dLayer | false | 2,855 | [
"MIT"
] | 0 | 5c772ac0ec944814cd8be0a94b0746116b11ac01 | https://github.com/Sheroa/Video_Colorization/tree/5c772ac0ec944814cd8be0a94b0746116b11ac01 |
ConvMeanPool | import torch
import torch.nn as nn
def spectral_norm(layer, n_iters=1):
return torch.nn.utils.spectral_norm(layer, n_power_iterations=n_iters)
class ConvMeanPool(nn.Module):
def __init__(self, input_dim, output_dim, kernel_size=3, biases=True,
adjust_padding=False, spec_norm=False):
super()... | 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... | Sriram-Ravula/ncsnv2 | ConvMeanPool | false | 2,856 | [
"MIT"
] | 0 | f610b59441a34063fae1c02aa06837b7eec95c03 | https://github.com/Sriram-Ravula/ncsnv2/tree/f610b59441a34063fae1c02aa06837b7eec95c03 |
Encoder | import torch
import torch.nn as nn
import torch.nn.functional as F
class Encoder(nn.Module):
"""Estimation of the nonnegative mixture weight by a 1-D conv layer.
"""
def __init__(self, L, N):
super(Encoder, self).__init__()
self.L, self.N = L, N
self.conv1d_U = nn.Conv1d(1, N, ker... | 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_... | Stanwang1210/HW3_1_Source_Seperation | Encoder | false | 2,857 | [
"MIT"
] | 0 | 8c05850fa4f0f0845c460f9afd06fd8fe3e29dc9 | https://github.com/Stanwang1210/HW3_1_Source_Seperation/tree/8c05850fa4f0f0845c460f9afd06fd8fe3e29dc9 |
CombineSlices | import torch
from torch import nn
import torch.utils.data
import torch.utils.data.distributed
import torch.optim
class CombineSlices(nn.Module):
def __init__(self, slice_dim=2):
super().__init__()
self.slice_dim = slice_dim
def forward(self, x):
return torch.index_select(x, dim=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
import torch.utils.data
import torch.utils.data.distributed
import torch.optim
assert_size_stride = torch._C._dynamo.gu... | Samuel-van-Gurp/fastMRI | CombineSlices | false | 2,858 | [
"MIT"
] | 0 | 0b1884a1c218961f81199144057ffcfde29a86ad | https://github.com/Samuel-van-Gurp/fastMRI/tree/0b1884a1c218961f81199144057ffcfde29a86ad |
JS_div | import torch
import torch.nn as nn
import torch.nn.functional as F
class JS_div(nn.Module):
def __init__(self, margin=0.1):
super(JS_div, self).__init__()
self.margin = margin
self.dist = nn.CosineSimilarity(dim=0)
self.KLDivloss = nn.KLDivLoss(reduction='batchmean')
def forw... | 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... | Sun915/MCALN | JS_div | false | 2,859 | [
"MIT"
] | 0 | e52600fddc62922148480ab9dce6aefc1d3788eb | https://github.com/Sun915/MCALN/tree/e52600fddc62922148480ab9dce6aefc1d3788eb |
GlobalAttention | import torch
from torch import nn
class GlobalAttention(nn.Module):
def __init__(self, dims):
super(GlobalAttention, self).__init__()
self.pool = nn.AdaptiveAvgPool2d(1)
self.conv = nn.Conv2d(dims, dims, 1)
def forward(self, x, y):
att = torch.sigmoid(self.conv(self.pool(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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | StefOe/selection-masks | GlobalAttention | false | 2,860 | [
"BSD-2-Clause"
] | 0 | e59487bffe3c30bdab7a6425bed01f6adeda4f67 | https://github.com/StefOe/selection-masks/tree/e59487bffe3c30bdab7a6425bed01f6adeda4f67 |
GAT | import torch
import torch.nn as nn
import torch.nn.functional as F
from itertools import *
from time import *
class GraphAttentionLayer(nn.Module):
"""
Simple GAT layer, similar to https://arxiv.org/abs/1710.10903
图注意力层
input: (B,N,C_in)
output: (B,N,C_out)
"""
def __init__(self, in_featu... | 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.... | Richard-LYF/SESS-GC | GAT | false | 2,861 | [
"MIT"
] | 0 | 2280e5ec8e5c5e20d0bda629b7d05f61bad0bec7 | https://github.com/Richard-LYF/SESS-GC/tree/2280e5ec8e5c5e20d0bda629b7d05f61bad0bec7 |
InstanceNorm2dPlus | import torch
import torch.nn as nn
class InstanceNorm2dPlus(nn.Module):
def __init__(self, num_features, bias=True):
super().__init__()
self.num_features = num_features
self.bias = bias
self.instance_norm = nn.InstanceNorm2d(num_features, affine=False,
track_running_st... | 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_... | Sriram-Ravula/ncsnv2 | InstanceNorm2dPlus | false | 2,862 | [
"MIT"
] | 0 | f610b59441a34063fae1c02aa06837b7eec95c03 | https://github.com/Sriram-Ravula/ncsnv2/tree/f610b59441a34063fae1c02aa06837b7eec95c03 |
Cartesian | import torch
from torch import nn
import torch.utils.data
import torch.utils.data.distributed
import torch.optim
class Cartesian(nn.Module):
def forward(self, x):
r, phi = x[..., 0], x[..., 1]
return torch.stack((r * torch.cos(phi), r * torch.sin(phi)), dim=-1)
def get_inputs():
return [tor... | 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
import torch.utils.data
import torch.utils.data.dist... | Samuel-van-Gurp/fastMRI | Cartesian | false | 2,863 | [
"MIT"
] | 0 | 0b1884a1c218961f81199144057ffcfde29a86ad | https://github.com/Samuel-van-Gurp/fastMRI/tree/0b1884a1c218961f81199144057ffcfde29a86ad |
MeanPoolConv | import torch
import torch.nn as nn
def spectral_norm(layer, n_iters=1):
return torch.nn.utils.spectral_norm(layer, n_power_iterations=n_iters)
class MeanPoolConv(nn.Module):
def __init__(self, input_dim, output_dim, kernel_size=3, biases=True,
spec_norm=False):
super().__init__()
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Sriram-Ravula/ncsnv2 | MeanPoolConv | false | 2,864 | [
"MIT"
] | 0 | f610b59441a34063fae1c02aa06837b7eec95c03 | https://github.com/Sriram-Ravula/ncsnv2/tree/f610b59441a34063fae1c02aa06837b7eec95c03 |
Accuracy | import torch
import torch.nn as nn
def accuracy(logits, labels, ignore_index: 'int'=-100):
with torch.no_grad():
valid_mask = labels != ignore_index
predictions = logits.float().argmax(-1)
correct = (predictions == labels) * valid_mask
return correct.sum().float() / valid_mask.sum(... | 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... | StephanHeijl/tape | Accuracy | false | 2,865 | [
"BSD-3-Clause"
] | 0 | ec631ca53217686605477cf31af4fb8846ff660f | https://github.com/StephanHeijl/tape/tree/ec631ca53217686605477cf31af4fb8846ff660f |
TemporalAttention | import torch
from torch import nn
class TemporalAttention(nn.Module):
"""
Temporal attention module from https://dl.acm.org/doi/abs/10.1145/3448083
"""
def __init__(self, hidden_dim):
super(TemporalAttention, self).__init__()
self.fc = nn.Linear(hidden_dim, 1)
self.sm = torch.... | 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.... | STRCSussex-UbiCompSiegen/dl_har_model | TemporalAttention | false | 2,866 | [
"MIT"
] | 0 | caac0f87fc7dd08a5d6ad3e4455ee25b35f5e7b4 | https://github.com/STRCSussex-UbiCompSiegen/dl_har_model/tree/caac0f87fc7dd08a5d6ad3e4455ee25b35f5e7b4 |
LayerNorm | import torch
import torch.nn as nn
from torch.nn import Parameter
class LayerNorm(nn.Module):
def __init__(self, num_features, eps=1e-08, affine=True):
super(LayerNorm, self).__init__()
self.num_features = num_features
self.affine = affine
self.eps = eps
if self.affine:
... | 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
from torch.nn import Parameter
assert_size_stride = torch... | Sheroa/Video_Colorization | LayerNorm | false | 2,867 | [
"MIT"
] | 0 | 5c772ac0ec944814cd8be0a94b0746116b11ac01 | https://github.com/Sheroa/Video_Colorization/tree/5c772ac0ec944814cd8be0a94b0746116b11ac01 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
from math import *
from copy import *
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(6, 16, 5)
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
import torch.nn as nn
from ma... | Sup3Legacy/TIPE | Net | false | 2,868 | [
"BSD-3-Clause"
] | 0 | 7e01cef869183c4d609c45d5fcf0bb371a9579f5 | https://github.com/Sup3Legacy/TIPE/tree/7e01cef869183c4d609c45d5fcf0bb371a9579f5 |
ReidModel | import torch
import torch.nn as nn
class ReidModel(nn.Module):
def __init__(self, num_features_in, num_anchors=1, num_classes=80,
prior=0.01, feature_size=256):
super(ReidModel, self).__init__()
self.num_classes = num_classes
self.num_anchors = num_anchors
self.conv1 = 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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | SajjadPSavoji/CTracker | ReidModel | false | 2,869 | [
"MIT"
] | 0 | f345925cccca13d045dea5d435ba3d463df7729a | https://github.com/SajjadPSavoji/CTracker/tree/f345925cccca13d045dea5d435ba3d463df7729a |
ConcatConv2d | import torch
import torch.nn as nn
class ConcatConv2d(nn.Module):
def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0,
dilation=1, groups=1, bias=True, transpose=False):
super(ConcatConv2d, self).__init__()
module = nn.ConvTranspose2d if transpose else nn.Conv2d
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Teemo341/BDNN | ConcatConv2d | false | 2,870 | [
"Apache-2.0"
] | 0 | d53d4634a7a43d038faa049d7dfd10b3578ae267 | https://github.com/Teemo341/BDNN/tree/d53d4634a7a43d038faa049d7dfd10b3578ae267 |
QNetwork | import torch
import torch.nn.functional as F
import torch.nn as nn
class QNetwork(nn.Module):
""" Actor Policy (Q Network) model """
def __init__(self, state_size, action_size, seed, fc1_units=512,
fc2_units=256, fc3_units=64):
"""Initialize parameters and build model.
Params
... | 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_... | Sushil-Thapa/ud-deep-reinforcement-learning | QNetwork | false | 2,871 | [
"MIT"
] | 0 | 847873d771550aa7f502fa34e918d33ccc545608 | https://github.com/Sushil-Thapa/ud-deep-reinforcement-learning/tree/847873d771550aa7f502fa34e918d33ccc545608 |
OutlookAttention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
class OutlookAttention(nn.Module):
"""
Implementation of outlook attention
--dim: hidden dim
--num_heads: number of heads
--kernel_size: kernel size in each window for outlook attention
retu... | 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.... | QLSong/cv-classify | OutlookAttention | false | 2,872 | [
"Apache-2.0"
] | 0 | 02f53d03868f299a08b5c97a266b50a7fdcd3f2b | https://github.com/QLSong/cv-classify/tree/02f53d03868f299a08b5c97a266b50a7fdcd3f2b |
MLPBlock | import torch
from torch import nn
class MLPBlock(nn.Module):
def __init__(self, in_features, out_features, bias=True, layer_norm=
True, dropout=0.3, activation=nn.ReLU):
super().__init__()
self.linear = nn.Linear(in_features, out_features, bias)
self.activation = activation()
... | 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.... | THinnerichs/deepgozero | MLPBlock | false | 2,873 | [
"BSD-3-Clause"
] | 0 | 5f1481c41f879f7ec1b5eea22dcccdb8bf8825e2 | https://github.com/THinnerichs/deepgozero/tree/5f1481c41f879f7ec1b5eea22dcccdb8bf8825e2 |
CRF | import torch
import torch.nn as nn
import torch.utils.data
class CRF(nn.Module):
"""Implements Conditional Random Fields"""
def __init__(self, num_tags):
super(CRF, self).__init__()
self.num_tags = num_tags
self.transitions = nn.Parameter(torch.Tensor(num_tags, num_tags))
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
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guard... | Syhen/vtou-ner | CRF | false | 2,874 | [
"MIT"
] | 0 | 708eb3d475fbce91949a7ca3b0bf2631c4feba62 | https://github.com/Syhen/vtou-ner/tree/708eb3d475fbce91949a7ca3b0bf2631c4feba62 |
QuantConv1d | import torch
from torch import nn
class QuantConv1d(nn.Module):
"""Quantized 1D Conv"""
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros',
**kwargs):
super().__init__()
self.qconv1d = nn.Conv1d... | 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... | TeaPoly/wenet | QuantConv1d | false | 2,875 | [
"Apache-2.0"
] | 0 | 5681887e338e4c8b2c75ffc283140e11a9d56a6d | https://github.com/TeaPoly/wenet/tree/5681887e338e4c8b2c75ffc283140e11a9d56a6d |
GumbelSoftmaxLayer | import torch
import torch.nn as nn
from torch.distributions import RelaxedOneHotCategorical
import torch.nn.parallel
import torch.utils.data
import torch.distributions
def gumbel_softmax_sample(logits: 'torch.Tensor', temperature: 'float'=1.0,
training: 'bool'=True, straight_through: 'bool'=False):
size = log... | 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
from torch.distributions import RelaxedOneHotCategorical
import torch.nn.parallel
import torch.utils.data
import torch... | Shawn-Guo-CN/EGG | GumbelSoftmaxLayer | false | 2,876 | [
"MIT"
] | 0 | 0a5b258108e2cd1c873d7f67e8c92551bb3d809c | https://github.com/Shawn-Guo-CN/EGG/tree/0a5b258108e2cd1c873d7f67e8c92551bb3d809c |
RegressionModel | import torch
import torch.nn as nn
class RegressionModel(nn.Module):
def __init__(self, num_features_in, num_anchors=1, feature_size=256):
super(RegressionModel, self).__init__()
self.conv1 = nn.Conv2d(num_features_in, feature_size, kernel_size=3,
padding=1)
self.act1 = nn.ReL... | 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_... | SajjadPSavoji/CTracker | RegressionModel | false | 2,877 | [
"MIT"
] | 0 | f345925cccca13d045dea5d435ba3d463df7729a | https://github.com/SajjadPSavoji/CTracker/tree/f345925cccca13d045dea5d435ba3d463df7729a |
SimpleAttention | import torch
import torch.nn.functional as F
from torch import nn
class SimpleAttention(nn.Module):
def __init__(self, n_features, n_hidden, key=False, copy=False, query=
True, memory=False):
super().__init__()
self.key = key
self.query = query
self.memory = memory
... | 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.... | TahaBinhuraib/lexical | SimpleAttention | false | 2,878 | [
"MIT"
] | 0 | 0af02590829755f9ae2268fed76ea4b6d38e9b61 | https://github.com/TahaBinhuraib/lexical/tree/0af02590829755f9ae2268fed76ea4b6d38e9b61 |
ResBlock | import torch
import torch.nn as nn
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False)
def norm(dim):
return nn.GroupNorm(min(32, dim), dim)
class ResBlock(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.... | Teemo341/BDNN | ResBlock | false | 2,880 | [
"Apache-2.0"
] | 0 | d53d4634a7a43d038faa049d7dfd10b3578ae267 | https://github.com/Teemo341/BDNN/tree/d53d4634a7a43d038faa049d7dfd10b3578ae267 |
RadialBesselLayer | import torch
import numpy as np
from torch import nn
class RadialBesselLayer(nn.Module):
"""Radial Bessel functions based on the work by DimeNet: https://github.com/klicperajo/dimenet
Args:
n_radials (int, optional): total number of radial functions, :math:`N_g`.
cutoff (float, optional): cut... | 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 numpy as np
from torch import nn
assert_size_stride = torch._C._dynamo.g... | THGLab/NewtonNet | RadialBesselLayer | false | 2,881 | [
"MIT"
] | 0 | fcf2af848a1c998bd08096dcefb58a5610eda03c | https://github.com/THGLab/NewtonNet/tree/fcf2af848a1c998bd08096dcefb58a5610eda03c |
InformedSender | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.utils.data
import torch.distributions
class InformedSender(nn.Module):
def __init__(self, game_size, feat_size, embedding_size, hidden_size,
vocab_size=100, temp=1.0):
super(InformedSender, 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.... | Shawn-Guo-CN/EGG | InformedSender | false | 2,882 | [
"MIT"
] | 0 | 0a5b258108e2cd1c873d7f67e8c92551bb3d809c | https://github.com/Shawn-Guo-CN/EGG/tree/0a5b258108e2cd1c873d7f67e8c92551bb3d809c |
GumbelSoftMax | import torch
import torch.nn as nn
import torch.nn.functional as F
from math import sqrt as sqrt
from itertools import product as product
class _GumbelSoftMax(torch.autograd.Function):
"""
implementing the MixedOp, but carried out in a different way as DARTS
DARTS adds all operations together, then selec... | 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 import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_ma... | TayaPenskaya/hair_classifier | GumbelSoftMax | false | 2,883 | [
"MIT"
] | 0 | 669f42b705a4dd0bdde9d330db5214a3213db5a5 | https://github.com/TayaPenskaya/hair_classifier/tree/669f42b705a4dd0bdde9d330db5214a3213db5a5 |
PositionWiseFFN | import torch
import torch.nn as nn
from random import *
from torch.nn.functional import relu
class PositionWiseFFN(nn.Module):
def __init__(self, model_dim, dropout=0.0):
super().__init__()
dff = model_dim * 4
self.l = nn.Linear(model_dim, dff)
self.o = nn.Linear(dff, model_dim)
... | 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.... | Tensor-Hu/ExampleModel | PositionWiseFFN | false | 2,884 | [
"MIT"
] | 0 | fbbedc7e50b34972fe99560305790bea3341427b | https://github.com/Tensor-Hu/ExampleModel/tree/fbbedc7e50b34972fe99560305790bea3341427b |
ReinforcedReceiver | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.utils.data
from torch.distributions import Bernoulli
import torch.distributions
class ReinforcedReceiver(nn.Module):
def __init__(self, n_bits, n_hidden):
super(ReinforcedReceiver, self).__init__()
... | 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.utils.data
import to... | Shawn-Guo-CN/EGG | ReinforcedReceiver | false | 2,885 | [
"MIT"
] | 0 | 0a5b258108e2cd1c873d7f67e8c92551bb3d809c | https://github.com/Shawn-Guo-CN/EGG/tree/0a5b258108e2cd1c873d7f67e8c92551bb3d809c |
QuantPointwiseConv | import torch
from torch import nn
class QuantPointwiseConv(nn.Module):
"""Quantized Point-wise Conv"""
def __init__(self, in_channels, out_channels, bias=True, **kwargs):
super().__init__()
self.qlinear = nn.Linear(in_channels, out_channels, bias=bias)
self.quant = torch.quantization.... | 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... | TeaPoly/wenet | QuantPointwiseConv | false | 2,886 | [
"Apache-2.0"
] | 0 | 5681887e338e4c8b2c75ffc283140e11a9d56a6d | https://github.com/TeaPoly/wenet/tree/5681887e338e4c8b2c75ffc283140e11a9d56a6d |
Discriminator | import torch
import torch.nn as nn
class Down2d(nn.Module):
"""docstring for Down2d."""
def __init__(self, in_channel, out_channel, kernel, stride, padding):
super(Down2d, self).__init__()
self.c1 = nn.Conv2d(in_channel, out_channel, kernel_size=kernel,
stride=stride, padding=padd... | 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.... | Shimamura-Lab-SU/SGV | Discriminator | false | 2,887 | [
"MIT"
] | 0 | 8df3c314532528b8597c5dbb28bdfb23155bee82 | https://github.com/Shimamura-Lab-SU/SGV/tree/8df3c314532528b8597c5dbb28bdfb23155bee82 |
Drift | import torch
import torch.nn as nn
def norm(dim):
return nn.GroupNorm(min(32, dim), dim)
class ConcatConv2d(nn.Module):
def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0,
dilation=1, groups=1, bias=True, transpose=False):
super(ConcatConv2d, self).__init__()
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.... | Teemo341/BDNN | Drift | false | 2,888 | [
"Apache-2.0"
] | 0 | d53d4634a7a43d038faa049d7dfd10b3578ae267 | https://github.com/Teemo341/BDNN/tree/d53d4634a7a43d038faa049d7dfd10b3578ae267 |
Encoder | import torch
import torch.nn as nn
class Encoder(nn.Module):
def __init__(self, input_dim, hidden_dim, latent_dim):
super(Encoder, self).__init__()
self.FC_input = nn.Linear(input_dim, hidden_dim)
self.FC_mean = nn.Linear(hidden_dim, latent_dim)
self.FC_var = nn.Linear(hidden_dim,... | import torch
from torch import device
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... | TeoAndB/dtu_mlops | Encoder | false | 2,889 | [
"Apache-2.0"
] | 0 | 671d8922298554659fd9697f0ebca7e8bfa0e8c2 | https://github.com/TeoAndB/dtu_mlops/tree/671d8922298554659fd9697f0ebca7e8bfa0e8c2 |
GCN_encoder | import torch
import torch.nn as nn
import torch.nn.init as init
class GraphConv(nn.Module):
def __init__(self, input_dim, output_dim):
super(GraphConv, self).__init__()
self.input_dim = input_dim
self.output_dim = output_dim
self.weight = nn.Parameter(torch.FloatTensor(input_dim, ... | 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 ... | Qin-Folks/graph-generation | GCN_encoder | false | 2,890 | [
"MIT"
] | 0 | afe1b697272b0e683b4551918de36f57f714e70b | https://github.com/Qin-Folks/graph-generation/tree/afe1b697272b0e683b4551918de36f57f714e70b |
Network | import torch
import torch.nn as nn
class Network(nn.Module):
def __init__(self, input_shape, output_shape, n_features, **kwargs):
super(Network, self).__init__()
n_input = input_shape[-1]
n_output = output_shape[0]
self._h1 = nn.Linear(n_input, n_features)
self._h2 = 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.triton_helpers import libdevice
import torch.nn as ... | TheCamusean/mushroom-rl | Network | false | 2,891 | [
"MIT"
] | 0 | 48585f883e546ea57224b8d446ecb9b8ba90cf73 | https://github.com/TheCamusean/mushroom-rl/tree/48585f883e546ea57224b8d446ecb9b8ba90cf73 |
TransformerEncoderLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.utils.data
import torch.distributions
class TransformerEncoderLayer(nn.Module):
def __init__(self, embed_dim, num_heads, hidden_size, dropout=0.0,
attention_dropout=0.0, activation_dropout=0.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.... | Shawn-Guo-CN/EGG | TransformerEncoderLayer | false | 2,892 | [
"MIT"
] | 0 | 0a5b258108e2cd1c873d7f67e8c92551bb3d809c | https://github.com/Shawn-Guo-CN/EGG/tree/0a5b258108e2cd1c873d7f67e8c92551bb3d809c |
CriticNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class CriticNetwork(nn.Module):
def __init__(self, input_shape, output_shape, **kwargs):
super().__init__()
n_input = input_shape[-1]
n_output = output_shape[0]
self._h = nn.Linear(n_input, n_output)
nn.ini... | 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_... | TheCamusean/mushroom-rl | CriticNetwork | false | 2,893 | [
"MIT"
] | 0 | 48585f883e546ea57224b8d446ecb9b8ba90cf73 | https://github.com/TheCamusean/mushroom-rl/tree/48585f883e546ea57224b8d446ecb9b8ba90cf73 |
ActorNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class ActorNetwork(nn.Module):
def __init__(self, input_shape, output_shape, **kwargs):
super(ActorNetwork, self).__init__()
n_input = input_shape[-1]
n_output = output_shape[0]
self._h = nn.Linear(n_input, n_outpu... | 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_... | TheCamusean/mushroom-rl | ActorNetwork | false | 2,895 | [
"MIT"
] | 0 | 48585f883e546ea57224b8d446ecb9b8ba90cf73 | https://github.com/TheCamusean/mushroom-rl/tree/48585f883e546ea57224b8d446ecb9b8ba90cf73 |
ConcatBlock | import torch
import torch.nn as nn
import torch.nn.functional
class ConcatBlock(nn.Module):
def __init__(self, in_channels, out_channels):
super(ConcatBlock, self).__init__()
self.in_chns = in_channels
self.out_chns = out_channels
self.conv1 = nn.Conv2d(self.in_chns, self.in_chns,... | 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.functional
assert_size_stride = torch._C._... | TheSeaOfStars123/SSL4MIS | ConcatBlock | false | 2,896 | [
"MIT"
] | 0 | a3fb6e8c996683eb79dc3f20e965064b7f5d2b3d | https://github.com/TheSeaOfStars123/SSL4MIS/tree/a3fb6e8c996683eb79dc3f20e965064b7f5d2b3d |
MLP | import torch
import torch.nn as nn
class SharedDropout(nn.Module):
"""
SharedDropout differs from the vanilla dropout strategy in that the dropout mask is shared across one dimension.
Args:
p (float):
The probability of an element to be zeroed. Default: 0.5.
batch_first (bool)... | 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... | TheSecret3003/crf_parser | MLP | false | 2,897 | [
"MIT"
] | 0 | 34682ca8729d376b5582a3117e650b524fbcb355 | https://github.com/TheSecret3003/crf_parser/tree/34682ca8729d376b5582a3117e650b524fbcb355 |
OutPutBlock | import torch
import torch.nn as nn
import torch.nn.functional
class OutPutBlock(nn.Module):
def __init__(self, in_channels, out_channels):
super(OutPutBlock, self).__init__()
self.in_chns = in_channels
self.out_chns = out_channels
self.conv1 = nn.Conv2d(self.in_chns, self.in_chns ... | 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.functional
assert_size_stride = torch._C._... | TheSeaOfStars123/SSL4MIS | OutPutBlock | false | 2,898 | [
"MIT"
] | 0 | a3fb6e8c996683eb79dc3f20e965064b7f5d2b3d | https://github.com/TheSeaOfStars123/SSL4MIS/tree/a3fb6e8c996683eb79dc3f20e965064b7f5d2b3d |
random_resize | import random
import torch
import torch.nn as nn
import torch.nn.functional as F
def resize_4d_tensor_by_factor(x, height_factor, width_factor):
res = F.interpolate(x, scale_factor=(height_factor, width_factor), mode
='bilinear')
return res
class random_resize(nn.Module):
def __init__(self, max... | 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.nn.functional as F
assert_size_stride = torch._C._dyna... | Tiamat-Tech/torch-dreams | random_resize | false | 2,899 | [
"MIT"
] | 0 | e1c1795f0a0007f54293c474de5d2b80ee829ab8 | https://github.com/Tiamat-Tech/torch-dreams/tree/e1c1795f0a0007f54293c474de5d2b80ee829ab8 |
ScalarMix | import torch
import torch.nn as nn
class ScalarMix(nn.Module):
"""
Computes a parameterized scalar mixture of :math:`N` tensors, :math:`mixture = \\gamma * \\sum_{k}(s_k * tensor_k)`
where :math:`s = \\mathrm{softmax}(w)`, with :math:`w` and :math:`\\gamma` scalar parameters.
Args:
n_layers (... | 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... | TheSecret3003/crf_parser | ScalarMix | false | 2,900 | [
"MIT"
] | 0 | 34682ca8729d376b5582a3117e650b524fbcb355 | https://github.com/TheSecret3003/crf_parser/tree/34682ca8729d376b5582a3117e650b524fbcb355 |
DotProdAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class DotProdAttention(nn.Module):
"""Basic Dot-Production Attention"""
def __init__(self):
super().__init__()
def forward(self, output, context):
"""Basic Dot-Production Method
1. compute e = q * k
... | 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.... | Tzu-An/ml_seq2seq_attn | DotProdAttention | false | 2,901 | [
"Apache-2.0"
] | 0 | 1f29b1156c5e66e2bb5255c6d214c70162c91528 | https://github.com/Tzu-An/ml_seq2seq_attn/tree/1f29b1156c5e66e2bb5255c6d214c70162c91528 |
AlphaGoCnn | import torch
import torch.nn.functional as F
import torch.nn as nn
class AlphaGoCnn(nn.Module):
def __init__(self):
super(AlphaGoCnn, self).__init__()
self.conv1 = nn.Conv2d(3, 32, 3, padding=1)
self.conv2 = nn.Conv2d(32, 32, 3, padding=1)
self.conv3 = nn.Conv2d(32, 32, 3, padding... | 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... | Theomat/go-enseirb-2020 | AlphaGoCnn | false | 2,902 | [
"Apache-2.0"
] | 0 | ae842888dfd61a23d3556c5f63c4474bdbb1685f | https://github.com/Theomat/go-enseirb-2020/tree/ae842888dfd61a23d3556c5f63c4474bdbb1685f |
TimeEncoding | import torch
import torch.nn as nn
class TimeEncoding(nn.Module):
def __init__(self, d_model, dropout=0.1, max_len=5000):
super(TimeEncoding, self).__init__()
self.dropout = nn.Dropout(p=dropout)
def forward(self, x, mask, lengths):
time = mask * 1 / (lengths[..., None] - 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Tim-blo/ACTOR | TimeEncoding | false | 2,903 | [
"MIT"
] | 0 | f10d7534a34fa557ab6b1739217649ae4f654505 | https://github.com/Tim-blo/ACTOR/tree/f10d7534a34fa557ab6b1739217649ae4f654505 |
MyUpsample2 | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
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)
d... | 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.distributed
assert_size_stride = torch._C._dynamo.... | TransformersWsz/onestage_grounding | MyUpsample2 | false | 2,904 | [
"MIT"
] | 0 | c939a7d5d7c7f9e1bfa8df2e6269397b8f840b5a | https://github.com/TransformersWsz/onestage_grounding/tree/c939a7d5d7c7f9e1bfa8df2e6269397b8f840b5a |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.