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 |
|---|---|---|---|---|---|---|---|---|---|---|
Residential | import torch
class Convlayer(torch.nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=1, stride=1):
super().__init__()
padding = kernel_size // 2
self.refl = torch.nn.ReflectionPad2d(padding)
self.conv = torch.nn.Conv2d(in_channels, out_channels, kernel_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
from torch._inductor.runtime.... | bruchano/ImageStyler | Residential | false | 9,928 | [
"MIT"
] | 0 | 7bde13bc954566088c477065adb5c4e4214c28bb | https://github.com/bruchano/ImageStyler/tree/7bde13bc954566088c477065adb5c4e4214c28bb |
FC_Block | import math
import torch
import torch.nn as nn
import torch.optim
import torch.multiprocessing
from torch.nn.parameter import Parameter
class FullyConnected(nn.Module):
def __init__(self, in_features, out_features, bias=True):
"""
Fully connected layer of learnable weights with learnable 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
import math
import torch.nn as nn
import torch.optim
import torch.multiprocessin... | bouracha/Gen_Motion | FC_Block | false | 9,929 | [
"MIT"
] | 0 | 873caa496d14c9a9723581cdf1464f44db4cf358 | https://github.com/bouracha/Gen_Motion/tree/873caa496d14c9a9723581cdf1464f44db4cf358 |
_BoundaryRefineModule | import torch
from torch import nn
class _BoundaryRefineModule(nn.Module):
def __init__(self, dim):
super(_BoundaryRefineModule, self).__init__()
self.relu = nn.ReLU(inplace=True)
self.conv1 = nn.Conv2d(dim, dim, kernel_size=3, padding=1)
self.conv2 = nn.Conv2d(dim, dim, kernel_siz... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | adynathos/pytorch-semantic-segmentation | _BoundaryRefineModule | false | 9,930 | [
"MIT"
] | 0 | 44d1784984cfd0926821c3fdbc20d371bb074296 | https://github.com/adynathos/pytorch-semantic-segmentation/tree/44d1784984cfd0926821c3fdbc20d371bb074296 |
GraphGaussianBlock | import math
import torch
import torch.nn as nn
import torch.optim
import torch.multiprocessing
from torch.nn.parameter import Parameter
class GraphConvolution(nn.Module):
def __init__(self, in_features, out_features, bias=True, node_n=48,
out_node_n=None):
super(GraphConvolution, 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
import math
import torch.nn a... | bouracha/Gen_Motion | GraphGaussianBlock | false | 9,931 | [
"MIT"
] | 0 | 873caa496d14c9a9723581cdf1464f44db4cf358 | https://github.com/bouracha/Gen_Motion/tree/873caa496d14c9a9723581cdf1464f44db4cf358 |
SpatialAttention2d | import torch
import torch.nn as nn
class SpatialAttention2d(nn.Module):
def __init__(self, channel):
super(SpatialAttention2d, self).__init__()
self.squeeze = nn.Conv2d(channel, 1, kernel_size=1, bias=False)
self.sigmoid = nn.Sigmoid()
def forward(self, x):
z = self.squeeze(x... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | advian123/kaggle-birdsong-recognition | SpatialAttention2d | false | 9,932 | [
"MIT"
] | 0 | a4ca8ab81e166b919452fb5d6ca4c2912c65e904 | https://github.com/advian123/kaggle-birdsong-recognition/tree/a4ca8ab81e166b919452fb5d6ca4c2912c65e904 |
LSoftLoss | import torch
import torch.nn.functional as F
import torch.nn as nn
class LSoftLoss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, y_pred, y_true, beta):
with torch.no_grad():
y_true_updated = beta * y_true + (1 - beta) * y_pred
return F.binary_cross_... | 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... | advian123/kaggle-birdsong-recognition | LSoftLoss | false | 9,933 | [
"MIT"
] | 0 | a4ca8ab81e166b919452fb5d6ca4c2912c65e904 | https://github.com/advian123/kaggle-birdsong-recognition/tree/a4ca8ab81e166b919452fb5d6ca4c2912c65e904 |
LanguageModelCriterion | import torch
import torch.nn as nn
from torch.autograd import *
def to_contiguous(tensor):
if tensor.is_contiguous():
return tensor
else:
return tensor.contiguous()
class LanguageModelCriterion(nn.Module):
def __init__(self):
super(LanguageModelCriterion, self).__init__()
d... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from torch.autograd import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | curlG0/videotime | LanguageModelCriterion | false | 9,934 | [
"MIT"
] | 0 | 4eba44d148ba2d11f9bf2e9ba3ea9a3ecac70721 | https://github.com/curlG0/videotime/tree/4eba44d148ba2d11f9bf2e9ba3ea9a3ecac70721 |
DownsampleA | import torch
import torch.nn as nn
class DownsampleA(nn.Module):
def __init__(self, nIn, nOut, stride):
super(DownsampleA, self).__init__()
self.avg = nn.AvgPool2d(kernel_size=1, stride=stride)
def forward(self, x):
x = self.avg(x)
return torch.cat((x, x.mul(0)), 1)
def get... | 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... | code-inter/leak | DownsampleA | false | 9,935 | [
"MIT"
] | 0 | 0e2b12a42f5fbaac4c5fa68627a21aa9a2f3d1d6 | https://github.com/code-inter/leak/tree/0e2b12a42f5fbaac4c5fa68627a21aa9a2f3d1d6 |
VGG19Decoder2 | import torch
import torch.nn as nn
from collections import OrderedDict
class VGG19Decoder2(nn.Module):
def __init__(self):
super(VGG19Decoder2, self).__init__()
self.blocks = OrderedDict([('pad2_1', nn.ReflectionPad2d(1)), (
'conv2_1', nn.Conv2d(128, 64, 3, 1, 0)), ('relu2_1', nn.ReLU... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | chenhsiu48/PytorchWCT | VGG19Decoder2 | false | 9,936 | [
"MIT"
] | 0 | c3346ebaec95358ad1d4d5a519d5d0e7de73bc75 | https://github.com/chenhsiu48/PytorchWCT/tree/c3346ebaec95358ad1d4d5a519d5d0e7de73bc75 |
SCse | import torch
import torch.nn as nn
class SpatialAttention2d(nn.Module):
def __init__(self, channel):
super(SpatialAttention2d, self).__init__()
self.squeeze = nn.Conv2d(channel, 1, kernel_size=1, bias=False)
self.sigmoid = nn.Sigmoid()
def forward(self, x):
z = self.squeeze(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
assert_... | advian123/kaggle-birdsong-recognition | SCse | false | 9,937 | [
"MIT"
] | 0 | a4ca8ab81e166b919452fb5d6ca4c2912c65e904 | https://github.com/advian123/kaggle-birdsong-recognition/tree/a4ca8ab81e166b919452fb5d6ca4c2912c65e904 |
Model | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self):
super(Model, self).__init__()
self.linear1 = nn.Linear(28 * 28, 32)
self.linear2 = nn.Linear(32, 10)
def forward(self, inputs):
x = inputs.view(-1, 28 * 28)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | codeislife99/pytorch-meta-optimizer | Model | false | 9,938 | [
"MIT"
] | 0 | 24f00be05e6e173efa67fe953e466bdf1dcb50e9 | https://github.com/codeislife99/pytorch-meta-optimizer/tree/24f00be05e6e173efa67fe953e466bdf1dcb50e9 |
CatRepr | import torch
import torch.nn as nn
class CatRepr(nn.Module):
def __init__(self):
super().__init__()
def forward(self, data_list):
cat_regions = [torch.cat([hidden[0], torch.mean(hidden, dim=0),
hidden[-1]], dim=-1).view(1, -1) for hidden in data_list]
cat_out = torch.cat(... | 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... | csJd/CRANN | CatRepr | false | 9,939 | [
"MIT"
] | 0 | 8139b19b84ec11eff3c801185e4bfa974766d599 | https://github.com/csJd/CRANN/tree/8139b19b84ec11eff3c801185e4bfa974766d599 |
Residual_module | import torch
import torch.nn as nn
class Residual_module(nn.Module):
def __init__(self, in_ch):
super(Residual_module, self).__init__()
self.prelu1 = nn.PReLU(in_ch, 0)
self.prelu2 = nn.PReLU(in_ch, 0)
self.conv1_1by1 = nn.Conv2d(in_channels=in_ch, out_channels=in_ch,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | csm9493/FC-AIDE-Pytorch | Residual_module | false | 9,940 | [
"MIT"
] | 0 | 8ac7e4ee675824af002419650428948e60930712 | https://github.com/csm9493/FC-AIDE-Pytorch/tree/8ac7e4ee675824af002419650428948e60930712 |
LayerNorm1D | import torch
import torch.nn as nn
class LayerNorm1D(nn.Module):
def __init__(self, num_outputs, eps=1e-05, affine=True):
super(LayerNorm1D, self).__init__()
self.eps = eps
self.weight = nn.Parameter(torch.ones(1, num_outputs))
self.bias = nn.Parameter(torch.zeros(1, num_outputs))... | 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_... | codeislife99/pytorch-meta-optimizer | LayerNorm1D | false | 9,941 | [
"MIT"
] | 0 | 24f00be05e6e173efa67fe953e466bdf1dcb50e9 | https://github.com/codeislife99/pytorch-meta-optimizer/tree/24f00be05e6e173efa67fe953e466bdf1dcb50e9 |
PhonyLanguageModel | import torch
import torch.nn as nn
import torch.nn.functional as F
class PhonyLanguageModel(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
lm_x = x.clone().detach().float() * 0
return F.log_softmax(lm_x, 1)
def get_inputs():
return [torch.rand([4, 4, 4... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | daemon/vivi | PhonyLanguageModel | false | 9,942 | [
"MIT"
] | 0 | 6b7819006c944a756bf8a7b6d8beed92d19eb51a | https://github.com/daemon/vivi/tree/6b7819006c944a756bf8a7b6d8beed92d19eb51a |
CDCM | import torch
import torch.nn as nn
class CDCM(nn.Module):
"""
Compact Dilation Convolution based Module
"""
def __init__(self, in_channels, out_channels):
super(CDCM, self).__init__()
self.relu1 = nn.ReLU()
self.conv1 = nn.Conv2d(in_channels, out_channels, kernel_size=1,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | arkel23/mmgeneration | CDCM | false | 9,943 | [
"Apache-2.0"
] | 0 | 41a30e2972f2037f6aac60ed761bed3fe47bfe4d | https://github.com/arkel23/mmgeneration/tree/41a30e2972f2037f6aac60ed761bed3fe47bfe4d |
DenoisingDownsample | import torch
import torch.nn as nn
class DenoisingDownsample(nn.Module):
"""Downsampling operation used in the denoising network. Support average
pooling and convolution for downsample operation.
Args:
in_channels (int): Number of channels of the input feature map to be
downsampled.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | arkel23/mmgeneration | DenoisingDownsample | false | 9,944 | [
"Apache-2.0"
] | 0 | 41a30e2972f2037f6aac60ed761bed3fe47bfe4d | https://github.com/arkel23/mmgeneration/tree/41a30e2972f2037f6aac60ed761bed3fe47bfe4d |
Transformer | import torch
class Convlayer(torch.nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=1, stride=1):
super().__init__()
padding = kernel_size // 2
self.refl = torch.nn.ReflectionPad2d(padding)
self.conv = torch.nn.Conv2d(in_channels, out_channels, kernel_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
from torch._inductor.runtime.... | bruchano/ImageStyler | Transformer | false | 9,945 | [
"MIT"
] | 0 | 7bde13bc954566088c477065adb5c4e4214c28bb | https://github.com/bruchano/ImageStyler/tree/7bde13bc954566088c477065adb5c4e4214c28bb |
CSAM | import torch
import torch.nn as nn
class CSAM(nn.Module):
"""
Compact Spatial Attention Module
"""
def __init__(self, channels):
super(CSAM, self).__init__()
mid_channels = 4
self.relu1 = nn.ReLU()
self.conv1 = nn.Conv2d(channels, mid_channels, kernel_size=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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | arkel23/mmgeneration | CSAM | false | 9,946 | [
"Apache-2.0"
] | 0 | 41a30e2972f2037f6aac60ed761bed3fe47bfe4d | https://github.com/arkel23/mmgeneration/tree/41a30e2972f2037f6aac60ed761bed3fe47bfe4d |
MiniBatchStddevLayer | import torch
import torch.nn as nn
import torch.distributed as dist
import torch.autograd as autograd
class AllGatherLayer(autograd.Function):
"""All gather layer with backward propagation path.
Indeed, this module is to make ``dist.all_gather()`` in the backward graph.
Such kind of operation has been wi... | 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.distributed as dist
import torch.autograd as... | arkel23/mmgeneration | MiniBatchStddevLayer | false | 9,947 | [
"Apache-2.0"
] | 0 | 41a30e2972f2037f6aac60ed761bed3fe47bfe4d | https://github.com/arkel23/mmgeneration/tree/41a30e2972f2037f6aac60ed761bed3fe47bfe4d |
AdaptiveInstanceNorm | import torch
import torch.nn as nn
from torch.nn.init import _calculate_correct_fan
def equalized_lr(module, name='weight', gain=2 ** 0.5, mode='fan_in',
lr_mul=1.0):
"""Equalized Learning Rate.
This trick is proposed in:
Progressive Growing of GANs for Improved Quality, Stability, and Variation
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | arkel23/mmgeneration | AdaptiveInstanceNorm | false | 9,948 | [
"Apache-2.0"
] | 0 | 41a30e2972f2037f6aac60ed761bed3fe47bfe4d | https://github.com/arkel23/mmgeneration/tree/41a30e2972f2037f6aac60ed761bed3fe47bfe4d |
PDCBlock_converted | import torch
import torch.nn as nn
class PDCBlock_converted(nn.Module):
"""
CPDC, APDC can be converted to vanilla 3x3 convolution
RPDC can be converted to vanilla 5x5 convolution
"""
def __init__(self, pdc, inplane, ouplane, stride=1):
super(PDCBlock_converted, self).__init__()
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_... | arkel23/mmgeneration | PDCBlock_converted | false | 9,949 | [
"Apache-2.0"
] | 0 | 41a30e2972f2037f6aac60ed761bed3fe47bfe4d | https://github.com/arkel23/mmgeneration/tree/41a30e2972f2037f6aac60ed761bed3fe47bfe4d |
Sine | import torch
import torch.nn as nn
class Sine(nn.Module):
def __init__(self, w0: 'float'=30.0):
super(Sine, self).__init__()
self.w0 = w0
def forward(self, x: 'torch.Tensor') ->torch.Tensor:
return torch.sin(self.w0 * x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | brandstetter-johannes/ocp | Sine | false | 9,950 | [
"MIT",
"BSD-3-Clause"
] | 0 | 69cc90e6bed8aa09222cd77b926d7a34e96302ed | https://github.com/brandstetter-johannes/ocp/tree/69cc90e6bed8aa09222cd77b926d7a34e96302ed |
wide_basic | import torch
import torch.nn as nn
def get_norm(n_filters, norm):
if norm is None:
return Identity()
elif norm == 'batch':
return nn.BatchNorm2d(n_filters, momentum=0.9)
elif norm == 'instance':
return nn.InstanceNorm2d(n_filters, affine=True)
elif norm == 'layer':
retu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | csadrian/JEM | wide_basic | false | 9,951 | [
"Apache-2.0"
] | 0 | 72d9af20126cf1410506b2c149d740a41ef04e78 | https://github.com/csadrian/JEM/tree/72d9af20126cf1410506b2c149d740a41ef04e78 |
BertPooler | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class BertPooler(nn.Module):
def __init__(self, config):
super(BertPooler, self).__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.activation = nn.Tanh()
def forward(self, hi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | Ago3/VLP | BertPooler | false | 9,952 | [
"Apache-2.0"
] | 0 | 4dec0e04b8592f4a74fe66c253dbb92574e7e2ba | https://github.com/Ago3/VLP/tree/4dec0e04b8592f4a74fe66c253dbb92574e7e2ba |
DuelingDeepQNetwork | import torch
import torch as T
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
class DuelingDeepQNetwork(nn.Module):
def __init__(self, lr, input_dim, output_dim, fc1_dim, fc2_dim):
super(DuelingDeepQNetwork, self).__init__()
self.fc1 = nn.Linear(input_dim, fc1_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
import torch as T
import torc... | MonteyMontey/deep-reinforcement-learning-sandbox | DuelingDeepQNetwork | false | 9,953 | [
"MIT"
] | 0 | 0e93760a994b6af54f0a665f5bc4f9d5ffd45c0a | https://github.com/MonteyMontey/deep-reinforcement-learning-sandbox/tree/0e93760a994b6af54f0a665f5bc4f9d5ffd45c0a |
BertIntermediate | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
def gelu(x):
"""Gaussian Error Linear Unitという活性化関数です。
LeLUが0でカクっと不連続なので、そこを連続になるように滑らかにした形のLeLUです。
"""
return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0)))
class BertIntermediate(nn.Module):
"""BERTのTra... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
from to... | Cyndi-Tokyotech/Fin_Text_Analysis_ML | BertIntermediate | false | 9,954 | [
"MIT"
] | 0 | 7f9b6c1ea78f8e6f32c003b2de32809722df88d4 | https://github.com/Cyndi-Tokyotech/Fin_Text_Analysis_ML/tree/7f9b6c1ea78f8e6f32c003b2de32809722df88d4 |
PyTorchMLP | import torch
import torch.nn as nn
class PyTorchMLP(nn.Module):
"""
A feed forward network to make single step predictions on 1D time series data.
"""
def __init__(self, inputsize, prefix):
super(PyTorchMLP, self).__init__()
self.fc1 = nn.Linear(in_features=inputsize, out_features=rou... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | danvran/ASM | PyTorchMLP | false | 9,955 | [
"MIT"
] | 0 | e678fa507f847ec2ff947ec4ca123858ffe46d4d | https://github.com/danvran/ASM/tree/e678fa507f847ec2ff947ec4ca123858ffe46d4d |
GaussianSmearing | import torch
import torch.nn as nn
class GaussianSmearing(nn.Module):
def __init__(self, in_features, start=0, end=1, num_freqs=50):
super(GaussianSmearing, self).__init__()
self.num_freqs = num_freqs
offset = torch.linspace(start, end, num_freqs)
self.coeff = -0.5 / (offset[1] - ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | brandstetter-johannes/ocp | GaussianSmearing | false | 9,956 | [
"MIT",
"BSD-3-Clause"
] | 0 | 69cc90e6bed8aa09222cd77b926d7a34e96302ed | https://github.com/brandstetter-johannes/ocp/tree/69cc90e6bed8aa09222cd77b926d7a34e96302ed |
GatedLinear | import torch
import torch.nn as nn
class GatedLinear(nn.Module):
def __init__(self, input_size, output_size):
super(GatedLinear, self).__init__()
self.linear = nn.Linear(input_size, output_size * 2)
self.glu = nn.GLU(dim=-1)
def forward(self, x, y=None, x_mask=None, y_mask=None, rel_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | cuiyuhao1996/mmnas | GatedLinear | false | 9,957 | [
"Apache-2.0"
] | 0 | d62e0b3ddc6d15e8f01d0d66367e05fc9691cd3b | https://github.com/cuiyuhao1996/mmnas/tree/d62e0b3ddc6d15e8f01d0d66367e05fc9691cd3b |
LayerNorm | import torch
import torch.nn.init
import torch.optim.lr_scheduler
import torch.nn
import torch.autograd
class LayerNorm(torch.nn.Module):
"""
An implementation of `Layer Normalization
<https://www.semanticscholar.org/paper/Layer-Normalization-Ba-Kiros/97fb4e3d45bb098e27e0071448b6152217bd35a5>`_ .
Lay... | 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.init
import torch.optim.lr_scheduler
import torch.nn
import tor... | codedecde/BiMPM | LayerNorm | false | 9,958 | [
"Apache-2.0"
] | 0 | 818602fcf7a018632707b8fbfe33200036795731 | https://github.com/codedecde/BiMPM/tree/818602fcf7a018632707b8fbfe33200036795731 |
Linear | import math
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from torch.nn import Parameter
import torch.cuda
import torch.distributed
def quantize_weights(W, numbits=8):
W = W.clamp(-2 ** (numbits - 1), 2 ** (numbits - 1))
W = W.mu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | csk7/CS550-NLP-McGill- | Linear | false | 9,959 | [
"MIT"
] | 0 | a6f295b88539015d8accdbd410357c42df7c4287 | https://github.com/csk7/CS550-NLP-McGill-/tree/a6f295b88539015d8accdbd410357c42df7c4287 |
FCN32s | import torch
import numpy as np
from torch import 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
o... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
from torch... | Yusoi/mmdetection | FCN32s | false | 9,960 | [
"Apache-2.0"
] | 0 | cbb5fb00f6e124fbb2c15e7e3438d7fa76b8850a | https://github.com/Yusoi/mmdetection/tree/cbb5fb00f6e124fbb2c15e7e3438d7fa76b8850a |
ResBlock | import torch
import torch.nn as nn
class ResBlock(nn.Module):
def __init__(self, input_channels: 'int', output_channels: 'int',
batch_norm=False) ->None:
super().__init__()
self.conv1 = nn.Conv2d(input_channels, output_channels, kernel_size
=3, stride=1, padding=1)
sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | cluePrints/fsdl-text-recognizer-2021-labs | ResBlock | false | 9,961 | [
"MIT"
] | 0 | d166dcbd00513b2f0031fbc991af3a852bc2d605 | https://github.com/cluePrints/fsdl-text-recognizer-2021-labs/tree/d166dcbd00513b2f0031fbc991af3a852bc2d605 |
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, 1024)
self.l2 = nn.Linear(1024, 512)
self.l3 = nn.Linear(512, 256)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | ctoto93/TD3 | Critic | false | 9,962 | [
"MIT"
] | 0 | 88482b9f1fb4441d74426ece60d5da13414aeb77 | https://github.com/ctoto93/TD3/tree/88482b9f1fb4441d74426ece60d5da13414aeb77 |
Swish | import torch
import torch.nn as nn
class Swish(nn.Module):
def __init__(self, beta=1):
super(Swish, self).__init__()
self.beta = beta
def forward(self, x):
return x * torch.sigmoid(self.beta * x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
r... | 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... | brandstetter-johannes/ocp | Swish | false | 9,963 | [
"MIT",
"BSD-3-Clause"
] | 0 | 69cc90e6bed8aa09222cd77b926d7a34e96302ed | https://github.com/brandstetter-johannes/ocp/tree/69cc90e6bed8aa09222cd77b926d7a34e96302ed |
Module_CharbonnierLoss | import torch
import torch.nn as nn
class Module_CharbonnierLoss(nn.Module):
def __init__(self, epsilon=0.001):
super(Module_CharbonnierLoss, self).__init__()
self.epsilon = epsilon
def forward(self, output, gt):
return torch.mean(torch.sqrt((output - gt) ** 2 + self.epsilon ** 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
import torch.nn as nn
assert... | danielism97/FLAVR | Module_CharbonnierLoss | false | 9,964 | [
"Apache-2.0"
] | 0 | 17f62c681bb2a5799e3bc23cf60936ac4d2b9407 | https://github.com/danielism97/FLAVR/tree/17f62c681bb2a5799e3bc23cf60936ac4d2b9407 |
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, 1024)
self.l2 = nn.Linear(1024, 512)
self.l3 = nn.Linear(512, 256)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ctoto93/TD3 | Actor | false | 9,965 | [
"MIT"
] | 0 | 88482b9f1fb4441d74426ece60d5da13414aeb77 | https://github.com/ctoto93/TD3/tree/88482b9f1fb4441d74426ece60d5da13414aeb77 |
SeqRNN | import torch
import torch.nn as nn
class SeqRNN(nn.Module):
def __init__(self, input_size, hidden_size, output_size, n_layers):
super(SeqRNN, self).__init__()
self.hidden_size = hidden_size
self.i2h = nn.Linear(in_features=input_size + hidden_size,
out_features=hidden_size)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | dblakely/FastSK | SeqRNN | false | 9,966 | [
"Apache-2.0"
] | 0 | bd0d4cef89c3d7d661f4c6abc094423ab6d1c7e1 | https://github.com/dblakely/FastSK/tree/bd0d4cef89c3d7d661f4c6abc094423ab6d1c7e1 |
ToeplitzBlock | import torch
import torch.nn as nn
def expand_toeplitz(diag, lower_diags, upper_diags):
pattern = torch.cat([upper_diags, diag, lower_diags], 0)
d = lower_diags.size(0)
columns = []
for i in range(d + 1):
columns.append(pattern[d - i:d - i + d + 1])
return torch.stack(columns, 0)
class 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
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | daemon/toepl.it.z | ToeplitzBlock | false | 9,967 | [
"MIT"
] | 0 | b16754b11f03f33bbfa05cf8544ef0dca3574ed4 | https://github.com/daemon/toepl.it.z/tree/b16754b11f03f33bbfa05cf8544ef0dca3574ed4 |
GlobalAttention | import math
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from torch.nn import Parameter
import torch.cuda
import torch.distributed
def quantize_weights(W, numbits=8):
W = W.clamp(-2 ** (numbits - 1), 2 ** (numbits - 1))
W = W.mu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | csk7/CS550-NLP-McGill- | GlobalAttention | false | 9,968 | [
"MIT"
] | 0 | a6f295b88539015d8accdbd410357c42df7c4287 | https://github.com/csk7/CS550-NLP-McGill-/tree/a6f295b88539015d8accdbd410357c42df7c4287 |
BBoxTransform | import torch
from torch import nn
class BBoxTransform(nn.Module):
def forward(self, anchors, regression):
"""
decode_box_outputs adapted from https://github.com/google/automl/blob/master/efficientdet/anchors.py
Args:
anchors: [batchsize, boxes, (y1, x1, y2, x2)]
r... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_... | cosmos1982/pytorch_efficientdet_openvino_demo | BBoxTransform | false | 9,969 | [
"Apache-2.0"
] | 0 | f626af448a827c0df655eb2af52ae3dbd10f2478 | https://github.com/cosmos1982/pytorch_efficientdet_openvino_demo/tree/f626af448a827c0df655eb2af52ae3dbd10f2478 |
DuelingQNetwork | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.nn.functional as F
class DuelingQNetwork(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, config_dict):
"""Initialize parameters and build model.
Params
===... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | czarrar/udacity_rl | DuelingQNetwork | false | 9,970 | [
"MIT"
] | 0 | d5e9a878b24e6234ab4ac9f612be103bb7f933c4 | https://github.com/czarrar/udacity_rl/tree/d5e9a878b24e6234ab4ac9f612be103bb7f933c4 |
GlyphNet | import torch
from torch import nn
from torch.nn import functional as f
class GlyphNet(nn.Module):
def __init__(self, dimension):
super().__init__()
self.conv1 = nn.Conv2d(3, 32, 3, padding=1)
self.conv2 = nn.Conv2d(32, 32, 3, padding=1)
self.fc = nn.Linear(32, dimension)
n... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | cmsflash/ocean-text | GlyphNet | false | 9,971 | [
"MIT"
] | 0 | d2f98077cb5e6949aec87f88a369ba4c2e99d178 | https://github.com/cmsflash/ocean-text/tree/d2f98077cb5e6949aec87f88a369ba4c2e99d178 |
NanoNet | import torch
from torch import nn
from torch.nn import functional as f
class NanoNet(nn.Module):
def __init__(self, dimension):
super().__init__()
self.conv1 = nn.Conv2d(1, 32, 3, padding=1)
self.conv2 = nn.Conv2d(32, 32, 3, padding=1)
self.conv3 = nn.Conv2d(32, 32, 3, padding=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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | cmsflash/ocean-text | NanoNet | false | 9,972 | [
"MIT"
] | 0 | d2f98077cb5e6949aec87f88a369ba4c2e99d178 | https://github.com/cmsflash/ocean-text/tree/d2f98077cb5e6949aec87f88a369ba4c2e99d178 |
VGGSiameseNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class VGGSiameseNet(nn.Module):
def __init__(self):
super(VGGSiameseNet, self).__init__()
self.conv11 = nn.Conv2d(1, 64, 3)
self.conv12 = nn.Conv2d(64, 64, 3)
self.conv21 = nn.Conv2d(64, 128, 3)
self.conv22... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | christnp/comse6998-project | VGGSiameseNet | false | 9,973 | [
"MIT"
] | 0 | 7deffaceb945ae0bd4851ff9478a7efe6e486d39 | https://github.com/christnp/comse6998-project/tree/7deffaceb945ae0bd4851ff9478a7efe6e486d39 |
IrisClassifier | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class IrisClassifier(nn.Module):
def __init__(self):
super(IrisClassifier, self).__init__()
self.fc1 = nn.Linear(4, 100)
self.fc2 = nn.Linear(100, 100)
self.fc3 = nn.Linear(100, 3)
s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | dbinoy/pytorch-iris-sagemaker | IrisClassifier | false | 9,974 | [
"MIT-0"
] | 0 | afc5bd95f6dd0431338708bc179029fa08724a2f | https://github.com/dbinoy/pytorch-iris-sagemaker/tree/afc5bd95f6dd0431338708bc179029fa08724a2f |
Gated_Recurrent_Unit | import torch
from torchvision.transforms import functional as F
import torch.utils.data
from torch import nn
import torch.nn.functional as F
class Gated_Recurrent_Unit(nn.Module):
def __init__(self, fea_size, dropout):
super(Gated_Recurrent_Unit, self).__init__()
self.wih = nn.Linear(fea_size, fe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
from ... | champon1020/scene_graph_benchmark | Gated_Recurrent_Unit | false | 9,975 | [
"MIT"
] | 0 | 970a7499f8fa2854810bd650f6c991bcad5748db | https://github.com/champon1020/scene_graph_benchmark/tree/970a7499f8fa2854810bd650f6c991bcad5748db |
SimpleNet | import torch
import torch.nn as nn
class SimpleNet(nn.Module):
def __init__(self, width, input_size, output_size, pool='max'):
super(SimpleNet, self).__init__()
self.pool = nn.MaxPool2d(width, stride=width
) if pool == 'max' else nn.AvgPool2d(width, stride=width)
self.fc1 = nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | daniel-zeng/SegSort | SimpleNet | false | 9,976 | [
"MIT"
] | 0 | 7a50e6253df23a7719f962b34acff2626c916354 | https://github.com/daniel-zeng/SegSort/tree/7a50e6253df23a7719f962b34acff2626c916354 |
Message_Passing_Unit_v2 | import torch
from torchvision.transforms import functional as F
import torch.utils.data
from torch import nn
import torch.nn.functional as F
class Message_Passing_Unit_v2(nn.Module):
def __init__(self, fea_size, filter_size=128):
super(Message_Passing_Unit_v2, self).__init__()
self.w = nn.Linear(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
from ... | champon1020/scene_graph_benchmark | Message_Passing_Unit_v2 | false | 9,977 | [
"MIT"
] | 0 | 970a7499f8fa2854810bd650f6c991bcad5748db | https://github.com/champon1020/scene_graph_benchmark/tree/970a7499f8fa2854810bd650f6c991bcad5748db |
QNetwork | import torch
import torch.nn.functional as F
import torch.nn as nn
class QNetwork(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, fc1_units=37,
fc2_units=64):
"""Initialize parameters and build model.
Params
======
state_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 torch.nn as nn
assert_... | deeplearningrobotics/p1nav | QNetwork | false | 9,978 | [
"Apache-2.0"
] | 0 | 433ff8d8b5fec6c8bb3c346e5b8dfff2865f4a55 | https://github.com/deeplearningrobotics/p1nav/tree/433ff8d8b5fec6c8bb3c346e5b8dfff2865f4a55 |
ScModel | import torch
import torch as t
import torch.nn as nn
from torch.nn.parameter import Parameter
class ScModel(nn.Module):
""" Model for singel cell data """
def __init__(self, n_genes: 'int', n_celltypes: 'int', device: 't.device'
) ->None:
super().__init__()
self.K = n_celltypes
... | 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... | denizcangi/stereoscope | ScModel | false | 9,979 | [
"MIT"
] | 0 | cfe70e5d1e174dedd2d1a0c4a86ae0131e8e4218 | https://github.com/denizcangi/stereoscope/tree/cfe70e5d1e174dedd2d1a0c4a86ae0131e8e4218 |
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.... | Ago3/VLP | BertSelfAttention | false | 9,980 | [
"Apache-2.0"
] | 0 | 4dec0e04b8592f4a74fe66c253dbb92574e7e2ba | https://github.com/Ago3/VLP/tree/4dec0e04b8592f4a74fe66c253dbb92574e7e2ba |
TianzigeCNN | import torch
from torch import nn
from torch.nn import functional as f
class TianzigeCNN(nn.Module):
def __init__(self, dimension):
super().__init__()
self.conv1 = nn.Conv2d(3, 1024, 5)
self.relu = nn.ReLU(inplace=True)
self.max_pool = nn.MaxPool2d(4)
self.conv2 = nn.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
from torch import nn
assert_s... | cmsflash/ocean-text | TianzigeCNN | false | 9,981 | [
"MIT"
] | 0 | d2f98077cb5e6949aec87f88a369ba4c2e99d178 | https://github.com/cmsflash/ocean-text/tree/d2f98077cb5e6949aec87f88a369ba4c2e99d178 |
MaskedCrossEntropyCriterion | import torch
import torch.nn as nn
from torch.nn.modules.loss import _WeightedLoss
class MaskedCrossEntropyCriterion(_WeightedLoss):
def __init__(self, ignore_index=[-100], reduce=None):
super(MaskedCrossEntropyCriterion, self).__init__()
self.padding_idx = ignore_index
self.reduce = redu... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch.nn.modules.... | dataJSA/batch7_tomorrow_datascience | MaskedCrossEntropyCriterion | false | 9,982 | [
"MIT"
] | 0 | e2dc6bc59c456fa927e0a1f6d12024ba410f520c | https://github.com/dataJSA/batch7_tomorrow_datascience/tree/e2dc6bc59c456fa927e0a1f6d12024ba410f520c |
InstanceLayerNorm2d | import torch
import torch.nn as nn
class InstanceLayerNorm2d(nn.Module):
def __init__(self, num_features, eps=1e-05, momentum=0.9,
using_moving_average=True, using_bn=False):
super(InstanceLayerNorm2d, self).__init__()
self.eps = eps
self.momentum = momentum
self.using_mov... | 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... | belphegor2211/khoa_luan | InstanceLayerNorm2d | false | 9,983 | [
"MIT"
] | 0 | c9c163ebf3aff3005639ce7e4020e510295d1c75 | https://github.com/belphegor2211/khoa_luan/tree/c9c163ebf3aff3005639ce7e4020e510295d1c75 |
Message_Passing_Unit_v1 | import torch
from torchvision.transforms import functional as F
import torch.utils.data
from torch import nn
import torch.nn.functional as F
class Message_Passing_Unit_v1(nn.Module):
def __init__(self, fea_size, filter_size=128):
super(Message_Passing_Unit_v1, self).__init__()
self.w = nn.Linear(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
from ... | champon1020/scene_graph_benchmark | Message_Passing_Unit_v1 | false | 9,984 | [
"MIT"
] | 0 | 970a7499f8fa2854810bd650f6c991bcad5748db | https://github.com/champon1020/scene_graph_benchmark/tree/970a7499f8fa2854810bd650f6c991bcad5748db |
CosMargin | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class CosMargin(nn.Module):
def __init__(self, in_size, out_size, s=None, m=0.0):
super(CosMargin, self).__init__()
self.in_size = in_size
self.out_size = out_size
self.W = nn.Parameter(torch.randn(out_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | belphegor2211/khoa_luan | CosMargin | false | 9,985 | [
"MIT"
] | 0 | c9c163ebf3aff3005639ce7e4020e510295d1c75 | https://github.com/belphegor2211/khoa_luan/tree/c9c163ebf3aff3005639ce7e4020e510295d1c75 |
MultiheadAttention | import torch
import torch.nn as nn
from torch.nn import Parameter
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_nam... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | dataJSA/batch7_tomorrow_datascience | MultiheadAttention | false | 9,986 | [
"MIT"
] | 0 | e2dc6bc59c456fa927e0a1f6d12024ba410f520c | https://github.com/dataJSA/batch7_tomorrow_datascience/tree/e2dc6bc59c456fa927e0a1f6d12024ba410f520c |
Model | import torch
import torch.nn as nn
import torch._C
import torch.serialization
class Model(nn.Module):
def __init__(self):
super().__init__()
self.conv = nn.Conv2d(2, 2, 1)
def forward(self, x):
return self.conv(x)
def get_inputs():
return [torch.rand([4, 2, 64, 64])]
def get_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
assert_size_str... | devolfnn/mmsegmentation | Model | false | 9,987 | [
"Apache-2.0"
] | 0 | c0dccc1725b80b643419cc008cb93e8dcb4209c8 | https://github.com/devolfnn/mmsegmentation/tree/c0dccc1725b80b643419cc008cb93e8dcb4209c8 |
DiceBCELoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class DiceBCELoss(nn.Module):
def __init__(self):
super(DiceBCELoss, self).__init__()
def forward(self, predicted, target):
batch = predicted.size()[0]
batch_loss = 0
smooth = 1
for index in range(batc... | 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... | daoducanhc/Tumor_Segmentation | DiceBCELoss | false | 9,988 | [
"MIT"
] | 0 | 485a70492f7efb65a0f88f61a0eeffd6f0c92cc9 | https://github.com/daoducanhc/Tumor_Segmentation/tree/485a70492f7efb65a0f88f61a0eeffd6f0c92cc9 |
_ASPP | import torch
import torch.nn as nn
class _ASPP(nn.Module):
"""
Atrous spatial pyramid pooling (ASPP)
"""
def __init__(self, in_ch, out_ch, rates):
super(_ASPP, self).__init__()
self.aspp_num = len(rates)
for i, rate in enumerate(rates):
self.add_module('c{}'.format... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | developfeng/BCM | _ASPP | false | 9,989 | [
"BSD-3-Clause-Attribution"
] | 0 | 8eb5ac950a2d67d10fc707519bb66cd9ea4f14f2 | https://github.com/developfeng/BCM/tree/8eb5ac950a2d67d10fc707519bb66cd9ea4f14f2 |
AR | import torch
import torch.nn as nn
class AR(nn.Module):
def __init__(self, window):
super(AR, self).__init__()
self.linear = nn.Linear(window, 1)
def forward(self, x):
x = torch.transpose(x, 1, 2)
x = self.linear(x)
x = torch.transpose(x, 1, 2)
return x
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | chenghaoliu89/TSForecasting_FT | AR | false | 9,990 | [
"MIT"
] | 0 | e29227e67f754919672eab9002a1b37b13ed28a0 | https://github.com/chenghaoliu89/TSForecasting_FT/tree/e29227e67f754919672eab9002a1b37b13ed28a0 |
MODEL | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class MODEL(nn.Module):
def __init__(self, args):
super(MODEL, self).__init__()
self.fc = nn.Linear(args.in_dim, 1)
self.sigmoid = nn.Sigmoid()
nn.init.constant_(self.fc.weight, 0)
nn.init.con... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | cuis15/xorder | MODEL | false | 9,991 | [
"MIT"
] | 0 | 6dde5a18552ffa07f29100038464a38c49495527 | https://github.com/cuis15/xorder/tree/6dde5a18552ffa07f29100038464a38c49495527 |
AmdimNCELoss | import torch
import torch.nn as nn
def tanh_clip(x, clip_val=10.0):
"""
soft clip values to the range [-clip_val, +clip_val]
"""
if clip_val is not None:
x_clip = clip_val * torch.tanh(1.0 / clip_val * x)
else:
x_clip = x
return x_clip
class AmdimNCELoss(nn.Module):
"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | bartolkaruza/pytorch-lightning-bolts | AmdimNCELoss | false | 9,992 | [
"Apache-2.0"
] | 0 | 2e903c333c37ea83394c7da2ce826de1b82fb356 | https://github.com/bartolkaruza/pytorch-lightning-bolts/tree/2e903c333c37ea83394c7da2ce826de1b82fb356 |
Net5 | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class Net5(nn.Module):
def __init__(self, n_in, n_out, dropout_p=0.0):
super(Net5, self).__init__()
self.insize = n_in
self.outsize = n_out
self.drop = dropout_p
if self.drop != 0.0:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
import tor... | derangedhk417/ML-Lessons | Net5 | false | 9,993 | [
"MIT"
] | 0 | 3433e3fa6324791b74771fcfd8a6c5361ba69c53 | https://github.com/derangedhk417/ML-Lessons/tree/3433e3fa6324791b74771fcfd8a6c5361ba69c53 |
Conv2dBlock | import torch
import torch.nn as nn
import torch.nn.functional as F
class AdaptiveInstanceLayerNorm2d(nn.Module):
def __init__(self, num_features, eps=1e-05, momentum=0.9,
using_moving_average=True, using_bn=False):
super(AdaptiveInstanceLayerNorm2d, self).__init__()
self.eps = eps
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | belphegor2211/khoa_luan | Conv2dBlock | false | 9,994 | [
"MIT"
] | 0 | c9c163ebf3aff3005639ce7e4020e510295d1c75 | https://github.com/belphegor2211/khoa_luan/tree/c9c163ebf3aff3005639ce7e4020e510295d1c75 |
PositionwiseFeedForward | import torch
import torch.nn as nn
import torch.nn.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.w_1 = nn.Conv1d(d_in, d_hid, 1)
self.w_2 = nn.Conv1d(d_hid, d_in, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | chenghaoliu89/TSForecasting_FT | PositionwiseFeedForward | false | 9,995 | [
"MIT"
] | 0 | e29227e67f754919672eab9002a1b37b13ed28a0 | https://github.com/chenghaoliu89/TSForecasting_FT/tree/e29227e67f754919672eab9002a1b37b13ed28a0 |
CNNCifar | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.nn.functional as F
class CNNCifar(nn.Module):
def __init__(self, args):
super(CNNCifar, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Con... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | C3atUofU/Hierarchical-SGD | CNNCifar | false | 9,996 | [
"MIT"
] | 0 | ecc0f25065f78e70ed8deff7dfc9809331e19f21 | https://github.com/C3atUofU/Hierarchical-SGD/tree/ecc0f25065f78e70ed8deff7dfc9809331e19f21 |
FakeRKHSConvNet | import math
import torch
import numpy as np
import torch.nn as nn
class MaybeBatchNorm2d(nn.Module):
def __init__(self, n_ftr, affine, use_bn):
super(MaybeBatchNorm2d, self).__init__()
self.bn = nn.BatchNorm2d(n_ftr, affine=affine)
self.use_bn = use_bn
def forward(self, x):
i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | bartolkaruza/pytorch-lightning-bolts | FakeRKHSConvNet | false | 9,997 | [
"Apache-2.0"
] | 0 | 2e903c333c37ea83394c7da2ce826de1b82fb356 | https://github.com/bartolkaruza/pytorch-lightning-bolts/tree/2e903c333c37ea83394c7da2ce826de1b82fb356 |
UNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class down(nn.Module):
def __init__(self, inChannels, outChannels, filterSize):
super(down, self).__init__()
self.conv1 = nn.Conv2d(inChannels, outChannels, filterSize, stride=
1, padding=int((filterSize - 1) / 2))
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | brainma/ASRNet | UNet | false | 9,998 | [
"MIT"
] | 0 | b88edbcfbcee2cc77f7f4b2a8d139ced303a4f14 | https://github.com/brainma/ASRNet/tree/b88edbcfbcee2cc77f7f4b2a8d139ced303a4f14 |
SchedulerTestNet | import torch
from torch.nn import functional as F
class SchedulerTestNet(torch.nn.Module):
"""
adapted from: https://github.com/pytorch/pytorch/blob/master/test/test_optim.py
"""
def __init__(self):
super(SchedulerTestNet, self).__init__()
self.conv1 = torch.nn.Conv2d(1, 1, 1)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C... | bartolkaruza/pytorch-lightning-bolts | SchedulerTestNet | false | 9,999 | [
"Apache-2.0"
] | 0 | 2e903c333c37ea83394c7da2ce826de1b82fb356 | https://github.com/bartolkaruza/pytorch-lightning-bolts/tree/2e903c333c37ea83394c7da2ce826de1b82fb356 |
BasicBlock | import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicBlock(nn.Module):
expansion = 1
def __init__(self, in_planes, planes, stride=1, norm='instancenorm'):
super(BasicBlock, self).__init__()
self.norm = norm
self.conv1 = nn.Conv2d(in_planes, planes, kernel_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
from torch._inductor.runtime.... | cuijiaxing/DatasetCondensation | BasicBlock | false | 10,000 | [
"MIT"
] | 0 | aec1f7bf08d10d0f9e5d2fd5c2e4193d9687fefd | https://github.com/cuijiaxing/DatasetCondensation/tree/aec1f7bf08d10d0f9e5d2fd5c2e4193d9687fefd |
ParsingRelationLoss | import torch
import torch.nn.modules
import torch.nn as nn
class ParsingRelationLoss(nn.Module):
def __init__(self):
super(ParsingRelationLoss, self).__init__()
def forward(self, logits):
_n, _c, h, _w = logits.shape
loss_all = []
for i in range(0, h - 1):
loss_al... | 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.modules
import torch.nn as nn
assert_size_stride = torch.... | daveMcelf/Ultra-Fast-Lane-Detection | ParsingRelationLoss | false | 10,001 | [
"MIT"
] | 0 | 357f1f0f4538a125e9a9c1509e5f72ce2321f078 | https://github.com/daveMcelf/Ultra-Fast-Lane-Detection/tree/357f1f0f4538a125e9a9c1509e5f72ce2321f078 |
Bottleneck_nobn | import torch
import torch.nn as nn
import torch.nn.functional as F
class Bottleneck_nobn(nn.Module):
def __init__(self, in_planes, growth_rate):
super(Bottleneck_nobn, self).__init__()
self.conv1 = nn.Conv2d(in_planes, 4 * growth_rate, kernel_size=1,
bias=False)
self.conv2 = n... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | daroczyb/tangent_sensitivity | Bottleneck_nobn | false | 10,002 | [
"MIT"
] | 0 | 925258ab381ca5ab95620c411f72836a90baeb7f | https://github.com/daroczyb/tangent_sensitivity/tree/925258ab381ca5ab95620c411f72836a90baeb7f |
MLP1x | import torch
import torch.nn as nn
class MLP1x(nn.Module):
def __init__(self, dim, hidd, num_classes=10):
super(MLP1x, self).__init__()
self.fc1 = nn.Linear(dim, hidd)
self.fc2 = nn.Linear(hidd, num_classes)
self.relu = nn.ReLU(inplace=True)
def forward(self, x):
out ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | daroczyb/tangent_sensitivity | MLP1x | false | 10,003 | [
"MIT"
] | 0 | 925258ab381ca5ab95620c411f72836a90baeb7f | https://github.com/daroczyb/tangent_sensitivity/tree/925258ab381ca5ab95620c411f72836a90baeb7f |
Discriminator | import torch
import numpy as np
import torch.nn as nn
from torch.nn import functional as F
class Discriminator(nn.Module):
def __init__(self, img_shape, hidden_dim=1024):
super().__init__()
in_dim = int(np.prod(img_shape))
self.fc1 = nn.Linear(in_dim, hidden_dim)
self.fc2 = nn.Lin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.g... | bartolkaruza/pytorch-lightning-bolts | Discriminator | false | 10,004 | [
"Apache-2.0"
] | 0 | 2e903c333c37ea83394c7da2ce826de1b82fb356 | https://github.com/bartolkaruza/pytorch-lightning-bolts/tree/2e903c333c37ea83394c7da2ce826de1b82fb356 |
NCHWLayerNorm | import torch
from torch import nn
class NCHWLayerNorm(nn.LayerNorm):
"""Applies LayerNorm to the channel dimension of NCHW tensors."""
def forward(self, x):
x = x.permute(0, 2, 3, 1)
x = super().forward(x)
return x.permute(0, 3, 1, 2)
def get_inputs():
return [torch.rand([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
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | cobypenso/pytorch-generative | NCHWLayerNorm | false | 10,005 | [
"MIT"
] | 0 | 72d1a3d8045179bd3a83ee3783aa070e74a1e400 | https://github.com/cobypenso/pytorch-generative/tree/72d1a3d8045179bd3a83ee3783aa070e74a1e400 |
Transition_nobn | import torch
import torch.nn as nn
import torch.nn.functional as F
class Transition_nobn(nn.Module):
def __init__(self, in_planes, out_planes):
super(Transition_nobn, self).__init__()
self.conv = nn.Conv2d(in_planes, out_planes, kernel_size=1, bias=False)
def forward(self, x):
out = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | daroczyb/tangent_sensitivity | Transition_nobn | false | 10,006 | [
"MIT"
] | 0 | 925258ab381ca5ab95620c411f72836a90baeb7f | https://github.com/daroczyb/tangent_sensitivity/tree/925258ab381ca5ab95620c411f72836a90baeb7f |
Illumination_Alone | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
def get_conv2d_layer(in_c, out_c, k, s, p=0, dilation=1, groups=1):
return nn.Conv2d(in_channels=in_c, out_channels=out_c, kernel_size=k,
stride=s, padding=p, dilation=dilation, groups=groups)
class Illumination_Alone(nn.Mo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | AndersonYong/URetinex-Net-Retinex-based-Deep-Unfolding-Network-for-Low-light-Image-Enhancem | Illumination_Alone | false | 10,007 | [
"MIT"
] | 0 | 9d837b8df9c761defb1eca390b3a60aa4a6fbb1a | https://github.com/AndersonYong/URetinex-Net-Retinex-based-Deep-Unfolding-Network-for-Low-light-Image-Enhancem/tree/9d837b8df9c761defb1eca390b3a60aa4a6fbb1a |
GatedActivation | import torch
from torch import nn
class GatedActivation(nn.Module):
"""Activation function which computes actiation_fn(f) * sigmoid(g).
The f and g correspond to the top 1/2 and bottom 1/2 of the input channels.
"""
def __init__(self, activation_fn=torch.tanh):
"""Initializes a new GatedActi... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | cobypenso/pytorch-generative | GatedActivation | false | 10,008 | [
"MIT"
] | 0 | 72d1a3d8045179bd3a83ee3783aa070e74a1e400 | https://github.com/cobypenso/pytorch-generative/tree/72d1a3d8045179bd3a83ee3783aa070e74a1e400 |
SigmoidCrossEntropyLoss | import torch
from torch import nn
import torch.nn.functional as F
class SigmoidCrossEntropyLoss(nn.Module):
def __init__(self):
"""
:param num_negs: number of negative instances in bpr loss.
"""
super(SigmoidCrossEntropyLoss, self).__init__()
def forward(self, y_pred, y_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
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch ... | byzhang/OpenMatch | SigmoidCrossEntropyLoss | false | 10,009 | [
"Apache-2.0"
] | 0 | 28b2d49a5eec2e1dc3934767c747ff0ca6c93d96 | https://github.com/byzhang/OpenMatch/tree/28b2d49a5eec2e1dc3934767c747ff0ca6c93d96 |
MaskedAveragePooling | import torch
from torch import nn
class MaskedAveragePooling(nn.Module):
def __init__(self):
super(MaskedAveragePooling, self).__init__()
def forward(self, embedding_matrix):
sum_pooling_matrix = torch.sum(embedding_matrix, dim=1)
non_padding_length = (embedding_matrix.sum(dim=-1) !=... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | byzhang/OpenMatch | MaskedAveragePooling | false | 10,010 | [
"Apache-2.0"
] | 0 | 28b2d49a5eec2e1dc3934767c747ff0ca6c93d96 | https://github.com/byzhang/OpenMatch/tree/28b2d49a5eec2e1dc3934767c747ff0ca6c93d96 |
FullyConnectedHead | import torch
from typing import Any
from typing import Dict
from typing import Optional
import torch.nn as nn
import torch.nn.modules as nn
import torch.optim
from torch import nn
def is_pos_int(number):
"""
Returns True if a number is a positive integer.
"""
return type(number) == int and number >= 0... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from typing import Any
from typing import Dict
from typing import Optional
impor... | dendisuhubdy/ClassyVision | FullyConnectedHead | false | 10,011 | [
"MIT"
] | 0 | c7f8de4615181b5a14dd5ec44fa72bebb790e886 | https://github.com/dendisuhubdy/ClassyVision/tree/c7f8de4615181b5a14dd5ec44fa72bebb790e886 |
MaskedSumPooling | import torch
from torch import nn
class MaskedSumPooling(nn.Module):
def __init__(self):
super(MaskedSumPooling, self).__init__()
def forward(self, embedding_matrix):
return torch.sum(embedding_matrix, dim=1)
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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | byzhang/OpenMatch | MaskedSumPooling | false | 10,012 | [
"Apache-2.0"
] | 0 | 28b2d49a5eec2e1dc3934767c747ff0ca6c93d96 | https://github.com/byzhang/OpenMatch/tree/28b2d49a5eec2e1dc3934767c747ff0ca6c93d96 |
Self_Attn | import torch
import torch.nn as nn
class Self_Attn(nn.Module):
""" Self attention Layer"""
def __init__(self, in_dim):
super(Self_Attn, self).__init__()
self.chanel_in = in_dim
self.value_conv = nn.Conv2d(in_channels=in_dim, out_channels=in_dim,
kernel_size=1, bias=False)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | douya1997/pytorch-cifar | Self_Attn | false | 10,013 | [
"MIT"
] | 0 | d5c73f6c1eddf3a2e74cb2dbd0eab6cc6dc4d14b | https://github.com/douya1997/pytorch-cifar/tree/d5c73f6c1eddf3a2e74cb2dbd0eab6cc6dc4d14b |
GradLoss | import torch
import torch.nn as nn
import torch.utils.data
import torch.optim
class GradLoss(nn.Module):
def __init__(model):
super(GradLoss, model).__init__()
def forward(model, grad_fake, grad_real):
return torch.sum(torch.mean(torch.abs(grad_real - grad_fake)))
def get_inputs():
ret... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | domo23/DeepSFM | GradLoss | false | 10,014 | [
"BSD-3-Clause"
] | 0 | 9456c1505e63b467417496545f17363ca17d02e4 | https://github.com/domo23/DeepSFM/tree/9456c1505e63b467417496545f17363ca17d02e4 |
GCN_encoder | import torch
import torch.nn as nn
import torch.nn.init as init
class GraphConv(nn.Module):
def __init__(self, input_dim, output_dim):
super(GraphConv, self).__init__()
self.input_dim = input_dim
self.output_dim = output_dim
self.weight = nn.Parameter(torch.FloatTensor(input_dim, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | bwalker1/graph-generation | GCN_encoder | false | 10,015 | [
"MIT"
] | 0 | e068769cb021760eb2549ced382b1a217609db86 | https://github.com/bwalker1/graph-generation/tree/e068769cb021760eb2549ced382b1a217609db86 |
PatchEmbed | import torch
from torch import nn
class PatchEmbed(nn.Module):
""" Image to Patch Embedding
"""
def __init__(self, img_size, patch_size=16, in_chans=3, embed_dim=768):
super().__init__()
num_patches_h = img_size[0] // patch_size
num_patches_w = img_size[1] // patch_size
nu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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... | daniel347x/dino | PatchEmbed | false | 10,016 | [
"Apache-2.0"
] | 0 | bb96d041de246ad0dc9672471911467fe635b018 | https://github.com/daniel347x/dino/tree/bb96d041de246ad0dc9672471911467fe635b018 |
PSNR | import torch
import torch as th
class PSNR(th.nn.Module):
def __init__(self):
super(PSNR, self).__init__()
self.mse = th.nn.MSELoss()
def forward(self, out, ref):
mse = self.mse(out, ref)
return -10 * th.log10(mse)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), tor... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch as th
assert_si... | endrol/demosaicnet | PSNR | false | 10,017 | [
"MIT"
] | 0 | 4b3726a08dcbbb5b70240687f211b39ebd15ad54 | https://github.com/endrol/demosaicnet/tree/4b3726a08dcbbb5b70240687f211b39ebd15ad54 |
PredictionHead | import torch
import torch.nn as nn
import torch.onnx
class PredictionHead(nn.Module):
def __init__(self, in_channels, num_classes, num_anchors):
super(PredictionHead, self).__init__()
self.classification = nn.Conv2d(in_channels, num_classes *
num_anchors, kernel_size=1)
self.r... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.onnx
assert_size_stride = torch._C._dynamo.gu... | danshirron/inference | PredictionHead | false | 10,018 | [
"Apache-2.0"
] | 0 | 31ae9b30ca5b1081a2d35f73ffcde10ae1fdaf41 | https://github.com/danshirron/inference/tree/31ae9b30ca5b1081a2d35f73ffcde10ae1fdaf41 |
RobertaClassificationHead_R | from _paritybench_helpers import _mock_config
import torch
from torch import nn
import torch.utils.checkpoint
class RobertaClassificationHead_R(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | Delecis/bert-classification | RobertaClassificationHead_R | false | 10,019 | [
"Apache-2.0"
] | 0 | 00e0d295ecf22a1bd364f2d63244469692ff23a3 | https://github.com/Delecis/bert-classification/tree/00e0d295ecf22a1bd364f2d63244469692ff23a3 |
ContrastiveLoss | import torch
from torch import nn
from torch.nn import CosineSimilarity
class ContrastiveLoss(nn.Module):
"""
Contrastive loss
Takes embeddings of two samples and a target label == 1 if samples are from the same class and label == 0 otherwise
"""
def __init__(self, margin=0.5):
super(Cont... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
from to... | elloworl/FRMiner2.0 | ContrastiveLoss | false | 10,020 | [
"MIT"
] | 0 | f596530d18512a1b1b8b8d56772f006f9f53f429 | https://github.com/elloworl/FRMiner2.0/tree/f596530d18512a1b1b8b8d56772f006f9f53f429 |
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.weight = nn.Parameter(torch.ones(features))
self.bias = 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.... | czhao39/NeuralCodeSum | PositionwiseFeedForward | false | 10,021 | [
"MIT"
] | 0 | d06f8165a8af993239ec6d796bac1d378aa8be91 | https://github.com/czhao39/NeuralCodeSum/tree/d06f8165a8af993239ec6d796bac1d378aa8be91 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(1, 6, 3)
self.conv2 = nn.Conv2d(6, 16, 3)
self.fc1 = nn.Linear(16 * 28 * 28, 512)
self.fc2 = nn.Linear(512, 64)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | dollarkillerx/PyTorchStudy | Net | false | 10,022 | [
"MIT"
] | 0 | c17b2973c89e3a2f088513f29bd5eb6f47957585 | https://github.com/dollarkillerx/PyTorchStudy/tree/c17b2973c89e3a2f088513f29bd5eb6f47957585 |
CoFusion | import torch
import torch.nn.functional as F
import torch.nn as nn
class CoFusion(nn.Module):
def __init__(self, in_ch, out_ch):
super(CoFusion, self).__init__()
self.conv1 = nn.Conv2d(in_ch, 64, kernel_size=3, stride=1, padding=1)
self.conv2 = nn.Conv2d(64, 64, kernel_size=3, stride=1, p... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | cordob/DexiNed | CoFusion | false | 10,023 | [
"MIT"
] | 0 | 9e084652f8051155c98277c02eecefa927bfe04c | https://github.com/cordob/DexiNed/tree/9e084652f8051155c98277c02eecefa927bfe04c |
Gaussian | import torch
import torch.utils.tensorboard
import torch.utils.data
class Gaussian(torch.nn.Module):
"""Gaussian activation"""
def forward(self, x):
return torch.exp(-x * x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.utils.tensorboard
import torch.utils.data
assert_size_stride... | chc273/torchani | Gaussian | false | 10,024 | [
"MIT"
] | 0 | bbcd7bedc254796f0c2f839c4868ac211ad9078d | https://github.com/chc273/torchani/tree/bbcd7bedc254796f0c2f839c4868ac211ad9078d |
GatedTransition | import torch
from torch import nn
class GatedTransition(nn.Module):
"""
Parameterizes the gaussian latent transition probability p(z_t | z_{t-1})
"""
def __init__(self, z_dim, transition_dim):
super().__init__()
self.lin_gate_z_to_hidden = nn.Linear(z_dim, transition_dim)
self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | devonjkohler/sysbioDMM | GatedTransition | false | 10,025 | [
"MIT"
] | 0 | 3967a084a492f5b7abd1f3274f1dc5ee9ef868ff | https://github.com/devonjkohler/sysbioDMM/tree/3967a084a492f5b7abd1f3274f1dc5ee9ef868ff |
Combiner | import torch
from torch import nn
class Combiner(nn.Module):
"""
Parameterizes q(z_t | z_{t-1}, x_{t:T}), which is the basic building block
of the guide (i.e. the variational distribution). The dependence on x_{t:T} is
through the hidden state of the RNN (see the pytorch module `rnn` below).
The g... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
fr... | devonjkohler/sysbioDMM | Combiner | false | 10,026 | [
"MIT"
] | 0 | 3967a084a492f5b7abd1f3274f1dc5ee9ef868ff | https://github.com/devonjkohler/sysbioDMM/tree/3967a084a492f5b7abd1f3274f1dc5ee9ef868ff |
BertMultiPairPooler | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class BertMultiPairPooler(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size * 2, config.hidden_size)
self.activation = nn.Tanh()
def forward(self, 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.triton_helpers import libdevice
import torch.nn as ... | doduo-anonymous/doduo-submission | BertMultiPairPooler | false | 10,027 | [
"Apache-2.0"
] | 0 | 34d397c14174d64e6a3026d51cc25560a4f1e29f | https://github.com/doduo-anonymous/doduo-submission/tree/34d397c14174d64e6a3026d51cc25560a4f1e29f |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.