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 |
|---|---|---|---|---|---|---|---|---|---|---|
SimpleReciprocalModel | import torch
import torch.jit
import torch.onnx
import torch.nn
class SimpleReciprocalModel(torch.nn.Module):
def __init__(self, inplace=False):
super(SimpleReciprocalModel, self).__init__()
self.inplace = inplace
def forward(self, tensor):
other = tensor + tensor
return othe... | 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.jit
import torch.onnx
import torch.nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | YaronBenAtar/glow | SimpleReciprocalModel | false | 14,679 | [
"Apache-2.0"
] | 2,838 | a13706a4239fa7eaf059c670dc573e3eb0768f86 | https://github.com/YaronBenAtar/glow/tree/a13706a4239fa7eaf059c670dc573e3eb0768f86 |
SimpleSinModule | import torch
import torch.jit
import torch.onnx
import torch.nn
class SimpleSinModule(torch.nn.Module):
def __init__(self):
super(SimpleSinModule, self).__init__()
def forward(self, a):
return torch.sin(a + a)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.jit
import torch.onnx
import torch.nn
assert_size_stride = t... | YaronBenAtar/glow | SimpleSinModule | false | 14,680 | [
"Apache-2.0"
] | 2,838 | a13706a4239fa7eaf059c670dc573e3eb0768f86 | https://github.com/YaronBenAtar/glow/tree/a13706a4239fa7eaf059c670dc573e3eb0768f86 |
SimpleTanhModel | import torch
import torch.jit
import torch.onnx
import torch.nn
class SimpleTanhModel(torch.nn.Module):
def __init__(self, inplace=False):
super(SimpleTanhModel, self).__init__()
self.inplace = inplace
def forward(self, tensor):
tensor = tensor + tensor
return tensor.tanh_() ... | 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.jit
import torch.onnx
import torch.nn
assert_size_stride = torch._... | YaronBenAtar/glow | SimpleTanhModel | false | 14,681 | [
"Apache-2.0"
] | 2,838 | a13706a4239fa7eaf059c670dc573e3eb0768f86 | https://github.com/YaronBenAtar/glow/tree/a13706a4239fa7eaf059c670dc573e3eb0768f86 |
UnaryMaxModule | import torch
import torch.jit
import torch.onnx
import torch.nn
class UnaryMaxModule(torch.nn.Module):
def __init__(self):
super(UnaryMaxModule, self).__init__()
def forward(self, a):
return torch.max(a + a)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.jit
import torch.onnx
import torch.nn
assert_size_stride = torch._C._dynamo.... | YaronBenAtar/glow | UnaryMaxModule | false | 14,682 | [
"Apache-2.0"
] | 2,838 | a13706a4239fa7eaf059c670dc573e3eb0768f86 | https://github.com/YaronBenAtar/glow/tree/a13706a4239fa7eaf059c670dc573e3eb0768f86 |
SimpleSoftmaxModel | import torch
import torch.jit
import torch.nn.functional as F
import torch.onnx
import torch.nn
class SimpleSoftmaxModel(torch.nn.Module):
def __init__(self, dimension):
super(SimpleSoftmaxModel, self).__init__()
self.dimension = dimension
def forward(self, tensor):
return F.softmax(... | 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.jit
impor... | YaronBenAtar/glow | SimpleSoftmaxModel | false | 14,683 | [
"Apache-2.0"
] | 2,838 | a13706a4239fa7eaf059c670dc573e3eb0768f86 | https://github.com/YaronBenAtar/glow/tree/a13706a4239fa7eaf059c670dc573e3eb0768f86 |
SimpleReshapeModel | import torch
import torch.jit
import torch.onnx
import torch.nn
class SimpleReshapeModel(torch.nn.Module):
def __init__(self, shape):
super(SimpleReshapeModel, self).__init__()
self.shape = shape
def forward(self, tensor):
combined = tensor + tensor
return combined.reshape(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
import torch.jit
import torch.onnx
import torch.nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | YaronBenAtar/glow | SimpleReshapeModel | false | 14,684 | [
"Apache-2.0"
] | 2,838 | a13706a4239fa7eaf059c670dc573e3eb0768f86 | https://github.com/YaronBenAtar/glow/tree/a13706a4239fa7eaf059c670dc573e3eb0768f86 |
SimpleTypeasModel | import torch
import torch.jit
import torch.onnx
import torch.nn
class SimpleTypeasModel(torch.nn.Module):
def __init__(self):
super(SimpleTypeasModel, self).__init__()
def forward(self, tensor, other=None):
other = tensor if other is None else other
if tensor.dtype != torch.bool:
... | 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.jit
import torch.onnx
import torch.nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | YaronBenAtar/glow | SimpleTypeasModel | false | 14,685 | [
"Apache-2.0"
] | 2,838 | a13706a4239fa7eaf059c670dc573e3eb0768f86 | https://github.com/YaronBenAtar/glow/tree/a13706a4239fa7eaf059c670dc573e3eb0768f86 |
UnaryMinModule | import torch
import torch.jit
import torch.onnx
import torch.nn
class UnaryMinModule(torch.nn.Module):
def __init__(self):
super(UnaryMinModule, self).__init__()
def forward(self, a):
return torch.min(a + a)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.jit
import torch.onnx
import torch.nn
assert_size_stride = torch._C._dynamo.... | YaronBenAtar/glow | UnaryMinModule | false | 14,686 | [
"Apache-2.0"
] | 2,838 | a13706a4239fa7eaf059c670dc573e3eb0768f86 | https://github.com/YaronBenAtar/glow/tree/a13706a4239fa7eaf059c670dc573e3eb0768f86 |
SimpleSumModule | import torch
import torch.jit
import torch.onnx
import torch.nn
class SimpleSumModule(torch.nn.Module):
def __init__(self, dtype=None):
super(SimpleSumModule, self).__init__()
self.dtype = dtype
def forward(self, a):
b = a + a
return torch.sum(b, dtype=self.dtype)
def get_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
import torch.jit
import torch.onnx
import torch.nn
assert_size_stride = torch._C._dynamo.... | YaronBenAtar/glow | SimpleSumModule | false | 14,687 | [
"Apache-2.0"
] | 2,838 | a13706a4239fa7eaf059c670dc573e3eb0768f86 | https://github.com/YaronBenAtar/glow/tree/a13706a4239fa7eaf059c670dc573e3eb0768f86 |
SimpleStackModel | import torch
import torch.jit
import torch.onnx
import torch.nn
class SimpleStackModel(torch.nn.Module):
def __init__(self, dim):
super(SimpleStackModel, self).__init__()
self.dim = dim
def forward(self, a, b):
c = b + b
return torch.stack((a, c), dim=self.dim)
def get_inpu... | 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.jit
import torch.onnx
import torch.nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | YaronBenAtar/glow | SimpleStackModel | false | 14,688 | [
"Apache-2.0"
] | 2,838 | a13706a4239fa7eaf059c670dc573e3eb0768f86 | https://github.com/YaronBenAtar/glow/tree/a13706a4239fa7eaf059c670dc573e3eb0768f86 |
SpatialAttention | import torch
import torch.nn as nn
class SpatialAttention(nn.Module):
def __init__(self, kernel_size=7):
super(SpatialAttention, self).__init__()
assert kernel_size in (3, 7), 'kernel size must be 3 or 7'
padding = 3 if kernel_size == 7 else 1
self.conv1 = nn.Conv2d(2, 1, kernel_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
import torch.nn as nn
assert_... | YeRen123455/Infrared-Small-Target-Detection | SpatialAttention | false | 14,689 | [
"MIT"
] | 62 | 23d84f436afb422d0d0b6cbf65305e1b53aea6db | https://github.com/YeRen123455/Infrared-Small-Target-Detection/tree/23d84f436afb422d0d0b6cbf65305e1b53aea6db |
QNetworkSmall | import torch
import torch.nn as nn
import torch.nn.functional as F
class QNetworkSmall(nn.Module):
def __init__(self, state_size, action_size, seed):
"""
Build a fully connected neural network
state_size (int): State dimension
action_size (int): Action dimension
seed (int... | 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_... | Yigit-Arisoy/deep-rts | QNetworkSmall | false | 14,690 | [
"MIT"
] | 144 | a5ed2c29b76789830df9f7075480c7229ccf0f4d | https://github.com/Yigit-Arisoy/deep-rts/tree/a5ed2c29b76789830df9f7075480c7229ccf0f4d |
SimpleSoftPlusModel | import torch
import torch.jit
import torch.nn.functional as F
import torch.onnx
import torch.nn
class SimpleSoftPlusModel(torch.nn.Module):
def __init__(self):
super(SimpleSoftPlusModel, self).__init__()
def forward(self, tensor):
tensor = tensor + tensor
return F.softplus(tensor)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torch.jit
import torch.onnx
import torch.nn
assert_size... | YaronBenAtar/glow | SimpleSoftPlusModel | false | 14,691 | [
"Apache-2.0"
] | 2,838 | a13706a4239fa7eaf059c670dc573e3eb0768f86 | https://github.com/YaronBenAtar/glow/tree/a13706a4239fa7eaf059c670dc573e3eb0768f86 |
GRUCell | import torch
import numpy as np
import torch.nn.functional as F
from torch import nn
class GRUCell(nn.Module):
def __init__(self, input_size, hidden_size, bias=True):
super(GRUCell, self).__init__()
self.input_size = input_size
self.hidden_size = hidden_size
self.bias = bias
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import numpy as np
... | YilliaJing/PM2.5-GNN | GRUCell | false | 14,692 | [
"MIT"
] | 91 | 7aacc6b6b9562ad2a9dad6197e6c4d73607ebdf2 | https://github.com/YilliaJing/PM2.5-GNN/tree/7aacc6b6b9562ad2a9dad6197e6c4d73607ebdf2 |
Attention | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import *
class Attention(nn.Module):
def __init__(self, opt):
super(Attention, self).__init__()
self.rnn_size = opt.rnn_size
self.att_hid_size = opt.att_hid... | 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.... | YinTaiChen/NeuralBabyTalk | Attention | false | 14,693 | [
"MIT"
] | 554 | 2915ca702657866dc5b6b44614d0f6333c72bd3b | https://github.com/YinTaiChen/NeuralBabyTalk/tree/2915ca702657866dc5b6b44614d0f6333c72bd3b |
SeparableConv1D | import torch
from torch import nn
class SeparableConv1D(nn.Module):
"""Depthwise separable 1D convolution.
Args:
in_channels (int): Number of input channels.
out_channels (int): Number of output channels.
kernel_size (int): Size of the convolving kernel.
stride (int): Stride 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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | YiwenShaoStephen/snowfall | SeparableConv1D | false | 14,694 | [
"Apache-2.0"
] | 145 | 949226f35b29c629cb03cae36fa43da5993d27a3 | https://github.com/YiwenShaoStephen/snowfall/tree/949226f35b29c629cb03cae36fa43da5993d27a3 |
ScaledDotProductAttention | import torch
import numpy as np
import torch.utils.data
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
"""
Scaled dot-product attention
"""
def __init__(self, *, d_model: int, d_k: int, d_v: int, h: int):
"""
:param d_model: Output dimensionality of the model
... | 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.... | YehLi/xmodaler | ScaledDotProductAttention | false | 14,695 | [
"Apache-2.0"
] | 830 | 5340054398c076cfa717317d151ca595c5e37198 | https://github.com/YehLi/xmodaler/tree/5340054398c076cfa717317d151ca595c5e37198 |
QNetworkMedium | import torch
import torch.nn as nn
import torch.nn.functional as F
class QNetworkMedium(nn.Module):
def __init__(self, state_size, action_size, seed):
"""
Build a fully connected neural network
state_size (int): State dimension
action_size (int): Action dimension
seed (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
import torch.nn as nn
assert_... | Yigit-Arisoy/deep-rts | QNetworkMedium | false | 14,696 | [
"MIT"
] | 144 | a5ed2c29b76789830df9f7075480c7229ccf0f4d | https://github.com/Yigit-Arisoy/deep-rts/tree/a5ed2c29b76789830df9f7075480c7229ccf0f4d |
PositionalEmbedding | import math
import torch
class PositionalEmbedding(torch.nn.Module):
def __init__(self):
super(PositionalEmbedding, self).__init__()
def forward(self, inputs):
if inputs.dim() != 3:
raise ValueError('The rank of input must be 3.')
length = inputs.shape[1]
channels... | 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... | Yuran-Zhao/THUMT | PositionalEmbedding | false | 14,697 | [
"BSD-3-Clause"
] | 422 | 10f0433c1f2fe3f992d26ccb6f4f8dec457ce695 | https://github.com/Yuran-Zhao/THUMT/tree/10f0433c1f2fe3f992d26ccb6f4f8dec457ce695 |
MaxOut | import torch
import torch.nn as nn
class MaxOut(nn.Module):
def __init__(self, pool_size):
super(MaxOut, self).__init__()
self.pool_size = pool_size
def forward(self, ipt):
"""
input:
reduce_size:
"""
input_size = list(ipt.size())
assert input_... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | YuxiXie/Semantic-Graphs-for-Generating-Deep-Questions | MaxOut | false | 14,698 | [
"MIT"
] | 62 | 6e5ef241c64b5b30a6ff54ddad31e610013b8388 | https://github.com/YuxiXie/Semantic-Graphs-for-Generating-Deep-Questions/tree/6e5ef241c64b5b30a6ff54ddad31e610013b8388 |
ScaledDotProductAttentionMemory | import torch
import numpy as np
import torch.utils.data
import torch.nn as nn
class ScaledDotProductAttentionMemory(nn.Module):
"""
Scaled dot-product attention with memory
"""
def __init__(self, *, d_model: int, d_k: int, d_v: int, h: int, m: int):
"""
:param d_model: Output dimensio... | 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.... | YehLi/xmodaler | ScaledDotProductAttentionMemory | false | 14,699 | [
"Apache-2.0"
] | 830 | 5340054398c076cfa717317d151ca595c5e37198 | https://github.com/YehLi/xmodaler/tree/5340054398c076cfa717317d151ca595c5e37198 |
TransformerDecoderLayer | import torch
from torch import Tensor
from typing import Optional
from torch import nn
def _get_activation_fn(activation: 'str'):
if activation == 'relu':
return nn.functional.relu
elif activation == 'gelu':
return nn.functional.gelu
raise RuntimeError('activation should be relu/gelu, not ... | 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.... | YiwenShaoStephen/snowfall | TransformerDecoderLayer | false | 14,700 | [
"Apache-2.0"
] | 145 | 949226f35b29c629cb03cae36fa43da5993d27a3 | https://github.com/YiwenShaoStephen/snowfall/tree/949226f35b29c629cb03cae36fa43da5993d27a3 |
l2_norm_layer | import torch
import torch.nn as nn
class l2_norm_layer(nn.Module):
def __init__(self):
super(l2_norm_layer, self).__init__()
def forward(self, x):
"""
:param x: B x D
:return:
"""
norm_x = torch.sqrt((x ** 2).sum(1) + 1e-10)
return x / norm_x[:, None]... | 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_... | YunzhuLi/CompositionalKoopmanOperators | l2_norm_layer | false | 14,701 | [
"MIT"
] | 56 | 116057b11192bb2fbea2b9af411cddcee354dae8 | https://github.com/YunzhuLi/CompositionalKoopmanOperators/tree/116057b11192bb2fbea2b9af411cddcee354dae8 |
Net1 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.parallel
import torch.optim
class Net1(nn.Module):
def __init__(self):
super(Net1, self).__init__()
self.conv1 = nn.Conv2d(1, 32, 3, 1)
self.conv2... | 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 ... | Yixiao99/deep-learning-containers | Net1 | false | 14,702 | [
"Apache-2.0"
] | 383 | 01f078adf5abfb92e802b326511981bdd4a8c85c | https://github.com/Yixiao99/deep-learning-containers/tree/01f078adf5abfb92e802b326511981bdd4a8c85c |
ScaledDotProductAttention | import torch
import torch.nn as nn
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_dropout)
self.softmax = nn.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.... | YuxiXie/Semantic-Graphs-for-Generating-Deep-Questions | ScaledDotProductAttention | false | 14,703 | [
"MIT"
] | 62 | 6e5ef241c64b5b30a6ff54ddad31e610013b8388 | https://github.com/YuxiXie/Semantic-Graphs-for-Generating-Deep-Questions/tree/6e5ef241c64b5b30a6ff54ddad31e610013b8388 |
TransformerEncoderLayer | import torch
from torch import Tensor
from typing import Optional
from torch import nn
def _get_activation_fn(activation: 'str'):
if activation == 'relu':
return nn.functional.relu
elif activation == 'gelu':
return nn.functional.gelu
raise RuntimeError('activation should be relu/gelu, not ... | 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.... | YiwenShaoStephen/snowfall | TransformerEncoderLayer | false | 14,704 | [
"Apache-2.0"
] | 145 | 949226f35b29c629cb03cae36fa43da5993d27a3 | https://github.com/YiwenShaoStephen/snowfall/tree/949226f35b29c629cb03cae36fa43da5993d27a3 |
SCAttention | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
class BasicAtt(nn.Module):
def __init__(self, mid_dims: 'list', mid_dropout: 'float'):
super(BasicAtt, self).__init__()
sequential = []
for i in range(1, len(mid_dims) - 1):
sequential.a... | 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.... | YehLi/xmodaler | SCAttention | false | 14,705 | [
"Apache-2.0"
] | 830 | 5340054398c076cfa717317d151ca595c5e37198 | https://github.com/YehLi/xmodaler/tree/5340054398c076cfa717317d151ca595c5e37198 |
FlawDetectorCriterion | import torch
import torch.nn as nn
import torch.nn.functional as F
class FlawDetectorCriterion(nn.Module):
""" Criterion of the flaw detector.
"""
def __init__(self):
super(FlawDetectorCriterion, self).__init__()
def forward(self, pred, gt, is_ssl=False, reduction=True):
loss = F.mse... | 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... | ZHKKKe/PixelSSL | FlawDetectorCriterion | false | 14,706 | [
"Apache-2.0"
] | 223 | ce192034355ae6a77e47d2983d9c9242df60802a | https://github.com/ZHKKKe/PixelSSL/tree/ce192034355ae6a77e47d2983d9c9242df60802a |
MultiHeadAttention | import torch
import numpy as np
import torch.utils.data
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
"""
Scaled dot-product attention
"""
def __init__(self, *, d_model: int, d_k: int, d_v: int, h: int):
"""
:param d_model: Output dimensionality of the model
... | 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.... | YehLi/xmodaler | MultiHeadAttention | false | 14,707 | [
"Apache-2.0"
] | 830 | 5340054398c076cfa717317d151ca595c5e37198 | https://github.com/YehLi/xmodaler/tree/5340054398c076cfa717317d151ca595c5e37198 |
MultiHeadAttentionMemory | import torch
import numpy as np
import torch.utils.data
import torch.nn as nn
class ScaledDotProductAttentionMemory(nn.Module):
"""
Scaled dot-product attention with memory
"""
def __init__(self, *, d_model: int, d_k: int, d_v: int, h: int, m: int):
"""
:param d_model: Output dimensio... | 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.... | YehLi/xmodaler | MultiHeadAttentionMemory | false | 14,708 | [
"Apache-2.0"
] | 830 | 5340054398c076cfa717317d151ca595c5e37198 | https://github.com/YehLi/xmodaler/tree/5340054398c076cfa717317d151ca595c5e37198 |
Generator | import torch
import torch.nn as nn
import torch.cuda
class Generator(nn.Module):
def __init__(self, hidden_size: 'int', tgt_vocab_size: 'int'):
self.vocab_size = tgt_vocab_size
super(Generator, self).__init__()
self.linear_hidden = nn.Linear(hidden_size, tgt_vocab_size)
self.lsm =... | 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.... | YuxueShi/transformerNMT | Generator | false | 14,709 | [
"BSD-3-Clause"
] | 68 | 4ec660aa46f5edfeb5db749c73776d50c02c9324 | https://github.com/YuxueShi/transformerNMT/tree/4ec660aa46f5edfeb5db749c73776d50c02c9324 |
DecInit | import torch
import torch.nn as nn
class DecInit(nn.Module):
def __init__(self, d_enc, d_dec, n_enc_layer):
self.d_enc_model = d_enc
self.n_enc_layer = n_enc_layer
self.d_dec_model = d_dec
super(DecInit, self).__init__()
self.initer = nn.Linear(self.d_enc_model * self.n_en... | 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 ... | YuxiXie/Semantic-Graphs-for-Generating-Deep-Questions | DecInit | false | 14,710 | [
"MIT"
] | 62 | 6e5ef241c64b5b30a6ff54ddad31e610013b8388 | https://github.com/YuxiXie/Semantic-Graphs-for-Generating-Deep-Questions/tree/6e5ef241c64b5b30a6ff54ddad31e610013b8388 |
NLayerNorm | import torch
from torch import Tensor
import torch.nn as nn
from torch.nn import Parameter
class NLayerNorm(nn.Module):
def __init__(self, n_features: 'int', d: 'int') ->None:
super().__init__()
self.weight = Parameter(torch.ones(n_features, d))
self.bias = Parameter(torch.zeros(n_feature... | 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... | Yura52/tabular-dl-num-embeddings | NLayerNorm | false | 14,711 | [
"MIT"
] | 57 | e49e95c52f829ad0ab7d653e0776c2a84c03e261 | https://github.com/Yura52/tabular-dl-num-embeddings/tree/e49e95c52f829ad0ab7d653e0776c2a84c03e261 |
PositionwiseFeedForward | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.functional as F
class PositionwiseFeedForward(nn.Module):
""" A two-feed-forward-layer module """
def __init__(self, d_in, d_hid, dropout=0.1):
super().__init__()
self.onelayer = d_hid == d_in
if self.onel... | 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 ... | YuxiXie/Semantic-Graphs-for-Generating-Deep-Questions | PositionwiseFeedForward | false | 14,712 | [
"MIT"
] | 62 | 6e5ef241c64b5b30a6ff54ddad31e610013b8388 | https://github.com/YuxiXie/Semantic-Graphs-for-Generating-Deep-Questions/tree/6e5ef241c64b5b30a6ff54ddad31e610013b8388 |
NLinear | import torch
from torch import Tensor
import torch.nn as nn
from torch.nn import Parameter
class NLinear(nn.Module):
def __init__(self, n: 'int', d_in: 'int', d_out: 'int', bias: 'bool'=True
) ->None:
super().__init__()
self.weight = Parameter(Tensor(n, d_in, d_out))
self.bias = P... | 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 Tensor
import torch.nn as nn
from torch.nn import Parameter
assert_size_stride = torch._C._dynamo.guards.assert_size_strid... | Yura52/tabular-dl-num-embeddings | NLinear | false | 14,713 | [
"MIT"
] | 57 | e49e95c52f829ad0ab7d653e0776c2a84c03e261 | https://github.com/Yura52/tabular-dl-num-embeddings/tree/e49e95c52f829ad0ab7d653e0776c2a84c03e261 |
_leaky_relu | import torch
from torch import nn
import torch.optim
import torch.utils.data
class _leaky_relu(nn.Module):
def __init__(self):
super(_leaky_relu, self).__init__()
def forward(self, x):
x_neg = 0.1 * x
return torch.max(x_neg, x)
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 import nn
import torch.optim
import torch.utils.data
assert_size_stride = torc... | ZephyrII/competitive_colaboration | _leaky_relu | false | 14,714 | [
"MIT"
] | 357 | a557d1e23ef2c0b8e3794f085a79bfffb860f9df | https://github.com/ZephyrII/competitive_colaboration/tree/a557d1e23ef2c0b8e3794f085a79bfffb860f9df |
Attention | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
def sequence_mask(lengths, max_len=None):
"""
Creates a boolean mask from sequence lengths.
"""
batch_size = lengths.numel()
max_len = max_len or lengths.max()
return torch.arange(0, max_len).type_a... | 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.... | ZfSangkuan/ASER | Attention | false | 14,715 | [
"MIT"
] | 256 | c34d6f2432b181bae9f4ee4fa70ce270dbc1dee7 | https://github.com/ZfSangkuan/ASER/tree/c34d6f2432b181bae9f4ee4fa70ce270dbc1dee7 |
GraphAttention | import torch
import torch.nn as nn
class GraphAttention(nn.Module):
def __init__(self, d_q, d_v, alpha, dropout=0.1):
super(GraphAttention, self).__init__()
self.dropout = nn.Dropout(dropout)
self.attention = nn.Linear(d_q + d_v, 1)
self.leaky_relu = nn.LeakyReLU(alpha)
def 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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | YuxiXie/Semantic-Graphs-for-Generating-Deep-Questions | GraphAttention | false | 14,716 | [
"MIT"
] | 62 | 6e5ef241c64b5b30a6ff54ddad31e610013b8388 | https://github.com/YuxiXie/Semantic-Graphs-for-Generating-Deep-Questions/tree/6e5ef241c64b5b30a6ff54ddad31e610013b8388 |
FCDiscriminatorCriterion | import torch
import torch.nn as nn
import torch.nn.functional as F
class FCDiscriminatorCriterion(nn.Module):
def __init__(self):
super(FCDiscriminatorCriterion, self).__init__()
def forward(self, pred, gt):
loss = F.binary_cross_entropy_with_logits(pred, gt, reduction='none')
return... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | ZHKKKe/PixelSSL | FCDiscriminatorCriterion | false | 14,717 | [
"Apache-2.0"
] | 223 | ce192034355ae6a77e47d2983d9c9242df60802a | https://github.com/ZHKKKe/PixelSSL/tree/ce192034355ae6a77e47d2983d9c9242df60802a |
Generator | import torch
import torch.nn as nn
import torch.cuda
class Generator(nn.Module):
def __init__(self, hidden_size: 'int', tgt_vocab_size: 'int'):
self.vocab_size = tgt_vocab_size
super(Generator, self).__init__()
self.linear_hidden = nn.Linear(hidden_size, tgt_vocab_size)
self.lsm =... | 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.... | ZNLP/ATSum | Generator | false | 14,718 | [
"BSD-3-Clause"
] | 73 | 02e92489ebfa4652a4f3354c578f3a64c34ff64b | https://github.com/ZNLP/ATSum/tree/02e92489ebfa4652a4f3354c578f3a64c34ff64b |
BasicBlock | import torch
from torch import nn
import torch.optim
import torch.utils.data
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)
class BasicBlock(nn.Module):
expansion = 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 import nn
import t... | ZephyrII/competitive_colaboration | BasicBlock | false | 14,719 | [
"MIT"
] | 357 | a557d1e23ef2c0b8e3794f085a79bfffb860f9df | https://github.com/ZephyrII/competitive_colaboration/tree/a557d1e23ef2c0b8e3794f085a79bfffb860f9df |
AttnScore | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
def sequence_mask(lengths, max_len=None):
"""
Creates a boolean mask from sequence lengths.
"""
batch_size = lengths.numel()
max_len = max_len or lengths.max()
return torch.arange(0, max_len).type_a... | 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.... | ZfSangkuan/ASER | AttnScore | false | 14,720 | [
"MIT"
] | 256 | c34d6f2432b181bae9f4ee4fa70ce270dbc1dee7 | https://github.com/ZfSangkuan/ASER/tree/c34d6f2432b181bae9f4ee4fa70ce270dbc1dee7 |
FixedSubnetConv | import math
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
import torch.nn.functional as F
class FixedSubnetConv(nn.Conv2d):
def __init__(self, *args, **kwargs):
super().__init__(*args... | 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.multiprocessing
import torch.nn as nn
import torch.nn.p... | ZeroEi8ht/hidden-networks | FixedSubnetConv | false | 14,721 | [
"Apache-2.0"
] | 132 | ebe13e71d2f60356ee473cd3cff3e14b69d13d70 | https://github.com/ZeroEi8ht/hidden-networks/tree/ebe13e71d2f60356ee473cd3cff3e14b69d13d70 |
GeneralizedMeanPooling | import torch
from torch import Tensor
import torch.nn as nn
from torch.functional import Tensor
import torch.nn.functional as F
from torch import Tensor
from torch.nn.parameter import Parameter
def gem(x: 'Tensor', p: 'Parameter', eps: 'float'=1e-06, clamp=True) ->Tensor:
if clamp:
x = x.clamp(min=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 import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch ... | YuxinZou/mmclassification | GeneralizedMeanPooling | false | 14,722 | [
"Apache-2.0"
] | 1,190 | 2037260ea6c98a3b115e97727e1151a1c2c32f7a | https://github.com/YuxinZou/mmclassification/tree/2037260ea6c98a3b115e97727e1151a1c2c32f7a |
NN | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class NN(nn.Module):
def __init__(self, input_size, num_classes):
super(NN, self).__init__()
self.fc1 = nn.Linear(input_size, 50)
self.fc2 = nn.Linear(50, num_classes)
def forward(self, x):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | ZonePG/Machine-Learning-Collection | NN | false | 14,723 | [
"MIT"
] | 3,094 | 85f1e761fab85b61d4dbd44285d6483b75ba649c | https://github.com/ZonePG/Machine-Learning-Collection/tree/85f1e761fab85b61d4dbd44285d6483b75ba649c |
TripletMarginCosineLoss | from torch.nn import Module
import torch
from torch.nn.functional import cosine_similarity
def triplet_margin_cosine_loss(anchor, positive, negative, margin=1.0, eps=
1e-08, sum_loss=False):
'Creates a criterion that measures the triplet cosine loss given input\n tensors x1, x2, x3 and a margin with a valu... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch.nn import Module
... | ZhangShiyue/oposum | TripletMarginCosineLoss | false | 14,724 | [
"Apache-2.0"
] | 97 | 5aefea20c5c0846b4cf09a5b4643ffb0b2ff39d8 | https://github.com/ZhangShiyue/oposum/tree/5aefea20c5c0846b4cf09a5b4643ffb0b2ff39d8 |
InstanceLoss | import torch
import torch.nn as nn
import torch.nn.init
class InstanceLoss(nn.Module):
"""
Compute instance loss
"""
def __init__(self):
super(InstanceLoss, self).__init__()
self.loss = nn.CrossEntropyLoss()
def forward(self, img_cls, txt_cls, labels):
cost_im = self.loss... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | ZihaoWang-233/CAMP_iccv19 | InstanceLoss | false | 14,725 | [
"Apache-2.0"
] | 116 | b0ec07908f479e76f7ebddbcfb2199790305240a | https://github.com/ZihaoWang-233/CAMP_iccv19/tree/b0ec07908f479e76f7ebddbcfb2199790305240a |
TemporalPooling | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch
class TemporalPooling(nn.Module):
def __init__(self, frames, kernel_size=3, stride=2, mode='avg'):
"""
Parameters
----------
fra... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch
a... | ZijiaLewisLu/action-recognition-pytorch | TemporalPooling | false | 14,726 | [
"Apache-2.0"
] | 149 | 6ee04ed249081eb0d8e1b4a3e7a5c11fa65b8d70 | https://github.com/ZijiaLewisLu/action-recognition-pytorch/tree/6ee04ed249081eb0d8e1b4a3e7a5c11fa65b8d70 |
WSConv2d | import torch
import torch.nn as nn
import torch.utils.data
class WSConv2d(nn.Module):
"""
Weight scaled Conv2d (Equalized Learning Rate)
Note that input is multiplied rather than changing weights
this will have the same result.
Inspired by:
https://github.com/nvnbny/progressive_growing_of_gan... | 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.data
assert_size_stride = torch._C._dyn... | ZonePG/Machine-Learning-Collection | WSConv2d | false | 14,727 | [
"MIT"
] | 3,094 | 85f1e761fab85b61d4dbd44285d6483b75ba649c | https://github.com/ZonePG/Machine-Learning-Collection/tree/85f1e761fab85b61d4dbd44285d6483b75ba649c |
PositionwiseFeedForward | import torch
import torch.nn as nn
class LayerNorm(nn.Module):
"""
Layer Normalization class
"""
def __init__(self, features, eps=1e-06):
super(LayerNorm, self).__init__()
self.a_2 = nn.Parameter(torch.ones(features))
self.b_2 = nn.Parameter(torch.zeros(features))
... | 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.... | ZfSangkuan/ASER | PositionwiseFeedForward | false | 14,728 | [
"MIT"
] | 256 | c34d6f2432b181bae9f4ee4fa70ce270dbc1dee7 | https://github.com/ZfSangkuan/ASER/tree/c34d6f2432b181bae9f4ee4fa70ce270dbc1dee7 |
NonLocal2D | import math
import torch
import torch.utils.data
from torch import nn
from torch.nn.modules.utils import _pair
def get_group_gn(dim, dim_per_gp, num_groups):
"""get number of groups used by GroupNorm, based on number of channels."""
assert dim_per_gp == -1 or num_groups == -1, 'GroupNorm: can only specify G 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
from torch._inductor.runtime.... | Yuliang-Liu/bezier_curve_text_spotting | NonLocal2D | false | 14,729 | [
"BSD-2-Clause"
] | 423 | 8986ff0eb7f9ccd5943cc46191bded2affdfe61f | https://github.com/Yuliang-Liu/bezier_curve_text_spotting/tree/8986ff0eb7f9ccd5943cc46191bded2affdfe61f |
ExampleTorchModule | import torch
class ExampleTorchModule(torch.nn.Module):
def __init__(self):
super(ExampleTorchModule, self).__init__()
def forward(self, input):
residual = 10 - input
return residual
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... | abhigoudar/ceres_python_bindings | ExampleTorchModule | false | 14,730 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 86 | 2106d043bce37adcfef450dd23d3005480948c37 | https://github.com/abhigoudar/ceres_python_bindings/tree/2106d043bce37adcfef450dd23d3005480948c37 |
GeLU | import torch
import numpy as np
import torch.nn as nn
def gelu(x):
"""Implementation of the gelu activation function.
For information: OpenAI GPT's gelu is slightly different (and gives slightly different results):
0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3))... | 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.... | abhipsabasu/rubi.bootstrap.pytorch | GeLU | false | 14,731 | [
"BSD-3-Clause"
] | 83 | 9fa9639c1ee4a040958d976eeb5dca2dd2203980 | https://github.com/abhipsabasu/rubi.bootstrap.pytorch/tree/9fa9639c1ee4a040958d976eeb5dca2dd2203980 |
AsymmetricLossOptimized | import torch
import torch.nn as nn
import torch.nn.parallel
class AsymmetricLossOptimized(nn.Module):
""" Notice - optimized version, minimizes memory allocation and gpu uploading,
favors inplace operations"""
def __init__(self, gamma_neg=4, gamma_pos=1, clip=0.05, eps=1e-08,
disable_torch_grad_f... | 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... | aangelopoulos/rcps | AsymmetricLossOptimized | false | 14,732 | [
"MIT"
] | 52 | b400457f7cc7261d1ed610cdf7aa2230de657c57 | https://github.com/aangelopoulos/rcps/tree/b400457f7cc7261d1ed610cdf7aa2230de657c57 |
SEModule | import torch
import torch.nn as nn
import torch.nn.parallel
class FastAvgPool2d(nn.Module):
def __init__(self, flatten=False):
super(FastAvgPool2d, self).__init__()
self.flatten = flatten
def forward(self, x):
if self.flatten:
in_size = x.size()
return x.view(... | 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 ... | aangelopoulos/rcps | SEModule | false | 14,733 | [
"MIT"
] | 52 | b400457f7cc7261d1ed610cdf7aa2230de657c57 | https://github.com/aangelopoulos/rcps/tree/b400457f7cc7261d1ed610cdf7aa2230de657c57 |
SelfAttention | import torch
import torch.nn as nn
import torch.utils.data
class SelfAttention(nn.Module):
def __init__(self, embed_size, heads):
super(SelfAttention, self).__init__()
self.embed_size = embed_size
self.heads = heads
self.head_dim = embed_size // heads
assert self.head_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.... | ZonePG/Machine-Learning-Collection | SelfAttention | false | 14,734 | [
"MIT"
] | 3,094 | 85f1e761fab85b61d4dbd44285d6483b75ba649c | https://github.com/ZonePG/Machine-Learning-Collection/tree/85f1e761fab85b61d4dbd44285d6483b75ba649c |
ConvBlock | import torch
import torch.nn as nn
import torch.utils.data
class WSConv2d(nn.Module):
"""
Weight scaled Conv2d (Equalized Learning Rate)
Note that input is multiplied rather than changing weights
this will have the same result.
Inspired by:
https://github.com/nvnbny/progressive_growing_of_gan... | 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 ... | ZonePG/Machine-Learning-Collection | ConvBlock | false | 14,735 | [
"MIT"
] | 3,094 | 85f1e761fab85b61d4dbd44285d6483b75ba649c | https://github.com/ZonePG/Machine-Learning-Collection/tree/85f1e761fab85b61d4dbd44285d6483b75ba649c |
SpatialAttention | import torch
import torch.nn as nn
class SpatialAttention(nn.Module):
def __init__(self, kernel_size=7):
super(SpatialAttention, self).__init__()
assert kernel_size in (3, 7), 'kernel size must be 3 or 7'
padding = 3 if kernel_size == 7 else 1
self.conv1 = nn.Conv2d(1, 1, kernel_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
import torch.nn as nn
assert_... | abandonsea/BBS-Net | SpatialAttention | false | 14,736 | [
"MIT"
] | 66 | fd4e60bf3025d0cec745c0594b7104c5746f6d0f | https://github.com/abandonsea/BBS-Net/tree/fd4e60bf3025d0cec745c0594b7104c5746f6d0f |
SpatialAttention | import torch
from torch import nn
class SpatialAttention(nn.Module):
def __init__(self, kernel=3):
super(SpatialAttention, self).__init__()
self.conv1 = nn.Conv2d(2, 1, kernel_size=kernel, padding=kernel //
2, bias=False)
self.sigmoid = nn.Sigmoid()
def forward(self, x):... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | abhirajasp/CDCN | SpatialAttention | false | 14,737 | [
"MIT"
] | 463 | c9863775b1c1bffd91f956b5b2c6c78abfc988ec | https://github.com/abhirajasp/CDCN/tree/c9863775b1c1bffd91f956b5b2c6c78abfc988ec |
AddReadout | import torch
import torch.nn as nn
class AddReadout(nn.Module):
"""Handles readout operation when `readout` parameter is `add`. Removes `cls_token` or `readout_token` from tensor and adds it to the rest of tensor"""
def __init__(self, start_index=1):
super(AddReadout, self).__init__()
self.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... | aditya-agrawal-30502/vformer | AddReadout | false | 14,738 | [
"MIT"
] | 90 | e1f4950f980238442ff1dc39a8f0791e4fbc9dac | https://github.com/aditya-agrawal-30502/vformer/tree/e1f4950f980238442ff1dc39a8f0791e4fbc9dac |
TAM | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch
import torch.nn.functional as F
class SEModule(nn.Module):
def __init__(self, channels, dw_conv):
super().__init__()
ks = 1
pad = (ks - 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 ... | ZijiaLewisLu/action-recognition-pytorch | TAM | false | 14,739 | [
"Apache-2.0"
] | 149 | 6ee04ed249081eb0d8e1b4a3e7a5c11fa65b8d70 | https://github.com/ZijiaLewisLu/action-recognition-pytorch/tree/6ee04ed249081eb0d8e1b4a3e7a5c11fa65b8d70 |
GatedBlock | import torch
import torch.nn as nn
class GatedBlock(nn.Module):
def __init__(self, dilation: 'int', w_dim: 'int'):
"""Gated block with sigmoid/tanh gates."""
super().__init__()
self.dilation = dilation
self.tanh_conv = nn.Conv2d(w_dim, w_dim, kernel_size=(2, 1),
dilati... | 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 ... | Zymrael/wattnet-fx-trading | GatedBlock | false | 14,740 | [
"MIT"
] | 69 | b4babf21e6156df3ec0002ee45db118e1de24f1f | https://github.com/Zymrael/wattnet-fx-trading/tree/b4babf21e6156df3ec0002ee45db118e1de24f1f |
MLP | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
def gelu(x):
return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 *
torch.pow(x, 3))))
class Conv1D(nn.Module):
def __init__(self, nf, nx):
... | 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
import ... | adi0229/gpt-2-flask-api | MLP | false | 14,741 | [
"MIT"
] | 47 | 274d836ede9400566777893cea8662e61bbd5d8c | https://github.com/adi0229/gpt-2-flask-api/tree/274d836ede9400566777893cea8662e61bbd5d8c |
PositionwiseFeedForward | import torch
import torch.nn as nn
import torch.nn.functional as F
class PositionwiseFeedForward(nn.Module):
"""
Implements FFN equation (1-D convolution).
"""
def __init__(self, n_hid, dropout=0.1):
super(PositionwiseFeedForward, self).__init__()
self.w_1 = nn.Linear(n_hid, n_hid... | 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_... | acbull/HiCE | PositionwiseFeedForward | false | 14,742 | [
"MIT"
] | 58 | 0a7e3035bc6e1e2ea5d08b0f1fb68656f75df62f | https://github.com/acbull/HiCE/tree/0a7e3035bc6e1e2ea5d08b0f1fb68656f75df62f |
PositionalAttention | import torch
import torch.nn as nn
class PositionalAttention(nn.Module):
"""
A simple positional attention layer that assigns different weights for word in different relative position.
"""
def __init__(self, n_seq):
super(PositionalAttention, self).__init__()
self.pos_att = nn.Par... | 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... | acbull/HiCE | PositionalAttention | false | 14,743 | [
"MIT"
] | 58 | 0a7e3035bc6e1e2ea5d08b0f1fb68656f75df62f | https://github.com/acbull/HiCE/tree/0a7e3035bc6e1e2ea5d08b0f1fb68656f75df62f |
AttentionMatrix | import torch
from torch import nn
class AttentionMatrix(nn.Module):
"""
Attention Matrix (unnormalized)
"""
def __init__(self, hidden_size):
"""
Create a module for attention matrices. The input is a pair of
matrices, the output is a matrix containing similarity scores between... | 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... | abhinonymous/MSMARCO-Question-Answering | AttentionMatrix | false | 14,744 | [
"MIT"
] | 127 | bfdd802d20b63322adca23f1da1f6a5931593920 | https://github.com/abhinonymous/MSMARCO-Question-Answering/tree/bfdd802d20b63322adca23f1da1f6a5931593920 |
KLLoss | import torch
import torch.nn.functional as F
from torch import nn
class KLLoss(nn.Module):
"""Loss that uses a 'hinge' on the lower bound.
This means that for samples with a label value smaller than the threshold, the loss is zero if the prediction is
also smaller than that threshold.
args:
er... | 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 ... | abhisheklalwani/ActionCLIP | KLLoss | false | 14,745 | [
"MIT"
] | 141 | dd2ab27db4bf3d5be3a51cd011cb49aa8b679de0 | https://github.com/abhisheklalwani/ActionCLIP/tree/dd2ab27db4bf3d5be3a51cd011cb49aa8b679de0 |
Highway | import torch
from torch import nn
class Highway(nn.Module):
"""
Individual highway layer
"""
def __init__(self, input_dim, activation_class=nn.ReLU):
"""
Create a highway layer. The input is a tensor of features, the output
is a tensor with the same dimension.
With 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 import nn
assert_s... | abhinonymous/MSMARCO-Question-Answering | Highway | false | 14,746 | [
"MIT"
] | 127 | bfdd802d20b63322adca23f1da1f6a5931593920 | https://github.com/abhinonymous/MSMARCO-Question-Answering/tree/bfdd802d20b63322adca23f1da1f6a5931593920 |
PatchEmbedding | import torch
import torch.nn as nn
def pair(t):
"""
Parameters
----------
t: tuple[int] or int
"""
return t if isinstance(t, tuple) else (t, t)
class PatchEmbedding(nn.Module):
"""
Parameters
----------
img_size: int
Image Size
patch_size: int
Patch 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
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | aditya-agrawal-30502/vformer | PatchEmbedding | false | 14,747 | [
"MIT"
] | 90 | e1f4950f980238442ff1dc39a8f0791e4fbc9dac | https://github.com/aditya-agrawal-30502/vformer/tree/e1f4950f980238442ff1dc39a8f0791e4fbc9dac |
BahdanauAttention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
import torch.optim
import torch.utils.data
import torch.utils.collect_env
import torch.nn.parallel
import torch.utils.data.distributed
class BahdanauAttention(nn.Module):
"""
Bahdanau Attent... | 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.... | aditbro/GNMTResearch | BahdanauAttention | false | 14,748 | [
"MIT"
] | 67 | 85cc739704b4647d98fac9f09fab6a3dcb92fe13 | https://github.com/aditbro/GNMTResearch/tree/85cc739704b4647d98fac9f09fab6a3dcb92fe13 |
BertPooler | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class BertPooler(nn.Module):
def __init__(self, config, recurs=None):
super(BertPooler, self).__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.activation = nn.Tanh()
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 ... | aeloyq/EasyTransfer | BertPooler | false | 14,749 | [
"Apache-2.0"
] | 806 | f02b1f40109c4031632f3c51bce1cf3d1e906e34 | https://github.com/aeloyq/EasyTransfer/tree/f02b1f40109c4031632f3c51bce1cf3d1e906e34 |
ClassificationModel | import torch
import torch.nn as nn
class ClassificationModel(nn.Module):
def __init__(self, num_features_in, num_anchors=9, num_classes=80,
prior=0.01, feature_size=256):
super(ClassificationModel, self).__init__()
self.num_classes = num_classes
self.num_anchors = num_anchors
... | 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_... | abhi1kumar/AP-loss | ClassificationModel | false | 14,750 | [
"MIT"
] | 158 | 87f51b212761ef233422dbaaf799444fb453a10e | https://github.com/abhi1kumar/AP-loss/tree/87f51b212761ef233422dbaaf799444fb453a10e |
US | import torch
from torch import nn as nn
from torch.nn import functional as F
from torch.nn import init as init
from torch.utils import data as data
import torch.onnx
class US(nn.Module):
"""Up-sampling block
"""
def __init__(self, num_feat, scale):
super(US, self).__init__()
self.scale = ... | 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
from torch.nn import init as init
from torch.utils im... | aesrgan/A-ESRGAN | US | false | 14,751 | [
"BSD-3-Clause"
] | 58 | e1a71deb4a47e332cad6b3d6bbbbb21a56bdd9c6 | https://github.com/aesrgan/A-ESRGAN/tree/e1a71deb4a47e332cad6b3d6bbbbb21a56bdd9c6 |
CrossAttentionBlock | import torch
import torch.nn as nn
import torch.hub
class CrossAttention(nn.Module):
def __init__(self, dim, num_heads=8, qkv_bias=False, qk_scale=None,
attn_drop=0.0, proj_drop=0.0):
super().__init__()
self.num_heads = num_heads
head_dim = dim // num_heads
self.scale = qk... | 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.... | abhrac/CrossViT | CrossAttentionBlock | false | 14,752 | [
"Apache-2.0"
] | 93 | 97a1414ec182c09609ebe141ff6acc350cc352e5 | https://github.com/abhrac/CrossViT/tree/97a1414ec182c09609ebe141ff6acc350cc352e5 |
Highway | import torch
class BaseModule(torch.nn.Module):
def __init__(self):
super(BaseModule, self).__init__()
@property
def nparams(self):
return sum(p.numel() for p in self.parameters() if p.requires_grad)
class Highway(BaseModule):
"""
Implementation as described
in https://arxi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C... | aflorithmic/DurIAN | Highway | false | 14,753 | [
"BSD-3-Clause"
] | 158 | a708e9c5bb89895ddf08ca1a13bc8fd683b1e23f | https://github.com/aflorithmic/DurIAN/tree/a708e9c5bb89895ddf08ca1a13bc8fd683b1e23f |
RPA | import torch
from torch import nn as nn
from torch.nn import init as init
from torch.utils import data as data
import torch.onnx
class RPA(nn.Module):
"""Residual pixel-attention block
"""
def __init__(self, num_feat):
super(RPA, self).__init__()
self.conv1 = nn.Conv2d(num_feat, num_feat ... | 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
from torch.nn import init as init
from torch.utils im... | aesrgan/A-ESRGAN | RPA | false | 14,754 | [
"BSD-3-Clause"
] | 58 | e1a71deb4a47e332cad6b3d6bbbbb21a56bdd9c6 | https://github.com/aesrgan/A-ESRGAN/tree/e1a71deb4a47e332cad6b3d6bbbbb21a56bdd9c6 |
BertSelfAttention | 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.... | aeloyq/EasyTransfer | BertSelfAttention | false | 14,755 | [
"Apache-2.0"
] | 806 | f02b1f40109c4031632f3c51bce1cf3d1e906e34 | https://github.com/aeloyq/EasyTransfer/tree/f02b1f40109c4031632f3c51bce1cf3d1e906e34 |
CRF_S | import torch
import torch.nn as nn
import torch.nn.init
class CRF_S(nn.Module):
"""Conditional Random Field (CRF) layer. This version is used in Lample et al. 2016, has less parameters than CRF_L.
args:
hidden_dim: input dim size
tagset_size: target_set_size
if_biase: whether allow 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.nn.init
assert_size_stride = torch._C._dynamo... | ahmadshabbir2468/LM-LSTM-CRF | CRF_S | false | 14,756 | [
"Apache-2.0"
] | 877 | 99f157590b9efdcecff03d3cdd3a4500cd715ece | https://github.com/ahmadshabbir2468/LM-LSTM-CRF/tree/99f157590b9efdcecff03d3cdd3a4500cd715ece |
HeatmapLoss | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
import torch.multiprocessing
class HeatmapLoss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, pred, gt, mask):
assert pred.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
import torch.nn as nn
import torch.utils.data
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
import torch.m... | ahmedelmahy/HRNet-Bottom-Up-Pose-Estimation | HeatmapLoss | false | 14,757 | [
"MIT"
] | 129 | cf5831249999f0b307d5aa948ebdcdef981ba68f | https://github.com/ahmedelmahy/HRNet-Bottom-Up-Pose-Estimation/tree/cf5831249999f0b307d5aa948ebdcdef981ba68f |
BCEDiceLoss | import torch
from torch import nn
class BCEDiceLoss(nn.Module):
def __init__(self, weight=None, size_average=True):
super().__init__()
def forward(self, input, target):
pred = input.view(-1)
truth = target.view(-1)
bce_loss = nn.BCELoss()(pred, truth).double()
dice_co... | 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 ... | afperezm/road_building_extraction | BCEDiceLoss | false | 14,758 | [
"MIT"
] | 76 | e07458fcb36318ec93fc23feb764136cf0a0bffe | https://github.com/afperezm/road_building_extraction/tree/e07458fcb36318ec93fc23feb764136cf0a0bffe |
ShakeResNet | import math
import torch
from torch import nn
from numpy import int64 as int64
import torch.nn.functional as F
from torch.autograd import Variable
class ShakeShake(torch.autograd.Function):
@staticmethod
def forward(ctx, x1, x2, training=True):
if training:
alpha = torch.FloatTensor(x1.si... | 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 import... | aierh/autoML | ShakeResNet | false | 14,759 | [
"MIT"
] | 185 | 8e31966edf6de2c223d5eeb6cd4b4dbd6ddbbf77 | https://github.com/aierh/autoML/tree/8e31966edf6de2c223d5eeb6cd4b4dbd6ddbbf77 |
ResidualAttentionBlock | import torch
from collections import OrderedDict
from torch import nn
class LayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-12):
"""Construct a layernorm module in the TF style (epsilon inside the square root).
"""
super(LayerNorm, self).__init__()
self.weight = nn.Pa... | 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.... | abhisheklalwani/ActionCLIP | ResidualAttentionBlock | false | 14,760 | [
"MIT"
] | 141 | dd2ab27db4bf3d5be3a51cd011cb49aa8b679de0 | https://github.com/abhisheklalwani/ActionCLIP/tree/dd2ab27db4bf3d5be3a51cd011cb49aa8b679de0 |
ShakeResNeXt | import math
import torch
from torch import nn
from numpy import int64 as int64
import torch.nn.functional as F
from torch.autograd import Variable
class ShakeShake(torch.autograd.Function):
@staticmethod
def forward(ctx, x1, x2, training=True):
if training:
alpha = torch.FloatTensor(x1.si... | 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 import... | aierh/autoML | ShakeResNeXt | false | 14,761 | [
"MIT"
] | 185 | 8e31966edf6de2c223d5eeb6cd4b4dbd6ddbbf77 | https://github.com/aierh/autoML/tree/8e31966edf6de2c223d5eeb6cd4b4dbd6ddbbf77 |
PositionalEncoder | import torch
from torch import nn
class PositionalEncoder(nn.Module):
def __init__(self, d_model):
super().__init__()
self.d_model = d_model
def forward(self, xyz):
xyz1 = xyz.unsqueeze(1)
xyz2 = xyz.unsqueeze(0)
pairwise_dist = xyz1 - xyz2
return pairwise_dis... | 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... | aim-uofa/DyCo3D | PositionalEncoder | false | 14,762 | [
"BSD-2-Clause"
] | 100 | 17d22c2d839c0a1043fb72df301e3935af5ca0e9 | https://github.com/aim-uofa/DyCo3D/tree/17d22c2d839c0a1043fb72df301e3935af5ca0e9 |
Sparsemax | import torch
import torch.multiprocessing
import torch.nn as nn
class Sparsemax(nn.Module):
"""Sparsemax function."""
def __init__(self, dim=None):
"""Initialize sparsemax activation
Args:
dim (int, optional): The dimension over which to apply the sparsemax function.
... | 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
import torch.multiprocessing
import torch.nn as nn
assert_size_s... | ai4ce/DiscoNet | Sparsemax | false | 14,763 | [
"MIT"
] | 80 | 44b57faac3c5be289d33cbbab12b300e3ac767b0 | https://github.com/ai4ce/DiscoNet/tree/44b57faac3c5be289d33cbbab12b300e3ac767b0 |
PreNet | import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.data
class PreNet(nn.Module):
def __init__(self, in_dims, fc1_dims=256, fc2_dims=128, dropout=0.5):
super().__init__()
self.fc1 = nn.Linear(in_dims, fc1_dims)
self.fc2 = nn.Linear(fc1_dims, fc2_dims)
... | 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
import t... | airobotnews/cloneVoice | PreNet | false | 14,764 | [
"MIT"
] | 15,983 | 8ad9ba2b60aef57d6d7c83832f07c4f1173d493b | https://github.com/airobotnews/cloneVoice/tree/8ad9ba2b60aef57d6d7c83832f07c4f1173d493b |
BboxHead | import torch
import torch.nn as nn
from itertools import product as product
class BboxHead(nn.Module):
def __init__(self, inchannels=512, num_anchors=2):
super(BboxHead, self).__init__()
self.conv1x1 = nn.Conv2d(inchannels, num_anchors * 4, kernel_size=(
1, 1), stride=1, padding=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
import torch.nn as nn
from itertools import product as product
assert_size_strid... | ai18435136351/facenet-retinaface-pytorch | BboxHead | false | 14,765 | [
"MIT"
] | 48 | f228969e46d7402170b708798a210de552879d16 | https://github.com/ai18435136351/facenet-retinaface-pytorch/tree/f228969e46d7402170b708798a210de552879d16 |
SelfAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class SelfAttention(nn.Module):
"""SelfAttention class"""
def __init__(self, input_dim: 'int', da: 'int', r: 'int') ->None:
"""Instantiating SelfAttention class
Args:
input_dim (int): dimension of input, eg) (batc... | 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.... | aisolab/nlp_implementation | SelfAttention | false | 14,766 | [
"MIT"
] | 181 | 21ea6e3f5737e7074bdd8dd190e5f5172f86f6bf | https://github.com/aisolab/nlp_implementation/tree/21ea6e3f5737e7074bdd8dd190e5f5172f86f6bf |
ShuffleCatChunk | import torch
import torch.nn as nn
class ShuffleCatChunk(nn.Module):
def forward(self, a, b):
assert a.size() == b.size()
_n, c, _h, _w = a.size()
a = torch.chunk(a, chunks=c, dim=1)
b = torch.chunk(b, chunks=c, dim=1)
x = [None] * (c * 2)
x[::2] = a
x[1::2... | 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... | akaneko1019/yolact_edge | ShuffleCatChunk | false | 14,767 | [
"MIT"
] | 1,036 | a9a00281b33b3ac90253a4939773308a8f95e21d | https://github.com/akaneko1019/yolact_edge/tree/a9a00281b33b3ac90253a4939773308a8f95e21d |
ShuffleCatAlt | import torch
import torch.nn as nn
class ShuffleCatAlt(nn.Module):
def forward(self, a, b):
assert a.size() == b.size()
n, c, h, w = a.size()
x = torch.zeros(n, c * 2, h, w, dtype=a.dtype, device=a.device)
x[:, ::2] = a
x[:, 1::2] = b
return x
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 import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | akaneko1019/yolact_edge | ShuffleCatAlt | false | 14,768 | [
"MIT"
] | 1,036 | a9a00281b33b3ac90253a4939773308a8f95e21d | https://github.com/akaneko1019/yolact_edge/tree/a9a00281b33b3ac90253a4939773308a8f95e21d |
ShuffleCat | import torch
import torch.nn as nn
class ShuffleCat(nn.Module):
def forward(self, a, b):
assert a.size() == b.size()
n, c, h, w = a.size()
a = a.permute(0, 2, 3, 1).contiguous().view(-1, c)
b = b.permute(0, 2, 3, 1).contiguous().view(-1, c)
x = torch.cat((a, b), dim=0).tra... | 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... | akaneko1019/yolact_edge | ShuffleCat | false | 14,769 | [
"MIT"
] | 1,036 | a9a00281b33b3ac90253a4939773308a8f95e21d | https://github.com/akaneko1019/yolact_edge/tree/a9a00281b33b3ac90253a4939773308a8f95e21d |
ClassHead | import torch
import torch.nn as nn
from itertools import product as product
class ClassHead(nn.Module):
def __init__(self, inchannels=512, num_anchors=2):
super(ClassHead, self).__init__()
self.num_anchors = num_anchors
self.conv1x1 = nn.Conv2d(inchannels, self.num_anchors * 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
import torch.nn as nn
from itertools import product as product
assert_size_strid... | ai18435136351/facenet-retinaface-pytorch | ClassHead | false | 14,770 | [
"MIT"
] | 48 | f228969e46d7402170b708798a210de552879d16 | https://github.com/ai18435136351/facenet-retinaface-pytorch/tree/f228969e46d7402170b708798a210de552879d16 |
ConvNet | import torch
import torch.nn as nn
class ConvNet(nn.Module):
def __init__(self):
super(ConvNet, self).__init__()
self.conv1 = nn.Conv2d(in_channels=3, out_channels=32, kernel_size=
5, padding=2)
self.conv2 = nn.Conv2d(in_channels=32, out_channels=32, kernel_size
=3... | 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_... | agriyakhetarpal/dffml | ConvNet | false | 14,771 | [
"MIT"
] | 171 | f76f2ce94c3972634053377b00e7c16530f7f0a4 | https://github.com/agriyakhetarpal/dffml/tree/f76f2ce94c3972634053377b00e7c16530f7f0a4 |
MSELoss | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.onnx
def _reduce(x, reduction='elementwise_mean'):
if reduction == 'none':
return x
elif reduction == 'elementwise_mea... | 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... | akshayka/gavel | MSELoss | false | 14,772 | [
"MIT"
] | 67 | 40a22a725f2e70478483e98c9b07c6fc588e0c40 | https://github.com/akshayka/gavel/tree/40a22a725f2e70478483e98c9b07c6fc588e0c40 |
MaxOut | import torch
import torch.nn as nn
class MaxOut(nn.Module):
def __init__(self, input_size: 'int', hidden_size: 'int') ->None:
super(MaxOut, self).__init__()
self._ops_1 = nn.Linear(input_size, hidden_size)
self._ops_2 = nn.Linear(input_size, hidden_size)
def forward(self, x: 'torch.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 import triton_helpers
import torch.nn as nn
assert_... | aisolab/nlp_implementation | MaxOut | false | 14,773 | [
"MIT"
] | 181 | 21ea6e3f5737e7074bdd8dd190e5f5172f86f6bf | https://github.com/aisolab/nlp_implementation/tree/21ea6e3f5737e7074bdd8dd190e5f5172f86f6bf |
EncoderLayer | import math
import torch
from torch import nn
from torch.nn import 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, -10000000... | 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.... | aim-uofa/DyCo3D | EncoderLayer | false | 14,774 | [
"BSD-2-Clause"
] | 100 | 17d22c2d839c0a1043fb72df301e3935af5ca0e9 | https://github.com/aim-uofa/DyCo3D/tree/17d22c2d839c0a1043fb72df301e3935af5ca0e9 |
FCN8s | import torch
import numpy as np
import torch.nn as nn
def get_upsampling_weight(in_channels, out_channels, kernel_size):
"""Make a 2D bilinear kernel suitable for upsampling"""
factor = (kernel_size + 1) // 2
if kernel_size % 2 == 1:
center = factor - 1
else:
center = factor - 0.5
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
import tor... | MatthewKleinsmith/portrait-seg | FCN8s | false | 14,775 | [
"MIT"
] | 50 | 0dcdd5952c6d10aa103c4997556559173d922687 | https://github.com/MatthewKleinsmith/portrait-seg/tree/0dcdd5952c6d10aa103c4997556559173d922687 |
DecoderLayer | import math
import torch
from torch import nn
from torch.nn import 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, -10000000... | 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.... | aim-uofa/DyCo3D | DecoderLayer | false | 14,776 | [
"BSD-2-Clause"
] | 100 | 17d22c2d839c0a1043fb72df301e3935af5ca0e9 | https://github.com/aim-uofa/DyCo3D/tree/17d22c2d839c0a1043fb72df301e3935af5ca0e9 |
FeedForward | import torch
from torch import nn
from torch.nn import functional as F
class FeedForward(nn.Module):
def __init__(self, d_model, d_ff=64, dropout=0.1):
super().__init__()
self.linear_1 = nn.Linear(d_model, d_ff)
self.dropout = nn.Dropout(dropout)
self.linear_2 = nn.Linear(d_ff, d_... | 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... | aim-uofa/DyCo3D | FeedForward | false | 14,777 | [
"BSD-2-Clause"
] | 100 | 17d22c2d839c0a1043fb72df301e3935af5ca0e9 | https://github.com/aim-uofa/DyCo3D/tree/17d22c2d839c0a1043fb72df301e3935af5ca0e9 |
down_right_shifted_conv2d | import torch
import torch.nn as nn
from torch.nn.utils import weight_norm as wn
def right_shift(x, pad=None):
xs = [int(y) for y in x.size()]
x = x[:, :, :, :xs[3] - 1]
pad = nn.ZeroPad2d((1, 0, 0, 0)) if pad is None else pad
return pad(x)
class down_right_shifted_conv2d(nn.Module):
def __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
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | ajayjain/lmconv | down_right_shifted_conv2d | false | 14,778 | [
"MIT"
] | 69 | e00576de5118702c90493e88c6e459b0e45d1290 | https://github.com/ajayjain/lmconv/tree/e00576de5118702c90493e88c6e459b0e45d1290 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.