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 |
|---|---|---|---|---|---|---|---|---|---|---|
FocalLoss | import torch
import torch.nn as nn
class FocalLoss(nn.Module):
def __init__(self, gamma=0, eps=1e-07):
super(FocalLoss, self).__init__()
self.gamma = gamma
self.eps = eps
self.ce = torch.nn.CrossEntropyLoss()
def forward(self, input, target):
logp = self.ce(input, tar... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | BaoLocPham/hum2song | FocalLoss | false | 13,371 | [
"MIT"
] | 108 | 706b7fdf838944e2aabe0ae331c0867cb67f6fbc | https://github.com/BaoLocPham/hum2song/tree/706b7fdf838944e2aabe0ae331c0867cb67f6fbc |
Scale | import torch
import torch.nn as nn
class Scale(nn.Module):
"""
A learnable scale parameter
"""
def __init__(self, scale=1.0):
super(Scale, self).__init__()
self.scale = nn.Parameter(torch.tensor(scale, dtype=torch.float))
def forward(self, x):
return x * self.scale
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | BUPT-PRIV/BalancedGroupSoftmax | Scale | false | 13,372 | [
"Apache-2.0"
] | 333 | 90e04fd8ccecd2bc61bbe6053a741ae708da2794 | https://github.com/BUPT-PRIV/BalancedGroupSoftmax/tree/90e04fd8ccecd2bc61bbe6053a741ae708da2794 |
BalancedL1Loss | import functools
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Return:
Tenso... | 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 functools
impor... | BUPT-PRIV/BalancedGroupSoftmax | BalancedL1Loss | false | 13,373 | [
"Apache-2.0"
] | 333 | 90e04fd8ccecd2bc61bbe6053a741ae708da2794 | https://github.com/BUPT-PRIV/BalancedGroupSoftmax/tree/90e04fd8ccecd2bc61bbe6053a741ae708da2794 |
SmoothL1Loss | import functools
import torch
import torch.nn as nn
import torch.nn.functional as F
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Return:
Tensor: Reduced loss ten... | 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 functools
impor... | BUPT-PRIV/BalancedGroupSoftmax | SmoothL1Loss | false | 13,374 | [
"Apache-2.0"
] | 333 | 90e04fd8ccecd2bc61bbe6053a741ae708da2794 | https://github.com/BUPT-PRIV/BalancedGroupSoftmax/tree/90e04fd8ccecd2bc61bbe6053a741ae708da2794 |
SoftDiceLossSquared | import torch
import numpy as np
from torch import nn
import torch.nn.functional
def sum_tensor(inp, axes, keepdim=False):
axes = np.unique(axes).astype(int)
if keepdim:
for ax in axes:
inp = inp.sum(int(ax), keepdim=True)
else:
for ax in sorted(axes, reverse=True):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
from torch import nn
import torch.nn.functional
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_str... | BRAIN-Lab-UNC/BrainExtraction-TissueSegmentation-Macaque | SoftDiceLossSquared | false | 13,375 | [
"MIT"
] | 770 | b5329035d9e32c8a27151cf2396eaf209396a334 | https://github.com/BRAIN-Lab-UNC/BrainExtraction-TissueSegmentation-Macaque/tree/b5329035d9e32c8a27151cf2396eaf209396a334 |
PPMConcat | import torch
import torch.nn as nn
import torch._C
import torch.serialization
from torch import optim as optim
class PPMConcat(nn.ModuleList):
"""Pyramid Pooling Module that only concat the features of each layer.
Args:
pool_scales (tuple[int]): Pooling scales used in Pooling Pyramid
Modu... | 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._C
import torch.serialization
from torch import optim as optim
assert_size_stride = torch._C._dynamo.guar... | Atten4Vis/DemystifyLocalViT | PPMConcat | false | 13,376 | [
"MIT"
] | 64 | 2e2327caec6d56ae2c8aa861b32bb62f3cdb786e | https://github.com/Atten4Vis/DemystifyLocalViT/tree/2e2327caec6d56ae2c8aa861b32bb62f3cdb786e |
Encoder | import torch
import torch.nn as nn
import torch.nn.functional as F
class Lambda(nn.Module):
"""An easy way to create a pytorch layer for a simple `func`."""
def __init__(self, func):
"""create a layer that simply calls `func` with `x`"""
super().__init__()
self.func = func
def fo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | BHD233/PaddleOCR2Pytorch | Encoder | false | 13,377 | [
"Apache-2.0"
] | 364 | f114069b3e2669c6adf0adf9596756205f184c9c | https://github.com/BHD233/PaddleOCR2Pytorch/tree/f114069b3e2669c6adf0adf9596756205f184c9c |
SEModule | import torch
import torch.nn as nn
import torch.nn.functional as F
def hardsigmoid(x):
return F.relu6(x + 3.0, inplace=True) / 6.0
class SEModule(nn.Module):
def __init__(self, channel, reduction=4):
super(SEModule, self).__init__()
self.avg_pool = nn.AdaptiveAvgPool2d(1)
self.conv1... | 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 ... | BHD233/PaddleOCR2Pytorch | SEModule | false | 13,378 | [
"Apache-2.0"
] | 364 | f114069b3e2669c6adf0adf9596756205f184c9c | https://github.com/BHD233/PaddleOCR2Pytorch/tree/f114069b3e2669c6adf0adf9596756205f184c9c |
MultiheadAttention | import torch
import torch.nn as nn
import torch._C
import torch.serialization
from torch import optim as optim
class MultiheadAttention(nn.Module):
"""A warpper for torch.nn.MultiheadAttention.
This module implements MultiheadAttention with residual connection,
and positional encoding used in DETR is als... | 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.... | Atten4Vis/DemystifyLocalViT | MultiheadAttention | false | 13,379 | [
"MIT"
] | 64 | 2e2327caec6d56ae2c8aa861b32bb62f3cdb786e | https://github.com/Atten4Vis/DemystifyLocalViT/tree/2e2327caec6d56ae2c8aa861b32bb62f3cdb786e |
MetricCalcLayer | import torch
import torch.nn as nn
class MetricCalcLayer(nn.Module):
"""
Description
-----------
Calculate metric in equation 3 of paper.
Parameters
----------
nhid : int
The dimension of mapped features in the graph generating procedure.
"""
def __init__(self, nhid):
... | 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... | BUPT-GAMMA/OpenHGNN | MetricCalcLayer | false | 13,380 | [
"Apache-2.0"
] | 235 | 5f218dad4ed1415aa6d842bc20785c61e74e5405 | https://github.com/BUPT-GAMMA/OpenHGNN/tree/5f218dad4ed1415aa6d842bc20785c61e74e5405 |
GCN | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
class GraphConvolution(nn.Module):
"""
Description
-----------
The downstream GCN layer.
"""
def __init__(self, in_features, out_features, bias=True):
def reset_par... | 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... | BUPT-GAMMA/OpenHGNN | GCN | false | 13,381 | [
"Apache-2.0"
] | 235 | 5f218dad4ed1415aa6d842bc20785c61e74e5405 | https://github.com/BUPT-GAMMA/OpenHGNN/tree/5f218dad4ed1415aa6d842bc20785c61e74e5405 |
ScoreCap | import torch
from torch import nn
import torch.nn
import torch.optim
class ScoreCap(nn.Module):
def __init__(self, cap: 'float'):
super().__init__()
self.cap = cap
def forward(self, input):
return torch.clip(input, max=self.cap)
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.nn
import torch.optim
assert_size_stride = torch._C._dy... | BerenLuthien/ReAgent | ScoreCap | false | 13,382 | [
"BSD-3-Clause"
] | 1,156 | 52f666670a7fa03206812ef48949f6b934d400f7 | https://github.com/BerenLuthien/ReAgent/tree/52f666670a7fa03206812ef48949f6b934d400f7 |
Conv2dZeros | import torch
import torch.nn as nn
class _ActNorm(nn.Module):
"""
Activation Normalization
Initialize the bias and scale with a given minibatch,
so that the output per-channel have zero mean and unit variance for that.
After initialization, `bias` and `logs` will be trained as parameters.
"""... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.... | BQZic/glow-pytorch | Conv2dZeros | false | 13,383 | [
"MIT"
] | 479 | 4b43042326bbe644ccfda3c81a138375321808ed | https://github.com/BQZic/glow-pytorch/tree/4b43042326bbe644ccfda3c81a138375321808ed |
Embedder | import math
import torch
from torch import nn
import torch.nn
import torch.optim
class Embedder(nn.Module):
def __init__(self, dim_in, dim_out):
super().__init__()
self.dim_in = dim_in
self.dim_out = dim_out
self.linear = nn.Linear(self.dim_in, self.dim_out)
def forward(self,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.nn
import torch.optim
assert_size_stride = tor... | BerenLuthien/ReAgent | Embedder | false | 13,384 | [
"BSD-3-Clause"
] | 1,156 | 52f666670a7fa03206812ef48949f6b934d400f7 | https://github.com/BerenLuthien/ReAgent/tree/52f666670a7fa03206812ef48949f6b934d400f7 |
ConvWS2d | import torch
import torch.nn as nn
import torch.nn.functional as F
def conv_ws_2d(input, weight, bias=None, stride=1, padding=0, dilation=1,
groups=1, eps=1e-05):
c_in = weight.size(0)
weight_flat = weight.view(c_in, -1)
mean = weight_flat.mean(dim=1, keepdim=True).view(c_in, 1, 1, 1)
std = weight... | 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 ... | BUPT-PRIV/BalancedGroupSoftmax | ConvWS2d | false | 13,385 | [
"Apache-2.0"
] | 333 | 90e04fd8ccecd2bc61bbe6053a741ae708da2794 | https://github.com/BUPT-PRIV/BalancedGroupSoftmax/tree/90e04fd8ccecd2bc61bbe6053a741ae708da2794 |
GeLU | import math
import torch
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 math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.... | BigRedT/gpv-1 | GeLU | false | 13,386 | [
"Apache-2.0"
] | 45 | 6a0c2173b44961cb492d00f94864c461aa77641d | https://github.com/BigRedT/gpv-1/tree/6a0c2173b44961cb492d00f94864c461aa77641d |
ModuloMapIDList | import abc
import torch
import torch.nn
import torch.optim
class MapIDList(torch.nn.Module):
@abc.abstractmethod
def forward(self, raw_values: 'torch.Tensor') ->torch.Tensor:
pass
class ModuloMapIDList(MapIDList):
def __init__(self, modulo: 'int'):
super().__init__()
self.modul... | 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 abc
import torch.nn
import torch.optim
assert_size_stride = torch._C._dy... | BerenLuthien/ReAgent | ModuloMapIDList | false | 13,387 | [
"BSD-3-Clause"
] | 1,156 | 52f666670a7fa03206812ef48949f6b934d400f7 | https://github.com/BerenLuthien/ReAgent/tree/52f666670a7fa03206812ef48949f6b934d400f7 |
Discriminator | import math
import torch
import torch.nn as nn
import torch.utils.data
def uniform(size, tensor):
stdv = 1.0 / math.sqrt(size)
if tensor is not None:
tensor.data.uniform_(-stdv, stdv)
class Discriminator(nn.Module):
def __init__(self, hidden_dim):
super(Discriminator, 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 math
import torch.nn as nn
import torch.utils.data
assert_size_stride = t... | Bawaw/pytorch_geometric | Discriminator | false | 13,388 | [
"MIT"
] | 62 | 868548d4396fc66e39b08e2ff19091a367ddac13 | https://github.com/Bawaw/pytorch_geometric/tree/868548d4396fc66e39b08e2ff19091a367ddac13 |
Concat | import torch
from torch import nn
import torch.nn
import torch.optim
class Concat(nn.Module):
def forward(self, state: 'torch.Tensor', action: 'torch.Tensor'):
return torch.cat((state, action), dim=-1)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_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
from torch import nn
import torch.nn
import torch.optim
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda =... | BerenLuthien/ReAgent | Concat | false | 13,389 | [
"BSD-3-Clause"
] | 1,156 | 52f666670a7fa03206812ef48949f6b934d400f7 | https://github.com/BerenLuthien/ReAgent/tree/52f666670a7fa03206812ef48949f6b934d400f7 |
MsgNorm | import torch
import torch.nn.functional as F
class MsgNorm(torch.nn.Module):
def __init__(self, learn_msg_scale=False):
super(MsgNorm, self).__init__()
self.msg_scale = torch.nn.Parameter(torch.Tensor([1.0]),
requires_grad=learn_msg_scale)
def forward(self, x, msg, p=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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._... | Basvanstein/nasbench301 | MsgNorm | false | 13,390 | [
"Apache-2.0"
] | 55 | 2984dec45c760d47762f50efe39b71e9d1ac22e0 | https://github.com/Basvanstein/nasbench301/tree/2984dec45c760d47762f50efe39b71e9d1ac22e0 |
DepthWiseSeperableConv | import torch
import torch.nn as nn
class DepthWiseSeperableConv(nn.Module):
def __init__(self, in_dim, out_dim, *args, **kwargs):
super().__init__()
if 'groups' in kwargs:
del kwargs['groups']
self.depthwise = nn.Conv2d(in_dim, in_dim, *args, groups=in_dim, **
kwar... | 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... | BishmoyPaul/lama | DepthWiseSeperableConv | false | 13,391 | [
"Apache-2.0"
] | 2,133 | c7f5af9c167a15e2b0b741b1419237de52c4af05 | https://github.com/BishmoyPaul/lama/tree/c7f5af9c167a15e2b0b741b1419237de52c4af05 |
Zero | import torch
import torch.nn as nn
class Zero(nn.Module):
def __init__(self):
super(Zero, self).__init__()
def forward(self, x):
return x * 0
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | BayesWatch/pytorch-prunes | Zero | false | 13,392 | [
"MIT"
] | 143 | bc85a5c52865a2daf515ad4d3c26dcab88e3d941 | https://github.com/BayesWatch/pytorch-prunes/tree/bc85a5c52865a2daf515ad4d3c26dcab88e3d941 |
EncoderLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class Lambda(nn.Module):
"""An easy way to create a pytorch layer for a simple `func`."""
def __init__(self, func):
"""create a layer that simply calls `func` with `x`"""
super().__init__()
self.func = func
def fo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | BHD233/PaddleOCR2Pytorch | EncoderLayer | false | 13,393 | [
"Apache-2.0"
] | 364 | f114069b3e2669c6adf0adf9596756205f184c9c | https://github.com/BHD233/PaddleOCR2Pytorch/tree/f114069b3e2669c6adf0adf9596756205f184c9c |
Normalize | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class Normalize(nn.Module):
def __init__(self, power=2):
super(Normalize, self).__init__()
self.power = power
def forward(self, x):
norm = x.pow(self.power).sum(1, keepdim=True).pow... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.... | Bhaskers-Blu-Org2/metric-transfer.pytorch | Normalize | false | 13,394 | [
"MIT"
] | 51 | b0ae8ed6e6f62357100d799defbb61a78c831a87 | https://github.com/Bhaskers-Blu-Org2/metric-transfer.pytorch/tree/b0ae8ed6e6f62357100d799defbb61a78c831a87 |
AvgPoolPad | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
from torch import optim as optim
class AvgPoolPad(nn.Module):
def __init__(self, stride=2, padding=1):
super(AvgPoolPad, self).__init__()
self.pad = nn.ZeroPa... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
from torch imp... | BarneyQiao/CondenseNetV2 | AvgPoolPad | false | 13,395 | [
"MIT"
] | 80 | c771957cb8fe466d0ecbafe9060e4c342a33fc4d | https://github.com/BarneyQiao/CondenseNetV2/tree/c771957cb8fe466d0ecbafe9060e4c342a33fc4d |
HighwayLayer | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.jit
import torch.jit.quantized
import torch.onnx.operators
class HighwayLayer(nn.Module):
def __init__(self, input_dim, transform_activation=F.relu,
gate_activation=F.softmax, gate_bias=-2):
super().__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 import triton_helpers
from torch._inductor.runtime.... | Ayansam1152/translate | HighwayLayer | false | 13,396 | [
"BSD-3-Clause"
] | 748 | 33d397fc25fb1072abd2975c77c602a2d031c6c4 | https://github.com/Ayansam1152/translate/tree/33d397fc25fb1072abd2975c77c602a2d031c6c4 |
GeLU | import torch
import torch.nn as nn
import torch.nn.functional as F
class GeLU(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
return 0.5 * x * (1 + F.tanh(0.7978845608 * (x + 0.044715 * x * x * 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.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | Blind-Aid/sentiment-discovery | GeLU | false | 13,397 | [
"BSD-3-Clause"
] | 1,093 | 081c7c855e00864b52e97cac0b0e097cc86d9731 | https://github.com/Blind-Aid/sentiment-discovery/tree/081c7c855e00864b52e97cac0b0e097cc86d9731 |
MultiheadAttention | import math
import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
import torch.jit
import torch.jit.quantized
import torch.onnx.operators
def combine_heads(X):
"""
Combine heads (the inverse of split heads):
1) Transpose X from (batch size, nheads, sequence length, d_head) ... | 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.... | Ayansam1152/translate | MultiheadAttention | false | 13,398 | [
"BSD-3-Clause"
] | 748 | 33d397fc25fb1072abd2975c77c602a2d031c6c4 | https://github.com/Ayansam1152/translate/tree/33d397fc25fb1072abd2975c77c602a2d031c6c4 |
SmoothL1Loss | import torch
import torch.utils.data
def smooth_l1_loss(input, target, beta=1.0 / 9, size_average=True):
"""
very similar to the smooth_l1_loss from pytorch, but with
the extra beta parameter
"""
n = torch.abs(input - target)
cond = n < beta
loss = torch.where(cond, 0.5 * n ** 2 / beta, n ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.utils.dat... | BorisLestsov/retinamask | SmoothL1Loss | false | 13,399 | [
"MIT"
] | 706 | 265a65f018c64220bcea946d306fc7b07a692b16 | https://github.com/BorisLestsov/retinamask/tree/265a65f018c64220bcea946d306fc7b07a692b16 |
WordPredictor | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.jit
import torch.jit.quantized
import torch.onnx.operators
class WordPredictor(nn.Module):
def __init__(self, encoder_output_dim, hidden_dim, output_dim,
topk_labels_per_source_token=None, use_self_attention=False):
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.functional as... | Ayansam1152/translate | WordPredictor | false | 13,400 | [
"BSD-3-Clause"
] | 748 | 33d397fc25fb1072abd2975c77c602a2d031c6c4 | https://github.com/Ayansam1152/translate/tree/33d397fc25fb1072abd2975c77c602a2d031c6c4 |
ReconstructionLoss | import torch
from functools import reduce
import torch.nn as nn
class BaseModule(nn.Module):
"""
Implements the basic module.
All other modules inherit from this one
"""
def load_w(self, checkpoint_path):
"""
Loads a checkpoint into the state_dict.
:param checkpoint_path:... | 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 functools import reduce
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | BotanAtomic/anomaly-detection | ReconstructionLoss | false | 13,401 | [
"MIT"
] | 179 | 6617880f19a4955d70a34a3bbee83f157eb087f8 | https://github.com/BotanAtomic/anomaly-detection/tree/6617880f19a4955d70a34a3bbee83f157eb087f8 |
FixedNorm | import torch
import torch.nn as nn
class FixedNorm(nn.Module):
def __init__(self, d):
super().__init__()
self.dd = d ** (-1.0 / 2)
def forward(self, x):
norm_x = x.norm(2, dim=-1, keepdim=True)
x_normed = x / (norm_x * self.dd + 1e-12)
return x_normed
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_... | BlinkDL/RWKV-LM | FixedNorm | false | 13,402 | [
"BSD-2-Clause"
] | 102 | b48aa1d430a71ced8ae6a665c47f5dbd95f6f6ab | https://github.com/BlinkDL/RWKV-LM/tree/b48aa1d430a71ced8ae6a665c47f5dbd95f6f6ab |
SelfAttention | import torch
import torch.nn as nn
def init_drop(dropout):
if dropout > 0:
return nn.Dropout(dropout)
else:
return lambda x: x
class SelfAttention(nn.Module):
def __init__(self, hidden_dim, attn_drop, txt):
"""
Description
-----------
This part is used to... | 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.... | BUPT-GAMMA/OpenHGNN | SelfAttention | false | 13,403 | [
"Apache-2.0"
] | 235 | 5f218dad4ed1415aa6d842bc20785c61e74e5405 | https://github.com/BUPT-GAMMA/OpenHGNN/tree/5f218dad4ed1415aa6d842bc20785c61e74e5405 |
HouseHolderFlow | import torch
import torch.utils.data
import torch.nn as nn
class HouseHolderFlow(nn.Module):
def forward(self, v, z):
"""
:param v: batch_size (B) x latent_size (L)
:param z: batch_size (B) x latent_size (L)
:return: z_new = z - 2* v v_T / norm(v,2) * z
"""
vvT = 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
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dyn... | BratChar/variational-item-response-theory-public | HouseHolderFlow | false | 13,404 | [
"MIT"
] | 52 | 12862157e99506a0ed7018f1b8a485d4e61fb5bf | https://github.com/BratChar/variational-item-response-theory-public/tree/12862157e99506a0ed7018f1b8a485d4e61fb5bf |
LayerNorm | import torch
import torch.nn as nn
class LayerNorm(nn.Module):
def __init__(self, num_features, eps=1e-05, affine=True):
super(LayerNorm, self).__init__()
self.num_features = num_features
self.affine = affine
self.eps = eps
if self.affine:
self.gamma = nn.Param... | 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_... | Boyiliee/PONO | LayerNorm | false | 13,405 | [
"MIT"
] | 133 | b9108e8bf8ba0228635532ba5bdc973b7393d045 | https://github.com/Boyiliee/PONO/tree/b9108e8bf8ba0228635532ba5bdc973b7393d045 |
ItemInferenceNetwork | import torch
import torch.utils.data
import torch.nn as nn
class ItemInferenceNetwork(nn.Module):
def __init__(self, num_item, item_feat_dim):
super().__init__()
self.mu_lookup = nn.Embedding(num_item, item_feat_dim)
self.logvar_lookup = nn.Embedding(num_item, item_feat_dim)
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
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | BratChar/variational-item-response-theory-public | ItemInferenceNetwork | false | 13,406 | [
"MIT"
] | 52 | 12862157e99506a0ed7018f1b8a485d4e61fb5bf | https://github.com/BratChar/variational-item-response-theory-public/tree/12862157e99506a0ed7018f1b8a485d4e61fb5bf |
TargetContextGate | import torch
import torch.nn as nn
import torch.cuda
import torch.distributed
class ContextGate(nn.Module):
"""
Context gate is a decoder module that takes as input the previous word
embedding, the current decoder state and the attention state, and
produces a gate.
The gate can be used to select 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 torch.nn as ... | BradLin0819/kg2text | TargetContextGate | false | 13,407 | [
"Apache-2.0"
] | 86 | e586eb2027c0d85db9826cbe1d9e14f2d26fc93f | https://github.com/BradLin0819/kg2text/tree/e586eb2027c0d85db9826cbe1d9e14f2d26fc93f |
ContextGate | import torch
import torch.nn as nn
import torch.cuda
import torch.distributed
class ContextGate(nn.Module):
"""
Context gate is a decoder module that takes as input the previous word
embedding, the current decoder state and the attention state, and
produces a gate.
The gate can be used to select 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
import torch.nn as nn
import torch.cuda
import torch.distributed
assert_size_str... | BradLin0819/kg2text | ContextGate | false | 13,408 | [
"Apache-2.0"
] | 86 | e586eb2027c0d85db9826cbe1d9e14f2d26fc93f | https://github.com/BradLin0819/kg2text/tree/e586eb2027c0d85db9826cbe1d9e14f2d26fc93f |
DenseSAGEConv | import math
import torch
import torch.nn.functional as F
import torch.utils.data
from torch.nn import Parameter
def uniform(size, tensor):
stdv = 1.0 / math.sqrt(size)
if tensor is not None:
tensor.data.uniform_(-stdv, stdv)
class DenseSAGEConv(torch.nn.Module):
"""See :class:`torch_geometric.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
from torch._inductor.runtime.... | Bawaw/pytorch_geometric | DenseSAGEConv | false | 13,409 | [
"MIT"
] | 62 | 868548d4396fc66e39b08e2ff19091a367ddac13 | https://github.com/Bawaw/pytorch_geometric/tree/868548d4396fc66e39b08e2ff19091a367ddac13 |
AverageAttention | import torch
import torch.nn as nn
import torch.cuda
import torch.distributed
class PositionwiseFeedForward(nn.Module):
""" A two-layer Feed-Forward-Network with residual layer norm.
Args:
d_model (int): the size of input for the first-layer of the FFN.
d_ff (int): the hidden layer size of th... | 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.cuda
import torch.distributed
assert_size_str... | BradLin0819/kg2text | AverageAttention | false | 13,410 | [
"Apache-2.0"
] | 86 | e586eb2027c0d85db9826cbe1d9e14f2d26fc93f | https://github.com/BradLin0819/kg2text/tree/e586eb2027c0d85db9826cbe1d9e14f2d26fc93f |
PONO | import torch
import torch.nn as nn
class PONO(nn.Module):
def __init__(self, input_size=None, return_stats=False, affine=False,
eps=1e-05):
super(PONO, self).__init__()
self.return_stats = return_stats
self.input_size = input_size
self.eps = eps
self.affine = affin... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | Boyiliee/PONO | PONO | false | 13,411 | [
"MIT"
] | 133 | b9108e8bf8ba0228635532ba5bdc973b7393d045 | https://github.com/Boyiliee/PONO/tree/b9108e8bf8ba0228635532ba5bdc973b7393d045 |
SELayer | import torch
import torch.nn.functional as F
import torch.nn as nn
class SELayer(nn.Module):
def __init__(self, in_channels, reduction):
super().__init__()
mid_channels = in_channels // reduction
self.fc1 = nn.Linear(in_channels, mid_channels)
self.fc2 = nn.Linear(mid_channels, 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_... | BrandonHanx/pytorch_image_classification | SELayer | false | 13,412 | [
"MIT"
] | 1,114 | 13f037c442f251c5cd938672245b39df157f1c98 | https://github.com/BrandonHanx/pytorch_image_classification/tree/13f037c442f251c5cd938672245b39df157f1c98 |
SourceContextGate | import torch
import torch.nn as nn
import torch.cuda
import torch.distributed
class ContextGate(nn.Module):
"""
Context gate is a decoder module that takes as input the previous word
embedding, the current decoder state and the attention state, and
produces a gate.
The gate can be used to select 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 torch.nn as ... | BradLin0819/kg2text | SourceContextGate | false | 13,413 | [
"Apache-2.0"
] | 86 | e586eb2027c0d85db9826cbe1d9e14f2d26fc93f | https://github.com/BradLin0819/kg2text/tree/e586eb2027c0d85db9826cbe1d9e14f2d26fc93f |
KL_loss_softmax | import torch
import torch.nn as nn
import torch.nn.init
class KL_loss_softmax(nn.Module):
"""
Compute KL_divergence between all prediction score (already sum=1, omit softmax function)
"""
def __init__(self):
super(KL_loss_softmax, self).__init__()
self.KL_loss = nn.KLDivLoss(reduce=Fa... | 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... | BruceW91/CVSE | KL_loss_softmax | false | 13,414 | [
"MIT"
] | 152 | 20fa1ff50d1dcb4a7b3799071fa78038e52db804 | https://github.com/BruceW91/CVSE/tree/20fa1ff50d1dcb4a7b3799071fa78038e52db804 |
GlobalAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.cuda
import torch.distributed
def aeq(*args):
"""
Assert all arguments have the same value
"""
arguments = (arg for arg in args)
first = next(arguments)
assert all(arg == first for arg in arguments
), '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.... | BradLin0819/kg2text | GlobalAttention | false | 13,415 | [
"Apache-2.0"
] | 86 | e586eb2027c0d85db9826cbe1d9e14f2d26fc93f | https://github.com/BradLin0819/kg2text/tree/e586eb2027c0d85db9826cbe1d9e14f2d26fc93f |
resblock | import torch
import torch.nn as nn
class mfm(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1,
padding=1, type=1):
super(mfm, self).__init__()
self.out_channels = out_channels
if type == 1:
self.filter = nn.Conv2d(in_channels, 2 * out_c... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | BradyFU/DVG | resblock | false | 13,416 | [
"MIT"
] | 102 | 53fd50cdc51d783b33394726b8f8a2b2216f157b | https://github.com/BradyFU/DVG/tree/53fd50cdc51d783b33394726b8f8a2b2216f157b |
mfm | import torch
import torch.nn as nn
class mfm(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1,
padding=1, type=1):
super(mfm, self).__init__()
self.out_channels = out_channels
if type == 1:
self.filter = nn.Conv2d(in_channels, 2 * out_c... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | BradyFU/DVG | mfm | false | 13,417 | [
"MIT"
] | 102 | 53fd50cdc51d783b33394726b8f8a2b2216f157b | https://github.com/BradyFU/DVG/tree/53fd50cdc51d783b33394726b8f8a2b2216f157b |
LR | import torch
class LR(torch.nn.Module):
def __init__(self, input_size, output_size):
super(LR, self).__init__()
self.lr = torch.ones(input_size)
self.lr = torch.nn.Parameter(self.lr)
def forward(self, grad):
return self.lr * grad
def get_inputs():
return [torch.rand([4,... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | Brikwerk/learn2learn | LR | false | 13,418 | [
"MIT"
] | 1,774 | 7997c13c26ec627d13ce77ba98427260df78ada8 | https://github.com/Brikwerk/learn2learn/tree/7997c13c26ec627d13ce77ba98427260df78ada8 |
BothContextGate | import torch
import torch.nn as nn
import torch.cuda
import torch.distributed
class ContextGate(nn.Module):
"""
Context gate is a decoder module that takes as input the previous word
embedding, the current decoder state and the attention state, and
produces a gate.
The gate can be used to select 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 torch.nn as ... | BradLin0819/kg2text | BothContextGate | false | 13,419 | [
"Apache-2.0"
] | 86 | e586eb2027c0d85db9826cbe1d9e14f2d26fc93f | https://github.com/BradLin0819/kg2text/tree/e586eb2027c0d85db9826cbe1d9e14f2d26fc93f |
PlanarFlow | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
class PlanarFlow(nn.Module):
"""Planar normalizing flow [Rezende & Mohamed 2015].
Provides a tighter bound on the ELBO by giving more expressive
power to the approximate distribution, such as by introducing
cova... | 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.utils.data
import torch.nn as nn
assert_size_stri... | BratChar/variational-item-response-theory-public | PlanarFlow | false | 13,420 | [
"MIT"
] | 52 | 12862157e99506a0ed7018f1b8a485d4e61fb5bf | https://github.com/BratChar/variational-item-response-theory-public/tree/12862157e99506a0ed7018f1b8a485d4e61fb5bf |
group | import torch
import torch.nn as nn
class mfm(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1,
padding=1, type=1):
super(mfm, self).__init__()
self.out_channels = out_channels
if type == 1:
self.filter = nn.Conv2d(in_channels, 2 * out_c... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | BradyFU/DVG | group | false | 13,421 | [
"MIT"
] | 102 | 53fd50cdc51d783b33394726b8f8a2b2216f157b | https://github.com/BradyFU/DVG/tree/53fd50cdc51d783b33394726b8f8a2b2216f157b |
MultiheadAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
def fill_with_neg_inf(t):
"""FP16-compatible function that fills a tensor with -inf."""
return t.float().fill_(float('-inf')).type_as(t)
def _get_full_incremental_state_key(module_instance, key):
module_name = module_instance.__class__._... | 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.... | Blind-Aid/sentiment-discovery | MultiheadAttention | false | 13,422 | [
"BSD-3-Clause"
] | 1,093 | 081c7c855e00864b52e97cac0b0e097cc86d9731 | https://github.com/Blind-Aid/sentiment-discovery/tree/081c7c855e00864b52e97cac0b0e097cc86d9731 |
HypergradTransform | import torch
class HypergradTransform(torch.nn.Module):
"""Hypergradient-style per-parameter learning rates"""
def __init__(self, param, lr=0.01):
super(HypergradTransform, self).__init__()
self.lr = lr * torch.ones_like(param, requires_grad=True)
self.lr = torch.nn.Parameter(self.lr)... | 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... | Brikwerk/learn2learn | HypergradTransform | false | 13,423 | [
"MIT"
] | 1,774 | 7997c13c26ec627d13ce77ba98427260df78ada8 | https://github.com/Brikwerk/learn2learn/tree/7997c13c26ec627d13ce77ba98427260df78ada8 |
EncoderImagePrecomp | import torch
import numpy as np
from collections import OrderedDict
import torch.nn as nn
import torch.nn.init
def l2norm(X, dim=-1, eps=1e-12):
"""L2-normalize columns of X
"""
norm = torch.pow(X, 2).sum(dim=dim, keepdim=True).sqrt() + eps
X = torch.div(X, norm)
return X
class EncoderImagePreco... | 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
... | BruceW91/CVSE | EncoderImagePrecomp | false | 13,424 | [
"MIT"
] | 152 | 20fa1ff50d1dcb4a7b3799071fa78038e52db804 | https://github.com/BruceW91/CVSE/tree/20fa1ff50d1dcb4a7b3799071fa78038e52db804 |
JointsMSELoss | 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.multiprocessing
class JointsMSELoss(nn.Module):
def __init__(self, use_target_weight):
super(JointsMSELoss, self).__init__()
self.criterion = nn.... | 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.m... | CHUNYUWANG/imu-human-pose-pytorch | JointsMSELoss | false | 13,425 | [
"MIT"
] | 72 | f4813336571789f46eabdfb520e7ed5b20ac04ea | https://github.com/CHUNYUWANG/imu-human-pose-pytorch/tree/f4813336571789f46eabdfb520e7ed5b20ac04ea |
Multi_feature_fusing | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init
def l2norm(X, dim=-1, eps=1e-12):
"""L2-normalize columns of X
"""
norm = torch.pow(X, 2).sum(dim=dim, keepdim=True).sqrt() + eps
X = torch.div(X, norm)
return X
class Multi_feature_fusing(... | 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
import torch.nn.init
assert_size_strid... | BruceW91/CVSE | Multi_feature_fusing | false | 13,426 | [
"MIT"
] | 152 | 20fa1ff50d1dcb4a7b3799071fa78038e52db804 | https://github.com/BruceW91/CVSE/tree/20fa1ff50d1dcb4a7b3799071fa78038e52db804 |
MetaCurvatureTransform | import torch
import numpy as np
class MetaCurvatureTransform(torch.nn.Module):
"""
[[Source]](https://github.com/learnables/learn2learn/blob/master/learn2learn/optim/transforms/module_transform.py)
**Description**
Implements the Meta-Curvature transform of Park and Oliva, 2019.
Unlike `ModuleTr... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
assert_size_stride = torch._C._dynamo.guards.assert_size_stri... | Brikwerk/learn2learn | MetaCurvatureTransform | false | 13,427 | [
"MIT"
] | 1,774 | 7997c13c26ec627d13ce77ba98427260df78ada8 | https://github.com/Brikwerk/learn2learn/tree/7997c13c26ec627d13ce77ba98427260df78ada8 |
EncoderImageWeightNormPrecomp | import torch
from collections import OrderedDict
import torch.nn as nn
import torch.nn.init
from torch.nn.utils.weight_norm import weight_norm
def l2norm(X, dim=-1, eps=1e-12):
"""L2-normalize columns of X
"""
norm = torch.pow(X, 2).sum(dim=dim, keepdim=True).sqrt() + eps
X = torch.div(X, norm)
re... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from collections im... | BruceW91/CVSE | EncoderImageWeightNormPrecomp | false | 13,428 | [
"MIT"
] | 152 | 20fa1ff50d1dcb4a7b3799071fa78038e52db804 | https://github.com/BruceW91/CVSE/tree/20fa1ff50d1dcb4a7b3799071fa78038e52db804 |
GraphConv | import torch
from torch import nn
import torch.nn
import torch.autograd
def sparse_bmm(sparse_matrix, dense_matrix_batch):
"""
Perform torch.bmm on an unbatched sparse matrix and a batched dense matrix.
Args:
sparse_matrix (torch.sparse.FloatTensor): Shape = (m, n)
dense_matrix_batch (tor... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.nn
import torch.autograd
assert_size_stride = ... | Burningdust21/kaolin | GraphConv | false | 13,429 | [
"ECL-2.0",
"Apache-2.0"
] | 3,747 | 23e8a0fa4e2cb0249cee4c3c0c1ab1f7e6793531 | https://github.com/Burningdust21/kaolin/tree/23e8a0fa4e2cb0249cee4c3c0c1ab1f7e6793531 |
Encoder | import torch
import torch.nn as nn
import torch.nn
import torch.nn.init
import torch.optim
class Model(nn.Module):
""" Class representing sampleable neural network model """
def num_params(self):
""" Get the number of model parameters. """
return sum(p.numel() for p in self.parameters())
... | 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 ... | CBIIT/NCI-DOE-Collab-Pilot2-Autoencoder_MD_Simulation_Data | Encoder | false | 13,430 | [
"MIT"
] | 51 | 2b1213f944cf5f2c60799099a469989a1f0a6d3a | https://github.com/CBIIT/NCI-DOE-Collab-Pilot2-Autoencoder_MD_Simulation_Data/tree/2b1213f944cf5f2c60799099a469989a1f0a6d3a |
LinearDrop | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn
import torch.nn.init
import torch.optim
class Model(nn.Module):
""" Class representing sampleable neural network model """
def num_params(self):
""" Get the number of model parameters. """
return sum(p.numel() ... | 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 ... | CBIIT/NCI-DOE-Collab-Pilot2-Autoencoder_MD_Simulation_Data | LinearDrop | false | 13,431 | [
"MIT"
] | 51 | 2b1213f944cf5f2c60799099a469989a1f0a6d3a | https://github.com/CBIIT/NCI-DOE-Collab-Pilot2-Autoencoder_MD_Simulation_Data/tree/2b1213f944cf5f2c60799099a469989a1f0a6d3a |
InstanceNormLayer | import torch
import torch.nn as nn
class InstanceNormLayer(nn.Module):
"""Implements instance normalization layer."""
def __init__(self, epsilon=1e-08):
super().__init__()
self.epsilon = epsilon
def forward(self, x):
if len(x.shape) != 4:
raise ValueError(
... | 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_... | CV-IP/interfacegan | InstanceNormLayer | false | 13,432 | [
"MIT"
] | 855 | 5a556b8e693f6e1888f769f653aaafaaccca5dc2 | https://github.com/CV-IP/interfacegan/tree/5a556b8e693f6e1888f769f653aaafaaccca5dc2 |
Attention | import torch
import torch.nn as nn
import torch.nn.functional as F
class Attention(nn.Module):
"""
several score types like dot,general and concat
"""
def __init__(self, method='dot', hidden_size=None):
super(Attention, self).__init__()
self.method = method
if self.method != '... | 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.... | CNLPT/lightNLP | Attention | false | 13,433 | [
"Apache-2.0"
] | 889 | c7f128422ba5b16f514bb294145cb3b562e95829 | https://github.com/CNLPT/lightNLP/tree/c7f128422ba5b16f514bb294145cb3b562e95829 |
MSBlock | import torch
import torch.nn as nn
class MSBlock(nn.Module):
def __init__(self, c_in, rate=4):
super(MSBlock, self).__init__()
self.rate = rate
self.conv = nn.Conv2d(c_in, 32, 3, stride=1, padding=1)
self.relu = nn.ReLU(inplace=True)
dilation = self.rate * 1 if self.rate >... | 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_... | CM-BF/FeatureFlow | MSBlock | false | 13,434 | [
"MIT"
] | 161 | 06642697922f17211e5faa353e24b1a0946885b1 | https://github.com/CM-BF/FeatureFlow/tree/06642697922f17211e5faa353e24b1a0946885b1 |
LinearBlock | import torch
import torch.nn as nn
import torch.nn
import torch.nn.init
import torch.optim
class Model(nn.Module):
""" Class representing sampleable neural network model """
def num_params(self):
""" Get the number of model parameters. """
return sum(p.numel() for p in self.parameters())
... | 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 ... | CBIIT/NCI-DOE-Collab-Pilot2-Autoencoder_MD_Simulation_Data | LinearBlock | false | 13,435 | [
"MIT"
] | 51 | 2b1213f944cf5f2c60799099a469989a1f0a6d3a | https://github.com/CBIIT/NCI-DOE-Collab-Pilot2-Autoencoder_MD_Simulation_Data/tree/2b1213f944cf5f2c60799099a469989a1f0a6d3a |
CharbonnierLoss | import torch
import torch.nn as nn
class CharbonnierLoss(nn.Module):
"""Charbonnier Loss (L1)"""
def __init__(self, eps=1e-06):
super(CharbonnierLoss, self).__init__()
self.eps = eps
def forward(self, x, y):
diff = x - y
loss = torch.mean(torch.sqrt(diff * diff + 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 import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | CM-BF/FeatureFlow | CharbonnierLoss | false | 13,436 | [
"MIT"
] | 161 | 06642697922f17211e5faa353e24b1a0946885b1 | https://github.com/CM-BF/FeatureFlow/tree/06642697922f17211e5faa353e24b1a0946885b1 |
down | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.functional import F
from torch.nn import functional as F
class down(nn.Module):
"""
A class for creating neural network blocks containing layers:
Average Pooling --> Convlution + Leaky ReLU --> Convolution + Leaky ReLU
Thi... | 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... | CM-BF/FeatureFlow | down | false | 13,437 | [
"MIT"
] | 161 | 06642697922f17211e5faa353e24b1a0946885b1 | https://github.com/CM-BF/FeatureFlow/tree/06642697922f17211e5faa353e24b1a0946885b1 |
_Residual_Block | import torch
import torch.nn as nn
class _Residual_Block(nn.Module):
def __init__(self, inc=64, outc=64, groups=1):
super(_Residual_Block, self).__init__()
if inc is not outc:
self.conv_expand = nn.Conv2d(in_channels=inc, out_channels=outc,
kernel_size=1, stride=1, pad... | 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.... | BradyFU/DVG | _Residual_Block | false | 13,438 | [
"MIT"
] | 102 | 53fd50cdc51d783b33394726b8f8a2b2216f157b | https://github.com/BradyFU/DVG/tree/53fd50cdc51d783b33394726b8f8a2b2216f157b |
RNN_net | import torch
import torch.nn as nn
class RNN_net(nn.Module):
def __init__(self, input_size, hidden_size, output_size):
super(RNN_net, self).__init__()
self.hidden_size = hidden_size
self.i2h = nn.Linear(input_size + hidden_size, hidden_size)
self.i2o = nn.Linear(input_size + hidde... | 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.... | CMOONCS/DeepLearning | RNN_net | false | 13,439 | [
"MIT"
] | 86 | 748107d27e466bb18559b828642a4cace6431dc2 | https://github.com/CMOONCS/DeepLearning/tree/748107d27e466bb18559b828642a4cace6431dc2 |
TLU | import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
class TLU(nn.Module):
def __init__(self, num_features):
super(TLU, self).__init__()
self.num_features = num_features
self.tau = Parameter(torch.Tensor(1, num_features, 1, 1),
requires_grad=True)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from torch.nn.parameter import Parameter
assert_size_stride = torch... | COATZ/ShapeConv | TLU | false | 13,440 | [
"Apache-2.0"
] | 57 | f34f4e95ee2b69ac645fd5ba608e3c11cfadfded | https://github.com/COATZ/ShapeConv/tree/f34f4e95ee2b69ac645fd5ba608e3c11cfadfded |
PixelNormLayer | import torch
import torch.nn as nn
class PixelNormLayer(nn.Module):
"""Implements pixel-wise feature vector normalization layer."""
def __init__(self, epsilon=1e-08):
super().__init__()
self.epsilon = epsilon
def forward(self, x):
return x / torch.sqrt(torch.mean(x ** 2, dim=1, k... | 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_... | CV-IP/interfacegan | PixelNormLayer | false | 13,441 | [
"MIT"
] | 855 | 5a556b8e693f6e1888f769f653aaafaaccca5dc2 | https://github.com/CV-IP/interfacegan/tree/5a556b8e693f6e1888f769f653aaafaaccca5dc2 |
Upsample | import torch
import torch.nn as nn
import torch.nn.parallel
class Upsample(nn.Module):
def __init__(self, n_iter):
super(Upsample, self).__init__()
self.n_iter = n_iter
def forward(self, img):
for _ in range(self.n_iter):
img = nn.functional.interpolate(img, scale_factor=... | 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
import... | AyushExel/GANSketching | Upsample | false | 13,442 | [
"MIT"
] | 598 | c72524ac4425de898087af7a4c554b777a4e2218 | https://github.com/AyushExel/GANSketching/tree/c72524ac4425de898087af7a4c554b777a4e2218 |
MLP | import torch
import torch.nn as nn
class SharedDropout(nn.Module):
def __init__(self, p=0.5, batch_first=True):
super(SharedDropout, self).__init__()
self.p = p
self.batch_first = batch_first
def extra_repr(self):
info = f'p={self.p}'
if self.batch_first:
... | 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... | CNLPT/lightNLP | MLP | false | 13,443 | [
"Apache-2.0"
] | 889 | c7f128422ba5b16f514bb294145cb3b562e95829 | https://github.com/CNLPT/lightNLP/tree/c7f128422ba5b16f514bb294145cb3b562e95829 |
AttentionModule | import torch
from torch import nn
import torch.nn.functional as F
class AttentionModule(nn.Module):
def __init__(self, d_model, d_k=None, device='cpu', dropout=None):
super().__init__()
if not d_k:
d_k = d_model
self.W = nn.Parameter(torch.randn(d_model, d_model, device=device... | 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.... | BruceWen120/medical-abbreviation-pretraining | AttentionModule | false | 13,444 | [
"Apache-2.0",
"MIT"
] | 125 | 333e49461f7463e97515f949f441c7ac8af7d980 | https://github.com/BruceWen120/medical-abbreviation-pretraining/tree/333e49461f7463e97515f949f441c7ac8af7d980 |
Resv1Block | import torch
import torch.nn as nn
def conv3x3(in_channels, out_channels, stride=1, padding=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_channels, out_channels, 3, stride, padding, bias=True)
class Resv1Block(nn.Module):
"""ResNet v1 block without bn"""
def __init__(self, inplanes, pl... | 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_... | CNN-NISER/lffd-pytorch | Resv1Block | false | 13,445 | [
"MIT"
] | 220 | 7d6476ece79cf75c6265c89346ddac48929ce8f6 | https://github.com/CNN-NISER/lffd-pytorch/tree/7d6476ece79cf75c6265c89346ddac48929ce8f6 |
Conv | import torch
import torch.utils.data
from torch import nn
class Conv(nn.Module):
def __init__(self, inp_dim, out_dim, kernel_size=3, stride=1, bn=False,
relu=True):
super(Conv, self).__init__()
self.inp_dim = inp_dim
self.conv = nn.Conv2d(inp_dim, out_dim, kernel_size, stride,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
from ... | CenIII/pose-ae-train | Conv | false | 13,446 | [
"BSD-3-Clause"
] | 250 | 8780ba9f3d80ca3a724bbee7b815073adc3d3e6e | https://github.com/CenIII/pose-ae-train/tree/8780ba9f3d80ca3a724bbee7b815073adc3d3e6e |
L2Norm | import torch
import torch.nn.functional as F
import torch.nn as nn
class L2Norm(nn.Module):
"""L2Norm layer across all channels."""
def __init__(self, in_features, scale):
super(L2Norm, self).__init__()
self.weight = nn.Parameter(torch.Tensor(in_features))
self.reset_parameters(scale)... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | CVHj/torchcv | L2Norm | false | 13,447 | [
"MIT"
] | 433 | 6291f3e1e4bbf6467fd6b1e79001d34a59481bb6 | https://github.com/CVHj/torchcv/tree/6291f3e1e4bbf6467fd6b1e79001d34a59481bb6 |
BranchNet | import torch
import torch.nn as nn
def conv1x1(in_channels, out_channels):
"""1x1 convolution"""
return nn.Conv2d(in_channels, out_channels, 1, bias=True)
class BranchNet(nn.Module):
"""
The branch of NaiveNet is the network output and
only consists of conv 1×1 and ReLU.
"""
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 import triton_helpers
import torch.nn as nn
assert_... | CNN-NISER/lffd-pytorch | BranchNet | false | 13,448 | [
"MIT"
] | 220 | 7d6476ece79cf75c6265c89346ddac48929ce8f6 | https://github.com/CNN-NISER/lffd-pytorch/tree/7d6476ece79cf75c6265c89346ddac48929ce8f6 |
Downsample | import torch
import torch.nn as nn
class Downsample(nn.Module):
def __init__(self, in_channels, with_conv):
super().__init__()
self.with_conv = with_conv
if self.with_conv:
self.conv = torch.nn.Conv2d(in_channels, in_channels,
kernel_size=3, stride=2, 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
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | CasualGANPapers/Make-A-Scene | Downsample | false | 13,449 | [
"MIT"
] | 47 | 4457ef91ccf4a345f3178cf821f12b49df616b6d | https://github.com/CasualGANPapers/Make-A-Scene/tree/4457ef91ccf4a345f3178cf821f12b49df616b6d |
backWarp | import torch
import numpy as np
import torch.nn as nn
class backWarp(nn.Module):
"""
A class for creating a backwarping object.
This is used for backwarping to an image:
Given optical flow from frame I0 to I1 --> F_0_1 and frame I1,
it generates I0 <-- backwarp(F_0_1, I1).
...
Methods
... | 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 numpy as np
import to... | CM-BF/FeatureFlow | backWarp | false | 13,450 | [
"MIT"
] | 161 | 06642697922f17211e5faa353e24b1a0946885b1 | https://github.com/CM-BF/FeatureFlow/tree/06642697922f17211e5faa353e24b1a0946885b1 |
Biaffine | import torch
import torch.nn as nn
class Biaffine(nn.Module):
def __init__(self, n_in, n_out=1, bias_x=True, bias_y=True):
super(Biaffine, self).__init__()
self.n_in = n_in
self.n_out = n_out
self.bias_x = bias_x
self.bias_y = bias_y
self.weight = nn.Parameter(torc... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | CNLPT/lightNLP | Biaffine | false | 13,451 | [
"Apache-2.0"
] | 889 | c7f128422ba5b16f514bb294145cb3b562e95829 | https://github.com/CNLPT/lightNLP/tree/c7f128422ba5b16f514bb294145cb3b562e95829 |
MaxPoolStride1 | import torch
import torch.nn as nn
import torch.nn.functional as F
class MaxPoolStride1(nn.Module):
def __init__(self):
super(MaxPoolStride1, self).__init__()
def forward(self, x):
x_pad = F.pad(x, (0, 1, 0, 1), mode='replicate')
x = F.max_pool2d(x_pad, 2, stride=1)
return x
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | CharlesPikachu/YOLO | MaxPoolStride1 | false | 13,452 | [
"MIT"
] | 57 | 950b11c35517c1c3d7d7856b5768c4023c1f89eb | https://github.com/CharlesPikachu/YOLO/tree/950b11c35517c1c3d7d7856b5768c4023c1f89eb |
Merge | import torch
import torch.utils.data
from torch import nn
class Conv(nn.Module):
def __init__(self, inp_dim, out_dim, kernel_size=3, stride=1, bn=False,
relu=True):
super(Conv, self).__init__()
self.inp_dim = inp_dim
self.conv = nn.Conv2d(inp_dim, out_dim, kernel_size, stride,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
from torch import nn
assert_size_stride = torch._C._dyna... | CenIII/pose-ae-train | Merge | false | 13,453 | [
"BSD-3-Clause"
] | 250 | 8780ba9f3d80ca3a724bbee7b815073adc3d3e6e | https://github.com/CenIII/pose-ae-train/tree/8780ba9f3d80ca3a724bbee7b815073adc3d3e6e |
MultiHeadSelfAttention | import torch
import numpy as np
import torch.nn as nn
import torch.nn.init
import torch.nn.parallel
class MultiHeadSelfAttention(nn.Module):
"""Self-attention module by Lin, Zhouhan, et al. ICLR 2017"""
def __init__(self, n_head, d_in, d_hidden):
super(MultiHeadSelfAttention, 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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | CLT29/pvse | MultiHeadSelfAttention | false | 13,454 | [
"MIT"
] | 119 | bf5232148396ee5051564ef68a48538de0ddbc84 | https://github.com/CLT29/pvse/tree/bf5232148396ee5051564ef68a48538de0ddbc84 |
LogSTFTMagnitudeLoss | import torch
import torch.utils.data
import torch.nn.functional as F
class LogSTFTMagnitudeLoss(torch.nn.Module):
"""Log STFT magnitude loss module."""
def __init__(self):
"""Initilize los STFT magnitude loss module."""
super(LogSTFTMagnitudeLoss, self).__init__()
def forward(self, x_mag... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.utils.dat... | ChanganVR/hifigan-denoiser | LogSTFTMagnitudeLoss | false | 13,455 | [
"Apache-2.0"
] | 100 | 9bd77c53556e1372b4bbff8dce8b120297cc4e5c | https://github.com/ChanganVR/hifigan-denoiser/tree/9bd77c53556e1372b4bbff8dce8b120297cc4e5c |
GlobalAvgPool2d | import torch
import torch.nn as nn
import torch.nn.functional as F
class GlobalAvgPool2d(nn.Module):
def __init__(self):
super(GlobalAvgPool2d, self).__init__()
def forward(self, x):
N = x.data.size(0)
C = x.data.size(1)
H = x.data.size(2)
W = x.data.size(3)
x... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | CharlesPikachu/YOLO | GlobalAvgPool2d | false | 13,456 | [
"MIT"
] | 57 | 950b11c35517c1c3d7d7856b5768c4023c1f89eb | https://github.com/CharlesPikachu/YOLO/tree/950b11c35517c1c3d7d7856b5768c4023c1f89eb |
MatrixTree | import torch
import torch.nn as nn
import torch.cuda
import torch.distributed
class MatrixTree(nn.Module):
"""Implementation of the matrix-tree theorem for computing marginals
of non-projective dependency parsing. This attention layer is used
in the paper "Learning Structured Text Representations"
:ci... | 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
import torch.cuda
import torch.distributed
assert_s... | BradLin0819/kg2text | MatrixTree | false | 13,457 | [
"Apache-2.0"
] | 86 | e586eb2027c0d85db9826cbe1d9e14f2d26fc93f | https://github.com/BradLin0819/kg2text/tree/e586eb2027c0d85db9826cbe1d9e14f2d26fc93f |
ResolutionScalingLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class ResolutionScalingLayer(nn.Module):
"""Implements the resolution scaling layer.
Basically, this layer can be used to upsample or downsample feature maps from
spatial domain with nearest neighbor interpolation.
"""
def __init__(sel... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | CV-IP/interfacegan | ResolutionScalingLayer | false | 13,458 | [
"MIT"
] | 855 | 5a556b8e693f6e1888f769f653aaafaaccca5dc2 | https://github.com/CV-IP/interfacegan/tree/5a556b8e693f6e1888f769f653aaafaaccca5dc2 |
SpectralConvergengeLoss | import torch
import torch.utils.data
class SpectralConvergengeLoss(torch.nn.Module):
"""Spectral convergence loss module."""
def __init__(self):
"""Initilize spectral convergence loss module."""
super(SpectralConvergengeLoss, self).__init__()
def forward(self, x_mag, y_mag):
"""C... | 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.utils.data
asse... | ChanganVR/hifigan-denoiser | SpectralConvergengeLoss | false | 13,459 | [
"Apache-2.0"
] | 100 | 9bd77c53556e1372b4bbff8dce8b120297cc4e5c | https://github.com/ChanganVR/hifigan-denoiser/tree/9bd77c53556e1372b4bbff8dce8b120297cc4e5c |
Reorg | import torch
import torch.nn as nn
class Reorg(nn.Module):
def __init__(self, stride=2):
super(Reorg, self).__init__()
self.stride = stride
def forward(self, x):
assert x.data.dim() == 4
B = x.data.size(0)
C = x.data.size(1)
H = x.data.size(2)
W = x.da... | 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... | CharlesPikachu/YOLO | Reorg | false | 13,460 | [
"MIT"
] | 57 | 950b11c35517c1c3d7d7856b5768c4023c1f89eb | https://github.com/CharlesPikachu/YOLO/tree/950b11c35517c1c3d7d7856b5768c4023c1f89eb |
LayerNorm | import torch
import torch.nn as nn
class LayerNorm(nn.LayerNorm):
def __init__(self, normalized_shape, eps=1e-05, elementwise_affine=True):
"""Layer Norm."""
super(LayerNorm, self).__init__(normalized_shape, eps=eps,
elementwise_affine=elementwise_affine)
def forward(self, x):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | ChavesLiu/pytorch-dc-tts | LayerNorm | false | 13,461 | [
"MIT"
] | 145 | 29a1ab11f69b2c4316ae0a8766e995b96385a29f | https://github.com/ChavesLiu/pytorch-dc-tts/tree/29a1ab11f69b2c4316ae0a8766e995b96385a29f |
LayerNormConv2d | import torch
import torch.nn as nn
import torch.nn.functional
class LayerNormConv2d(nn.Module):
def __init__(self, num_features, eps=1e-05, affine=True):
super().__init__()
self.num_features = num_features
self.affine = affine
self.eps = eps
if self.affine:
sel... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.nn.functional
assert_size_stride = torch._C.... | ChenFengYe/relightable-nr | LayerNormConv2d | false | 13,462 | [
"MIT"
] | 105 | 239a97406f4df01cf5786dcdde58e464395a682d | https://github.com/ChenFengYe/relightable-nr/tree/239a97406f4df01cf5786dcdde58e464395a682d |
maxout | import torch
import torch.nn as nn
import torch.utils.data
class maxout(nn.Module):
"""
maxout network
"""
def __init__(self, in_feature, out_feature, pool_size):
super(maxout, self).__init__()
self.in_feature = in_feature
self.out_feature = out_feature
self.pool_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 import triton_helpers
import torch.nn as nn
import ... | ChenZhongFu/KOBE | maxout | false | 13,463 | [
"MIT"
] | 176 | 710d7556516bdbd9ad971e6ff8b8f625a1a55e5a | https://github.com/ChenZhongFu/KOBE/tree/710d7556516bdbd9ad971e6ff8b8f625a1a55e5a |
Down2d | import torch
import torch.utils.data
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,
str... | 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.... | ChanganVR/hifigan-denoiser | Down2d | false | 13,464 | [
"Apache-2.0"
] | 100 | 9bd77c53556e1372b4bbff8dce8b120297cc4e5c | https://github.com/ChanganVR/hifigan-denoiser/tree/9bd77c53556e1372b4bbff8dce8b120297cc4e5c |
Conv2dSame | import torch
import torch.nn as nn
import torch.nn.functional
class Conv2dSame(torch.nn.Module):
"""2D convolution that pads to keep spatial dimensions equal.
Cannot deal with stride. Only quadratic kernels (=scalar kernel_size).
"""
def __init__(self, in_channels, out_channels, kernel_size, bias=Tru... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.... | ChenFengYe/relightable-nr | Conv2dSame | false | 13,465 | [
"MIT"
] | 105 | 239a97406f4df01cf5786dcdde58e464395a682d | https://github.com/ChenFengYe/relightable-nr/tree/239a97406f4df01cf5786dcdde58e464395a682d |
ResidualConv1dGLU | import math
import torch
import torch.utils.data
import torch.nn.functional as F
import torch.nn as nn
class ResidualConv1dGLU(nn.Module):
"""Residual dilated conv1d + Gated linear unit
Args:
residual_channels (int): Residual input / output channels
gate_channels (int): Gated activation channe... | 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.... | ChanganVR/hifigan-denoiser | ResidualConv1dGLU | false | 13,466 | [
"Apache-2.0"
] | 100 | 9bd77c53556e1372b4bbff8dce8b120297cc4e5c | https://github.com/ChanganVR/hifigan-denoiser/tree/9bd77c53556e1372b4bbff8dce8b120297cc4e5c |
ShapeConv2d | from torch.nn import Module
import math
import torch
import numpy as np
from torch.nn.modules.utils import _pair
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from torch.nn import init
from torch._jit_internal import Optional
from torch.nn.modules.module import Module
class ShapeConv2d(Modu... | 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.nn import Module
import math
import numpy as np
from torch.nn.modules... | COATZ/ShapeConv | ShapeConv2d | false | 13,467 | [
"Apache-2.0"
] | 57 | f34f4e95ee2b69ac645fd5ba608e3c11cfadfded | https://github.com/COATZ/ShapeConv/tree/f34f4e95ee2b69ac645fd5ba608e3c11cfadfded |
Actor | import torch
import numpy as np
import torch.nn as nn
def fanin_init(size, fanin=None):
fanin = fanin or size[0]
v = 1.0 / np.sqrt(fanin)
return torch.Tensor(size).uniform_(-v, v)
class Actor(nn.Module):
def __init__(self, nb_states, nb_actions, hidden1=256, hidden2=128,
init_w=0.003):
... | 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.... | ChangyWen/wolpertinger_ddpg | Actor | false | 13,468 | [
"MIT"
] | 46 | 23e1dcf19dd4bed3cc48f898122c3d57cfc296d3 | https://github.com/ChangyWen/wolpertinger_ddpg/tree/23e1dcf19dd4bed3cc48f898122c3d57cfc296d3 |
Actor | import torch
import torch.nn as nn
import torch.nn.functional as F
class Actor(nn.Module):
def __init__(self, state_dim, action_dim, max_action):
super(Actor, self).__init__()
self.l1 = nn.Linear(state_dim, 400)
self.l2 = nn.Linear(400, 300)
self.l3 = nn.Linear(300, action_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.... | ChenShawn/Adapted_TD3_Robustness_Certification | Actor | false | 13,469 | [
"MIT"
] | 91 | 6b28b031b098a2f0a49f2945f8a669205f09c4fe | https://github.com/ChenShawn/Adapted_TD3_Robustness_Certification/tree/6b28b031b098a2f0a49f2945f8a669205f09c4fe |
Critic | import torch
import torch.nn as nn
import torch.nn.functional as F
class Critic(nn.Module):
def __init__(self, state_dim, action_dim):
super(Critic, self).__init__()
self.l1 = nn.Linear(state_dim + action_dim, 400)
self.l2 = nn.Linear(400, 300)
self.l3 = nn.Linear(300, 1)
def... | 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_... | ChenShawn/Adapted_TD3_Robustness_Certification | Critic | false | 13,470 | [
"MIT"
] | 91 | 6b28b031b098a2f0a49f2945f8a669205f09c4fe | https://github.com/ChenShawn/Adapted_TD3_Robustness_Certification/tree/6b28b031b098a2f0a49f2945f8a669205f09c4fe |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.