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 |
|---|---|---|---|---|---|---|---|---|---|---|
Reorg | import torch
from torch import nn
import torch.utils.data
class Reorg(nn.Module):
def forward(self, x):
return torch.cat([x[..., ::2, ::2], x[..., 1::2, ::2], x[..., ::2,
1::2], x[..., 1::2, 1::2]], 1)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_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 import nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._... | bruceli-rw0/rob535-perception | Reorg | false | 9,826 | [
"MIT"
] | 0 | b800b48aea888b0959b19fe13c637e1f257417e6 | https://github.com/bruceli-rw0/rob535-perception/tree/b800b48aea888b0959b19fe13c637e1f257417e6 |
NetVLAD | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from sklearn.neighbors import NearestNeighbors
class NetVLAD(nn.Module):
"""NetVLAD layer implementation"""
def __init__(self, num_clusters=64, dim=128, normalize_input=True,
vladv2=False, use_faiss=True):
"... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | StephenHausler/Patch-NetVLAD | NetVLAD | false | 9,827 | [
"MIT"
] | 0 | 5d8b68fb7aa686e9c08a48ce504ecc552fff7b0b | https://github.com/StephenHausler/Patch-NetVLAD/tree/5d8b68fb7aa686e9c08a48ce504ecc552fff7b0b |
_leaky_relu | import torch
from torch import nn
import torch.optim
import torch.utils.data
class _leaky_relu(nn.Module):
def __init__(self):
super(_leaky_relu, self).__init__()
def forward(self, x):
x_neg = 0.1 * x
return torch.max(x_neg, x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import torch.optim
import torch.utils.data
assert_size_stride = torc... | ap229997/cc | _leaky_relu | false | 9,828 | [
"MIT"
] | 0 | d6f272b8270a371c877f4315047610b33a6e9f2d | https://github.com/ap229997/cc/tree/d6f272b8270a371c877f4315047610b33a6e9f2d |
RajeevNet | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.nn.functional as F
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class RajeevNet(nn.Module):
def __init__(self):
super(RajeevNet, self).__init__()
def forward(self, input):
x = nn.Adapti... | 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... | carlosdcastillo/janice | RajeevNet | false | 9,829 | [
"MIT"
] | 0 | 221a94dd25ab4304d3c959a364ec89548b807509 | https://github.com/carlosdcastillo/janice/tree/221a94dd25ab4304d3c959a364ec89548b807509 |
FeedForward | import torch
import torch.nn as nn
class FeedForward(nn.Module):
def __init__(self, d_model, d_ff):
super(FeedForward, self).__init__()
self.linear1 = nn.Linear(in_features=d_model, out_features=d_ff)
self.linear2 = nn.Linear(in_features=d_ff, out_features=d_model)
self.layer_norm... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | caixunshiren/transformer-from-scratch | FeedForward | false | 9,831 | [
"MIT"
] | 0 | dbbacab4752f9fc5e33f583c0b1b5258572fb646 | https://github.com/caixunshiren/transformer-from-scratch/tree/dbbacab4752f9fc5e33f583c0b1b5258572fb646 |
CosNorm_Classifier | import math
import torch
from torch import nn
import torch.utils.data
from torch.nn.parameter import Parameter
class CosNorm_Classifier(nn.Module):
def __init__(self, in_dims, out_dims, scale=16, margin=0.5, init_std=0.001
):
super(CosNorm_Classifier, self).__init__()
self.in_dims = in_di... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | caisarl76/classifier-balancing | CosNorm_Classifier | false | 9,832 | [
"BSD-3-Clause"
] | 0 | b381279dc29539afb92fe40f7ca917e352aff9c6 | https://github.com/caisarl76/classifier-balancing/tree/b381279dc29539afb92fe40f7ca917e352aff9c6 |
DAModule | import torch
import numpy as np
from torch import nn
from torch.nn import init
class ScaledDotProductAttention(nn.Module):
"""
Scaled dot-product attention
"""
def __init__(self, d_model, d_k, d_v, h, dropout=0.1):
"""
:param d_model: Output dimensionality of the model
:param ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | LiChengChen666/DetectDee | DAModule | false | 9,834 | [
"Apache-2.0"
] | 0 | 1e6aaa0d15b1fc12d1342d8a922004e372b5f437 | https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437 |
UFOAttention | import torch
from torch import nn
from torch.nn import init
def XNorm(x, gamma):
norm_tensor = torch.norm(x, 2, -1, True)
return x * gamma / norm_tensor
class UFOAttention(nn.Module):
"""
Scaled dot-product attention
"""
def __init__(self, d_model, d_k, d_v, h, dropout=0.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.triton_helpers import libdevice
from torch import n... | LiChengChen666/DetectDee | UFOAttention | false | 9,835 | [
"Apache-2.0"
] | 0 | 1e6aaa0d15b1fc12d1342d8a922004e372b5f437 | https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437 |
ResidualAttention | import torch
from torch import nn
class ResidualAttention(nn.Module):
def __init__(self, channel=512, num_class=1000, la=0.2):
super().__init__()
self.la = la
self.fc = nn.Conv2d(in_channels=channel, out_channels=num_class,
kernel_size=1, stride=1, bias=False)
def forward... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | LiChengChen666/DetectDee | ResidualAttention | false | 9,836 | [
"Apache-2.0"
] | 0 | 1e6aaa0d15b1fc12d1342d8a922004e372b5f437 | https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437 |
ActorNet | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class ActorNet(nn.Module):
def __init__(self, state_size, action_size, fc1_units=128, fc2_units=128):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | bwosh/DRL_ContinuousControl | ActorNet | false | 9,837 | [
"MIT"
] | 0 | 34314cd600f0da428bc6dddf1b89b64bc04d43df | https://github.com/bwosh/DRL_ContinuousControl/tree/34314cd600f0da428bc6dddf1b89b64bc04d43df |
ResNetV2 | import torch
import torch.nn as nn
from collections import OrderedDict
import torch.nn.functional as F
def conv1x1(cin, cout, stride=1, bias=False):
return StdConv2d(cin, cout, kernel_size=1, stride=stride, padding=0,
bias=bias)
def conv3x3(cin, cout, stride=1, groups=1, bias=False):
return StdConv2... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | YLtrees2/ViT-pytorch-Low-rank-Approximation | ResNetV2 | false | 9,838 | [
"MIT"
] | 0 | 249a8db1ab99b6a482c527853e4aa0cf52659bb8 | https://github.com/YLtrees2/ViT-pytorch-Low-rank-Approximation/tree/249a8db1ab99b6a482c527853e4aa0cf52659bb8 |
AttentionSortNet | import torch
from torch.nn import functional as F
from functools import partial
from torch import nn
def bucket(buckets, t, dim=1):
shape = list(t.shape)
shape[dim:dim + 1] = [buckets, -1]
return t.reshape(*shape)
def expand_dim(t, dim, k):
expand_shape = [-1] * len(t.shape)
expand_shape[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.... | blizda/sinkhorn-transformer | AttentionSortNet | false | 9,839 | [
"MIT"
] | 0 | 4b626a40759010e4cb1752f22387fdbda438f37c | https://github.com/blizda/sinkhorn-transformer/tree/4b626a40759010e4cb1752f22387fdbda438f37c |
GroupedChannelNorm | import torch
import torch.utils.data
import torch
import torch.nn as nn
class GroupedChannelNorm(nn.Module):
def __init__(self, num_groups):
super().__init__()
self.num_groups = num_groups
def forward(self, x):
shape = list(x.shape)
new_shape = [shape[0], self.num_groups, sha... | 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.utils.data
import torch
import torch.nn as nn
assert_size_stride =... | a11isonliu/contrastive-unpaired-translation | GroupedChannelNorm | false | 9,840 | [
"BSD-3-Clause"
] | 0 | 67651ed9877cae121d9398f46094ce8dbc678802 | https://github.com/a11isonliu/contrastive-unpaired-translation/tree/67651ed9877cae121d9398f46094ce8dbc678802 |
ParallelPolarizedSelfAttention | import torch
from torch import nn
class ParallelPolarizedSelfAttention(nn.Module):
def __init__(self, channel=512):
super().__init__()
self.ch_wv = nn.Conv2d(channel, channel // 2, kernel_size=(1, 1))
self.ch_wq = nn.Conv2d(channel, 1, kernel_size=(1, 1))
self.softmax_channel = 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.... | LiChengChen666/DetectDee | ParallelPolarizedSelfAttention | false | 9,841 | [
"Apache-2.0"
] | 0 | 1e6aaa0d15b1fc12d1342d8a922004e372b5f437 | https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437 |
FusedLeakyReLU | import torch
import torch.utils.data
import torch
import torch.nn as nn
import torch.nn.functional as F
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5):
return F.leaky_relu(input + bias, negative_slope) * scale
class FusedLeakyReLU(nn.Module):
def __init__(self, channel, negative_slop... | 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
import torch.nn as nn
import torch.nn.functional as F
assert_size_stride = torch._C._dynamo.guards.asse... | a11isonliu/contrastive-unpaired-translation | FusedLeakyReLU | false | 9,842 | [
"BSD-3-Clause"
] | 0 | 67651ed9877cae121d9398f46094ce8dbc678802 | https://github.com/a11isonliu/contrastive-unpaired-translation/tree/67651ed9877cae121d9398f46094ce8dbc678802 |
ReshapeF | import torch
import torch.utils.data
import torch
import torch.nn as nn
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(1.0 / self.power)
out ... | 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.utils.data
import torch
import torch.nn as nn
assert_size_stride =... | a11isonliu/contrastive-unpaired-translation | ReshapeF | false | 9,843 | [
"BSD-3-Clause"
] | 0 | 67651ed9877cae121d9398f46094ce8dbc678802 | https://github.com/a11isonliu/contrastive-unpaired-translation/tree/67651ed9877cae121d9398f46094ce8dbc678802 |
CriticNet | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class CriticNet(nn.Module):
def __init__(self, state_size, action_size, fc1_units=128, fc2_units=128):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | bwosh/DRL_ContinuousControl | CriticNet | false | 9,844 | [
"MIT"
] | 0 | 34314cd600f0da428bc6dddf1b89b64bc04d43df | https://github.com/bwosh/DRL_ContinuousControl/tree/34314cd600f0da428bc6dddf1b89b64bc04d43df |
fully_connected | import torch
from torch import nn
class fully_connected(nn.Module):
def __init__(self, input_dims, hidden_dims, out_dims, bias=True, drop=True
):
super(fully_connected, self).__init__()
self.input_dims = input_dims
self.hidden_dims = hidden_dims
self.out_dims = out_dims
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | cankucuksozen/COMP551--ComputerVision-with-DL | fully_connected | false | 9,845 | [
"MIT"
] | 0 | 44c4510a7163ad4bcf00ce0e9d112ae1ba59b143 | https://github.com/cankucuksozen/COMP551--ComputerVision-with-DL/tree/44c4510a7163ad4bcf00ce0e9d112ae1ba59b143 |
PoolingF | import torch
import torch.utils.data
import torch
import torch.nn as nn
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(1.0 / self.power)
out ... | 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
impo... | a11isonliu/contrastive-unpaired-translation | PoolingF | false | 9,846 | [
"BSD-3-Clause"
] | 0 | 67651ed9877cae121d9398f46094ce8dbc678802 | https://github.com/a11isonliu/contrastive-unpaired-translation/tree/67651ed9877cae121d9398f46094ce8dbc678802 |
PositionwiseFeedForward | import torch
import torch.nn as nn
class LayerNormalization(nn.Module):
""" Layer normalization module """
def __init__(self, d_hid, eps=0.001):
super(LayerNormalization, self).__init__()
self.eps = eps
self.a_2 = nn.Parameter(torch.ones(d_hid), requires_grad=True)
self.b_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
from torch._inductor.runtime.... | awesome-archive/attention-is-all-you-need-pytorch | PositionwiseFeedForward | false | 9,847 | [
"MIT"
] | 0 | d1fb26fafaf7170a7c3a45968cd555f3c6aeb3bc | https://github.com/awesome-archive/attention-is-all-you-need-pytorch/tree/d1fb26fafaf7170a7c3a45968cd555f3c6aeb3bc |
Discriminator | import torch
import torch.nn as nn
class BaseModel(nn.Module):
def __init__(self):
super(BaseModel, self).__init__()
def weights_init(self):
classname = self.__class__.__name__
if classname.find('Conv') != -1:
nn.init.normal_(self.weight.data, 0.0, 0.02)
elif clas... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | by256/PSGAN | Discriminator | false | 9,848 | [
"MIT"
] | 0 | ac086d4e25f6fbbe024cb4cdaf9075c88849ef01 | https://github.com/by256/PSGAN/tree/ac086d4e25f6fbbe024cb4cdaf9075c88849ef01 |
Net | import torch
import torch.nn.functional as F
import torch.nn as nn
class Net(nn.Module):
def __init__(self, N_STATES, N_ACTIONS):
super(Net, self).__init__()
self.fc1 = nn.Linear(N_STATES, 80)
self.fc1.weight.data.normal_(0, 0.1)
self.fc2 = nn.Linear(80, 60)
self.fc2.weigh... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | cariosr/States-Joeynmt | Net | false | 9,849 | [
"MIT"
] | 0 | 6b2eb67b990b586fe2bc4fb49004d749bc4f33be | https://github.com/cariosr/States-Joeynmt/tree/6b2eb67b990b586fe2bc4fb49004d749bc4f33be |
Normalize | import torch
import torch.utils.data
import torch
import torch.nn as nn
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(1.0 / self.power)
out ... | 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.utils.data
import torch
import torch.nn as nn
assert_size_stride =... | a11isonliu/contrastive-unpaired-translation | Normalize | false | 9,850 | [
"BSD-3-Clause"
] | 0 | 67651ed9877cae121d9398f46094ce8dbc678802 | https://github.com/a11isonliu/contrastive-unpaired-translation/tree/67651ed9877cae121d9398f46094ce8dbc678802 |
SequentialPolarizedSelfAttention | import torch
from torch import nn
class SequentialPolarizedSelfAttention(nn.Module):
def __init__(self, channel=512):
super().__init__()
self.ch_wv = nn.Conv2d(channel, channel // 2, kernel_size=(1, 1))
self.ch_wq = nn.Conv2d(channel, 1, kernel_size=(1, 1))
self.softmax_channel = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | LiChengChen666/DetectDee | SequentialPolarizedSelfAttention | false | 9,851 | [
"Apache-2.0"
] | 0 | 1e6aaa0d15b1fc12d1342d8a922004e372b5f437 | https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437 |
BinaryReg | import torch
from typing import Optional
import torch.utils.data
import torch.nn as nn
import torch.nn.parallel
class BinaryReg(nn.Module):
"""Regularization for encouraging the outputs to be binary.
Args:
pred (torch.Tensor): foreground logits.
mask (Optional[torch.Tensor], optional): weight... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.utils.dat... | HarshSulakhe/pytorch_connectomics | BinaryReg | false | 9,852 | [
"MIT"
] | 0 | 73402e654afde69a43a5836cc90a32ef75c75dc2 | https://github.com/HarshSulakhe/pytorch_connectomics/tree/73402e654afde69a43a5836cc90a32ef75c75dc2 |
Conv2dBlock | import torch
import torch.utils.data
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.affi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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
impor... | a11isonliu/contrastive-unpaired-translation | Conv2dBlock | false | 9,853 | [
"BSD-3-Clause"
] | 0 | 67651ed9877cae121d9398f46094ce8dbc678802 | https://github.com/a11isonliu/contrastive-unpaired-translation/tree/67651ed9877cae121d9398f46094ce8dbc678802 |
ContourDTConsistency | import torch
from typing import Optional
import torch.utils.data
import torch.nn as nn
import torch.nn.parallel
class ContourDTConsistency(nn.Module):
"""Consistency regularization between the instance contour map and
signed distance transform.
Args:
pred1 (torch.Tensor): contour logits.
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | HarshSulakhe/pytorch_connectomics | ContourDTConsistency | false | 9,854 | [
"MIT"
] | 0 | 73402e654afde69a43a5836cc90a32ef75c75dc2 | https://github.com/HarshSulakhe/pytorch_connectomics/tree/73402e654afde69a43a5836cc90a32ef75c75dc2 |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self, loss_weight=1.0):
super(DiceLoss, self).__init__()
self.loss_weight = loss_weight
def forward(self, input, target, mask, reduce=True):
batch_size = input.size(0)
input = torch.sigmoid(input)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | bhuyle/PAN_ocr | DiceLoss | false | 9,855 | [
"Apache-2.0"
] | 0 | bcd03892d4eb08a779a0a7ae63d526d8ea38cb01 | https://github.com/bhuyle/PAN_ocr/tree/bcd03892d4eb08a779a0a7ae63d526d8ea38cb01 |
WeightedBCEFocalLoss | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
class WeightedBCEFocalLoss(nn.Module):
"""Weighted binary focal loss with logits.
"""
def __init__(self, gamma=2.0, alpha=0.25, eps=0.0):
super().__init__()
self.eps = eps
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | HarshSulakhe/pytorch_connectomics | WeightedBCEFocalLoss | false | 9,856 | [
"MIT"
] | 0 | 73402e654afde69a43a5836cc90a32ef75c75dc2 | https://github.com/HarshSulakhe/pytorch_connectomics/tree/73402e654afde69a43a5836cc90a32ef75c75dc2 |
ForegroundDTConsistency | import torch
from typing import Optional
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
class ForegroundDTConsistency(nn.Module):
"""Consistency regularization between the binary foreground mask and
signed distance transform.
Args:
pred1 (to... | 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... | HarshSulakhe/pytorch_connectomics | ForegroundDTConsistency | false | 9,857 | [
"MIT"
] | 0 | 73402e654afde69a43a5836cc90a32ef75c75dc2 | https://github.com/HarshSulakhe/pytorch_connectomics/tree/73402e654afde69a43a5836cc90a32ef75c75dc2 |
ToRGB | import math
import torch
import torch.utils.data
import torch
import torch.nn as nn
import torch.nn.functional as F
def make_kernel(k):
k = torch.tensor(k, dtype=torch.float32)
if len(k.shape) == 1:
k = k[None, :] * k[:, None]
k /= k.sum()
return k
def upfirdn2d_native(input, kernel, up_x, u... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.utils.data
import torch
import torch.nn as nn
import to... | a11isonliu/contrastive-unpaired-translation | ToRGB | false | 9,858 | [
"BSD-3-Clause"
] | 0 | 67651ed9877cae121d9398f46094ce8dbc678802 | https://github.com/a11isonliu/contrastive-unpaired-translation/tree/67651ed9877cae121d9398f46094ce8dbc678802 |
WSDiceLoss | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.parallel
class WSDiceLoss(nn.Module):
def __init__(self, smooth=100.0, power=2.0, v2=0.85, v1=0.15):
super().__init__()
self.smooth = smooth
self.power = power
self.v2 = v2
self.v1 = v1
def dic... | 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
import torch.nn.parallel
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty... | HarshSulakhe/pytorch_connectomics | WSDiceLoss | false | 9,859 | [
"MIT"
] | 0 | 73402e654afde69a43a5836cc90a32ef75c75dc2 | https://github.com/HarshSulakhe/pytorch_connectomics/tree/73402e654afde69a43a5836cc90a32ef75c75dc2 |
WeightedCE | import torch
from typing import Optional
from typing import List
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
class WeightedCE(nn.Module):
"""Mask weighted multi-class cross-entropy (CE) loss.
"""
def __init__(self, class_weight: 'Optional[List[fl... | 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 typing import Opt... | HarshSulakhe/pytorch_connectomics | WeightedCE | false | 9,860 | [
"MIT"
] | 0 | 73402e654afde69a43a5836cc90a32ef75c75dc2 | https://github.com/HarshSulakhe/pytorch_connectomics/tree/73402e654afde69a43a5836cc90a32ef75c75dc2 |
ModulatedConv2d | import math
import torch
import torch.utils.data
import torch
import torch.nn as nn
import torch.nn.functional as F
def make_kernel(k):
k = torch.tensor(k, dtype=torch.float32)
if len(k.shape) == 1:
k = k[None, :] * k[:, None]
k /= k.sum()
return k
def upfirdn2d_native(input, kernel, up_x, u... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | a11isonliu/contrastive-unpaired-translation | ModulatedConv2d | false | 9,861 | [
"BSD-3-Clause"
] | 0 | 67651ed9877cae121d9398f46094ce8dbc678802 | https://github.com/a11isonliu/contrastive-unpaired-translation/tree/67651ed9877cae121d9398f46094ce8dbc678802 |
PatchMerging3D | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
class PatchMerging3D(nn.Module):
""" Patch Merging Layer
Args:
dim (int): Number of input channels.
norm_layer (nn.Module, optional): Normalization layer. Default: nn.LayerNorm
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | HarshSulakhe/pytorch_connectomics | PatchMerging3D | false | 9,862 | [
"MIT"
] | 0 | 73402e654afde69a43a5836cc90a32ef75c75dc2 | https://github.com/HarshSulakhe/pytorch_connectomics/tree/73402e654afde69a43a5836cc90a32ef75c75dc2 |
WeightedBCEWithLogitsLoss | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
class WeightedBCEWithLogitsLoss(nn.Module):
"""Weighted binary cross-entropy with logits.
"""
def __init__(self, size_average=True, reduce=True, eps=0.0):
super().__init__()
... | 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... | HarshSulakhe/pytorch_connectomics | WeightedBCEWithLogitsLoss | false | 9,863 | [
"MIT"
] | 0 | 73402e654afde69a43a5836cc90a32ef75c75dc2 | https://github.com/HarshSulakhe/pytorch_connectomics/tree/73402e654afde69a43a5836cc90a32ef75c75dc2 |
DiceLoss | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.parallel
class DiceLoss(nn.Module):
"""DICE loss.
"""
def __init__(self, reduce=True, smooth=100.0, power=1):
super(DiceLoss, self).__init__()
self.smooth = smooth
self.reduce = reduce
self.power = ... | 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
import torch.nn.parallel
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty... | HarshSulakhe/pytorch_connectomics | DiceLoss | false | 9,864 | [
"MIT"
] | 0 | 73402e654afde69a43a5836cc90a32ef75c75dc2 | https://github.com/HarshSulakhe/pytorch_connectomics/tree/73402e654afde69a43a5836cc90a32ef75c75dc2 |
AdaptiveConcatPool2d | import torch
import torch.nn as nn
import torch.nn.init
class AdaptiveConcatPool2d(nn.Module):
def __init__(self, sz=None):
super().__init__()
sz = sz or (1, 1)
self.ap = nn.AdaptiveAvgPool2d(sz)
self.mp = nn.AdaptiveMaxPool2d(sz)
def forward(self, x):
return torch.ca... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.nn.init
assert_size_stride = torch._C._dynamo.guards.a... | MichoelSnow/data_science | AdaptiveConcatPool2d | false | 9,865 | [
"MIT"
] | 0 | 7f6c054624268308ec4126a601c9fa8bc5de157c | https://github.com/MichoelSnow/data_science/tree/7f6c054624268308ec4126a601c9fa8bc5de157c |
AvgPoolPad | import torch
import torch.nn as nn
import torch.nn.init
class AvgPoolPad(nn.Module):
def __init__(self, stride=2, padding=1):
super(AvgPoolPad, self).__init__()
self.pad = nn.ZeroPad2d((1, 0, 1, 0))
self.pool = nn.AvgPool2d(3, stride=stride, padding=padding,
count_include_pad=... | 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.init
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dy... | MichoelSnow/data_science | AvgPoolPad | false | 9,866 | [
"MIT"
] | 0 | 7f6c054624268308ec4126a601c9fa8bc5de157c | https://github.com/MichoelSnow/data_science/tree/7f6c054624268308ec4126a601c9fa8bc5de157c |
CausalAttentionSortNet | import torch
from torch.nn import functional as F
from functools import partial
from torch import nn
def bucket(buckets, t, dim=1):
shape = list(t.shape)
shape[dim:dim + 1] = [buckets, -1]
return t.reshape(*shape)
def max_neg_value(tensor):
return -torch.finfo(tensor.dtype).max
def expand_dim(t, d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | blizda/sinkhorn-transformer | CausalAttentionSortNet | false | 9,867 | [
"MIT"
] | 0 | 4b626a40759010e4cb1752f22387fdbda438f37c | https://github.com/blizda/sinkhorn-transformer/tree/4b626a40759010e4cb1752f22387fdbda438f37c |
MaxPoolPad | import torch
import torch.nn as nn
import torch.nn.init
class MaxPoolPad(nn.Module):
def __init__(self):
super(MaxPoolPad, self).__init__()
self.pad = nn.ZeroPad2d((1, 0, 1, 0))
self.pool = nn.MaxPool2d(3, stride=2, padding=1)
def forward(self, x):
x = self.pad(x)
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
import torch.nn.init
assert_size_stride = torch._C._dynamo.guards.a... | MichoelSnow/data_science | MaxPoolPad | false | 9,868 | [
"MIT"
] | 0 | 7f6c054624268308ec4126a601c9fa8bc5de157c | https://github.com/MichoelSnow/data_science/tree/7f6c054624268308ec4126a601c9fa8bc5de157c |
CoxPHLossSorted | import torch
from torch import Tensor
def cox_ph_loss_sorted(log_h: 'Tensor', events: 'Tensor', eps: 'float'=1e-07
) ->Tensor:
"""Requires the input to be sorted by descending duration time.
See DatasetDurationSorted.
We calculate the negative log of $(rac{h_i}{\\sum_{j \\in R_i} h_j})^d$,
where... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import Tens... | bseewald/pycox | CoxPHLossSorted | false | 9,869 | [
"BSD-2-Clause"
] | 0 | 366348d51ecd902a01ab830b2f0a4cf1694d9ae2 | https://github.com/bseewald/pycox/tree/366348d51ecd902a01ab830b2f0a4cf1694d9ae2 |
down | 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | brainma/ASRNet | down | false | 9,870 | [
"MIT"
] | 0 | b88edbcfbcee2cc77f7f4b2a8d139ced303a4f14 | https://github.com/brainma/ASRNet/tree/b88edbcfbcee2cc77f7f4b2a8d139ced303a4f14 |
NormedLinear | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch
import torch.nn.functional as F
from torch.nn import Parameter
class NormedLinear(nn.Module):
def __init__(self, in_features, out_features):
super(NormedLinear, self).__init__()
sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | caisarl76/LDAM-DRW | NormedLinear | false | 9,871 | [
"MIT"
] | 0 | f3d7e98ec40bfbf2c9a806387764a54c5a31d22d | https://github.com/caisarl76/LDAM-DRW/tree/f3d7e98ec40bfbf2c9a806387764a54c5a31d22d |
FocalLoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch
import torch.nn.functional as F
def focal_loss(input_values, gamma):
"""Computes the focal loss"""
p = torch.exp(-input_values)
loss = (1 - p) ** gamma * input_values
return loss.mean()
... | 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
... | caisarl76/LDAM-DRW | FocalLoss | false | 9,872 | [
"MIT"
] | 0 | f3d7e98ec40bfbf2c9a806387764a54c5a31d22d | https://github.com/caisarl76/LDAM-DRW/tree/f3d7e98ec40bfbf2c9a806387764a54c5a31d22d |
CenterLoss | import torch
import torch.nn as nn
class CenterLoss(nn.Module):
def __init__(self):
super(CenterLoss, self).__init__()
self.l2_loss = nn.MSELoss(reduction='sum')
def forward(self, outputs, targets):
return self.l2_loss(outputs, targets) / outputs.size(0)
def get_inputs():
retur... | 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... | bysen32/WS-DAN.PyTorch | CenterLoss | false | 9,873 | [
"MIT"
] | 0 | de206591f037ea82fc52eaf6915de7f64375e0c9 | https://github.com/bysen32/WS-DAN.PyTorch/tree/de206591f037ea82fc52eaf6915de7f64375e0c9 |
PatchEmbed3D | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
class PatchEmbed3D(nn.Module):
""" Video to Patch Embedding.
Args:
patch_size (int): Patch token size. Default: (2,4,4).
in_channel (int): Number of input video channels. Default... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
import torch.nn.parallel
assert_si... | HarshSulakhe/pytorch_connectomics | PatchEmbed3D | false | 9,874 | [
"MIT"
] | 0 | 73402e654afde69a43a5836cc90a32ef75c75dc2 | https://github.com/HarshSulakhe/pytorch_connectomics/tree/73402e654afde69a43a5836cc90a32ef75c75dc2 |
PositionAttentionModule | import torch
import numpy as np
from torch import nn
from torch.nn import init
class ScaledDotProductAttention(nn.Module):
"""
Scaled dot-product attention
"""
def __init__(self, d_model, d_k, d_v, h, dropout=0.1):
"""
:param d_model: Output dimensionality of the model
:param ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | LiChengChen666/DetectDee | PositionAttentionModule | false | 9,875 | [
"Apache-2.0"
] | 0 | 1e6aaa0d15b1fc12d1342d8a922004e372b5f437 | https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437 |
tri_att | import torch
import torch.nn as nn
class tri_att(nn.Module):
def __init__(self):
super(tri_att, self).__init__()
self.feature_norm = nn.Softmax(dim=2)
self.bilinear_norm = nn.Softmax(dim=2)
def forward(self, x):
n = x.size(0)
c = x.size(1)
h = x.size(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 math as tl_math
import torch.nn as nn
... | bysen32/WS-DAN.PyTorch | tri_att | false | 9,876 | [
"MIT"
] | 0 | de206591f037ea82fc52eaf6915de7f64375e0c9 | https://github.com/bysen32/WS-DAN.PyTorch/tree/de206591f037ea82fc52eaf6915de7f64375e0c9 |
CharbonnierCompLoss | import functools
import torch
import torch.nn as nn
from torch.nn import 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".
Returns:
Tensor: Reduced lo... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import functools
import torc... | Sardhendu/mmediting | CharbonnierCompLoss | false | 9,877 | [
"Apache-2.0"
] | 0 | 623b59ac758d856abc9fab7e845beeab61074d8f | https://github.com/Sardhendu/mmediting/tree/623b59ac758d856abc9fab7e845beeab61074d8f |
DiscShiftLoss | import torch
import torch.nn as nn
class DiscShiftLoss(nn.Module):
"""Disc shift loss.
Args:
loss_weight (float, optional): Loss weight. Defaults to 1.0.
"""
def __init__(self, loss_weight=0.1):
super().__init__()
self.loss_weight = loss_weight
def forward(self, ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | Sardhendu/mmediting | DiscShiftLoss | false | 9,878 | [
"Apache-2.0"
] | 0 | 623b59ac758d856abc9fab7e845beeab61074d8f | https://github.com/Sardhendu/mmediting/tree/623b59ac758d856abc9fab7e845beeab61074d8f |
DoubleInputNet | import torch
import torch as t
import torch.nn as nn
class DoubleInputNet(nn.Module):
def __init__(self, firstinsize, secondinsize, outsize, activation=lambda
x: x):
super().__init__()
self.firstinsize = firstinsize
self.secondinsize = secondinsize
self.outsize = outsize
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | cbekar/DRL_Project | DoubleInputNet | false | 9,879 | [
"MIT"
] | 0 | 90d197773c7746b253ee7d997d0526e15d05578a | https://github.com/cbekar/DRL_Project/tree/90d197773c7746b253ee7d997d0526e15d05578a |
PixelNorm | import torch
import torch.nn as nn
def pixel_norm(x, eps=1e-06):
"""Pixel Normalization.
This normalization is proposed in:
Progressive Growing of GANs for Improved Quality, Stability, and Variation
Args:
x (torch.Tensor): Tensor to be normalized.
eps (float, optional): Epsilon to av... | 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_... | Sardhendu/mmediting | PixelNorm | false | 9,880 | [
"Apache-2.0"
] | 0 | 623b59ac758d856abc9fab7e845beeab61074d8f | https://github.com/Sardhendu/mmediting/tree/623b59ac758d856abc9fab7e845beeab61074d8f |
MaxPool | import torch
from torch import nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class MaxPool(nn.Module):
def __init__(self, kernel_size, stride=1, padding=1, zero_pad=False):
super(MaxPool, self).__init__()
self.zero_pad = nn.ZeroPad2d((1, 0, 1, 0)) if zero_pad else None
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
... | OrKatz7/kaggle-hubmap | MaxPool | false | 9,881 | [
"MIT"
] | 0 | 5cf8c5aebe956c256fa7f3db432639e28f29c6a3 | https://github.com/OrKatz7/kaggle-hubmap/tree/5cf8c5aebe956c256fa7f3db432639e28f29c6a3 |
SpatialCrossMapLRN | import torch
from torch import nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class SpatialCrossMapLRN(nn.Module):
def __init__(self, local_size=1, alpha=1.0, beta=0.75, k=1,
ACROSS_CHANNELS=True):
super(SpatialCrossMapLRN, self).__init__()
self.ACROSS_CHANNELS = A... | 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
import torch.nn.parallel
import torch.optim
import torch.u... | OrKatz7/kaggle-hubmap | SpatialCrossMapLRN | false | 9,882 | [
"MIT"
] | 0 | 5cf8c5aebe956c256fa7f3db432639e28f29c6a3 | https://github.com/OrKatz7/kaggle-hubmap/tree/5cf8c5aebe956c256fa7f3db432639e28f29c6a3 |
L1CompositionLoss | import functools
import torch
import torch.nn as nn
from torch.nn import 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".
Returns:
Tensor: Reduced lo... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import functools
impor... | Sardhendu/mmediting | L1CompositionLoss | false | 9,883 | [
"Apache-2.0"
] | 0 | 623b59ac758d856abc9fab7e845beeab61074d8f | https://github.com/Sardhendu/mmediting/tree/623b59ac758d856abc9fab7e845beeab61074d8f |
MSECompositionLoss | import functools
import torch
import torch.nn as nn
from torch.nn import 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".
Returns:
Tensor: Reduced lo... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import functools
import torch.nn as nn
from torch.nn import functional as F
assert_size_s... | Sardhendu/mmediting | MSECompositionLoss | false | 9,884 | [
"Apache-2.0"
] | 0 | 623b59ac758d856abc9fab7e845beeab61074d8f | https://github.com/Sardhendu/mmediting/tree/623b59ac758d856abc9fab7e845beeab61074d8f |
ConvNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class ConvNet(nn.Module):
def __init__(self):
super(ConvNet, self).__init__()
self.conv1 = nn.Conv2d(1, 3, kernel_size=3)
self.fc = nn.Linear(192, 10)
def forward(self, x):
x = F.relu(F.max_pool2d(self.conv1(x... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | chao5645/T-1000 | ConvNet | false | 9,885 | [
"MIT"
] | 0 | 99751bcfd79bd94df3667e7311e3b3af2b912505 | https://github.com/chao5645/T-1000/tree/99751bcfd79bd94df3667e7311e3b3af2b912505 |
SpatialAttentionModule | import torch
from torch import nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
def init_weight(m):
classname = m.__class__.__name__
if classname.find('Conv') != -1:
nn.init.kaiming_normal_(m.weight, mode='fan_in', nonlinearity='relu')
if m.bias is not None:
m... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import t... | OrKatz7/kaggle-hubmap | SpatialAttentionModule | false | 9,886 | [
"MIT"
] | 0 | 5cf8c5aebe956c256fa7f3db432639e28f29c6a3 | https://github.com/OrKatz7/kaggle-hubmap/tree/5cf8c5aebe956c256fa7f3db432639e28f29c6a3 |
ExtResNetBlock | import torch
from torch import nn
def conv3d(in_channels, out_channels, kernel_size, bias, padding):
return nn.Conv3d(in_channels, out_channels, kernel_size, padding=
padding, bias=bias)
def create_conv(in_channels, out_channels, kernel_size, order, num_groups,
padding):
"""
Create a list of... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | charmsoya/pytorch-3dunet | ExtResNetBlock | false | 9,887 | [
"MIT"
] | 0 | 07a8dabf988ac3df110a3c10db6ed5fb769498d9 | https://github.com/charmsoya/pytorch-3dunet/tree/07a8dabf988ac3df110a3c10db6ed5fb769498d9 |
CharbonnierLoss | import functools
import torch
import torch.nn as nn
from torch.nn import 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".
Returns:
Tensor: Reduced lo... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import functools
import torc... | Sardhendu/mmediting | CharbonnierLoss | false | 9,888 | [
"Apache-2.0"
] | 0 | 623b59ac758d856abc9fab7e845beeab61074d8f | https://github.com/Sardhendu/mmediting/tree/623b59ac758d856abc9fab7e845beeab61074d8f |
L2Norm | import torch
import torch.nn as nn
class L2Norm(nn.Module):
def __init__(self, n_channels, scale=1.0):
super(L2Norm, self).__init__()
self.n_channels = n_channels
self.scale = scale
self.eps = 1e-10
self.weight = nn.Parameter(torch.Tensor(self.n_channels))
self.wei... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | bluan2019/face-alignment | L2Norm | false | 9,889 | [
"BSD-3-Clause"
] | 0 | 9e256b18a02c7bd924a88c1203fb875853263336 | https://github.com/bluan2019/face-alignment/tree/9e256b18a02c7bd924a88c1203fb875853263336 |
Fire | import torch
import torch.utils.data
import torch.nn as nn
class Fire(nn.Module):
def __init__(self, inplanes, squeeze_planes, expand1x1_planes,
expand3x3_planes):
super(Fire, self).__init__()
self.inplanes = inplanes
self.squeeze = nn.Conv1d(inplanes, squeeze_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
import torch.utils.data
impor... | botcs/dsp-lr | Fire | false | 9,890 | [
"Apache-2.0"
] | 0 | 15856def3c91821cbcbf37803337630a68dd1f86 | https://github.com/botcs/dsp-lr/tree/15856def3c91821cbcbf37803337630a68dd1f86 |
ModMBStddevLayer | import torch
import torch.nn as nn
class ModMBStddevLayer(nn.Module):
"""Modified MiniBatch Stddev Layer.
This layer is modified from ``MiniBatchStddevLayer`` used in PGGAN. In
StyleGAN2, the authors add a new feature, `channel_groups`, into this
layer.
"""
def __init__(self, group_size=4, 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.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | Sardhendu/mmediting | ModMBStddevLayer | false | 9,891 | [
"Apache-2.0"
] | 0 | 623b59ac758d856abc9fab7e845beeab61074d8f | https://github.com/Sardhendu/mmediting/tree/623b59ac758d856abc9fab7e845beeab61074d8f |
PlainRefiner | import torch
import torch.nn as nn
class PlainRefiner(nn.Module):
"""Simple refiner from Deep Image Matting.
Args:
conv_channels (int): Number of channels produced by the three main
convolutional layer.
loss_refine (dict): Config of the loss of the refiner. Default: None.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | Sardhendu/mmediting | PlainRefiner | false | 9,892 | [
"Apache-2.0"
] | 0 | 623b59ac758d856abc9fab7e845beeab61074d8f | https://github.com/Sardhendu/mmediting/tree/623b59ac758d856abc9fab7e845beeab61074d8f |
SRCNN | import logging
import torch
import torch.nn as nn
def get_root_logger(log_file=None, log_level=logging.INFO):
"""Get the root logger.
The logger will be initialized if it has not been initialized. By default a
StreamHandler will be added. If `log_file` is specified, a FileHandler will
also be added. ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Sardhendu/mmediting | SRCNN | false | 9,893 | [
"Apache-2.0"
] | 0 | 623b59ac758d856abc9fab7e845beeab61074d8f | https://github.com/Sardhendu/mmediting/tree/623b59ac758d856abc9fab7e845beeab61074d8f |
AsymmetricLossMultiLabel | import torch
from torch import nn
import torch.onnx
import torch.utils.data
import torch.nn.parallel
from torch import optim as optim
class AsymmetricLossMultiLabel(nn.Module):
def __init__(self, gamma_neg=4, gamma_pos=1, clip=0.05, eps=1e-08,
disable_torch_grad_focal_loss=False):
super(Asymmetri... | 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 ... | cagery/pytorch-image-models | AsymmetricLossMultiLabel | false | 9,894 | [
"Apache-2.0"
] | 0 | 9211b0bd368cecf970165cfad81770dc14e25d45 | https://github.com/cagery/pytorch-image-models/tree/9211b0bd368cecf970165cfad81770dc14e25d45 |
KLDivLoss | import torch
import torch.nn as nn
class KLDivLoss(nn.Module):
"""
## KL-Divergence loss
This calculates the KL divergence between a given normal distribution and $\\mathcal{N}(0, 1)$
"""
def forward(self, sigma_hat, mu):
return -0.5 * torch.mean(1 + sigma_hat - mu ** 2 - torch.exp(sigma... | 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
... | chrissarmstrong/PL-Sketch-RNN | KLDivLoss | false | 9,895 | [
"MIT"
] | 0 | 82a34718b10f7a2a1458dbad41ba85f0036267c0 | https://github.com/chrissarmstrong/PL-Sketch-RNN/tree/82a34718b10f7a2a1458dbad41ba85f0036267c0 |
Lookahead | import torch
import torch.utils.data.distributed
import torch.nn as nn
import torch.nn.functional as F
class Lookahead(nn.Module):
def __init__(self, n_features, context):
super(Lookahead, self).__init__()
assert context > 0
self.context = context
self.n_features = n_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
import torch.utils.data.distributed
import torch.nn as nn
assert_size_stride = t... | chaiyujin/deepspeech.pytorch | Lookahead | false | 9,896 | [
"MIT"
] | 0 | b4edbafb955f35316869ce3fda2dc9cd47968038 | https://github.com/chaiyujin/deepspeech.pytorch/tree/b4edbafb955f35316869ce3fda2dc9cd47968038 |
Reorg | import torch
import torch.nn as nn
class Reorg(nn.Module):
dump_patches = True
def __init__(self):
super(Reorg, self).__init__()
def forward(self, x):
ss = x.size()
out = x.view(ss[0], ss[1], ss[2] // 2, 2, ss[3]).view(ss[0], ss[1],
ss[2] // 2, 2, ss[3] // 2, 2).permu... | 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... | ahmedelhodaiby/HandMesh | Reorg | false | 9,897 | [
"MIT"
] | 0 | d86ec322b7627c5756bd9ae9e152bcd4f2debfa6 | https://github.com/ahmedelhodaiby/HandMesh/tree/d86ec322b7627c5756bd9ae9e152bcd4f2debfa6 |
DNN | import math
import torch
import torch.nn.functional as F
import torch.nn as nn
class DNN(nn.Module):
def __init__(self, n_concat, freq_bins, *, dropout=0.2):
super().__init__()
hidden_units = 2048
self.dropout = dropout
self.fc1 = nn.Linear(n_concat * freq_bins, hidden_units)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | cHemingway/sednn_pytorch_ignite | DNN | false | 9,898 | [
"MIT"
] | 0 | 5b82dcc92829513acc382f0b189003cca206468b | https://github.com/cHemingway/sednn_pytorch_ignite/tree/5b82dcc92829513acc382f0b189003cca206468b |
AdaptiveAvgMaxPool2d | import torch
from torch import nn
import torch.onnx
import torch.utils.data
import torchvision.transforms.functional as F
import torch.nn.functional as F
import torch.nn.parallel
from torch import optim as optim
def adaptive_avgmax_pool2d(x, output_size=1):
x_avg = F.adaptive_avg_pool2d(x, output_size)
x_max ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import torch.onnx
import torch.utils.data
import torchvision.transfo... | cagery/pytorch-image-models | AdaptiveAvgMaxPool2d | false | 9,899 | [
"Apache-2.0"
] | 0 | 9211b0bd368cecf970165cfad81770dc14e25d45 | https://github.com/cagery/pytorch-image-models/tree/9211b0bd368cecf970165cfad81770dc14e25d45 |
AvgPoolStride1 | import torch
import torch.nn as nn
import torch.nn.functional as F
class AvgPoolStride1(nn.Module):
def __init__(self):
super(AvgPoolStride1, self).__init__()
def forward(self, x):
x = F.avg_pool2d(F.pad(x, (0, 1, 0, 1), mode='replicate'), 2, stride=1)
return x
def get_inputs():
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | ciodar/YOLOv3_PyTorch | AvgPoolStride1 | false | 9,900 | [
"MIT"
] | 0 | 50209393b3e6c1fdc1a7f9299eb77189fffe6740 | https://github.com/ciodar/YOLOv3_PyTorch/tree/50209393b3e6c1fdc1a7f9299eb77189fffe6740 |
ModulatedToRGB | import torch
import torch.nn as nn
from functools import partial
from torch.nn import functional as F
from copy import deepcopy
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 pro... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 functools import partial
from torch.nn import functio... | Sardhendu/mmediting | ModulatedToRGB | false | 9,901 | [
"Apache-2.0"
] | 0 | 623b59ac758d856abc9fab7e845beeab61074d8f | https://github.com/Sardhendu/mmediting/tree/623b59ac758d856abc9fab7e845beeab61074d8f |
SelfAttention | import torch
import torch.nn as nn
class SelfAttention(nn.Module):
def __init__(self, in_dim):
super(SelfAttention, self).__init__()
self.query_conv = nn.Linear(in_dim, in_dim)
self.key_conv = nn.Linear(in_dim, in_dim)
self.value_conv = nn.Linear(in_dim, in_dim)
for name, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ahmedelhodaiby/HandMesh | SelfAttention | false | 9,902 | [
"MIT"
] | 0 | d86ec322b7627c5756bd9ae9e152bcd4f2debfa6 | https://github.com/ahmedelhodaiby/HandMesh/tree/d86ec322b7627c5756bd9ae9e152bcd4f2debfa6 |
AdaptiveCatAvgMaxPool2d | import torch
from torch import nn
import torch.onnx
import torch.utils.data
import torchvision.transforms.functional as F
import torch.nn.functional as F
import torch.nn.parallel
from torch import optim as optim
def adaptive_catavgmax_pool2d(x, output_size=1):
x_avg = F.adaptive_avg_pool2d(x, output_size)
x_m... | 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.onnx
import torch.utils.data
import torchvision.transfo... | cagery/pytorch-image-models | AdaptiveCatAvgMaxPool2d | false | 9,903 | [
"Apache-2.0"
] | 0 | 9211b0bd368cecf970165cfad81770dc14e25d45 | https://github.com/cagery/pytorch-image-models/tree/9211b0bd368cecf970165cfad81770dc14e25d45 |
LinearBlock | import torch
from scipy.stats import truncnorm
def truncated_normal_(tensor, mean=0.0, std=1.0):
values = truncnorm.rvs(-2, 2, size=tensor.shape)
values = mean + std * values
tensor.copy_(torch.from_numpy(values))
return tensor
def fc_init_(module):
if hasattr(module, 'weight') and module.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 import triton_helpers
from torch._inductor.runtime.... | aylagulcu/TripletMAML | LinearBlock | false | 9,904 | [
"MIT"
] | 0 | 98cb4a23847ec24937963292cd6f162bcbf724ba | https://github.com/aylagulcu/TripletMAML/tree/98cb4a23847ec24937963292cd6f162bcbf724ba |
SpeakNet | import math
import torch
import torch.nn as nn
import torch.optim
def xavier_init(module):
"""
Xavier initializer for module parameters.
"""
for parameter in module.parameters():
if len(parameter.data.shape) == 1:
parameter.data.fill_(0)
else:
fan_in = parameter... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | christiancosgrove/cs767hw3 | SpeakNet | false | 9,905 | [
"MIT"
] | 0 | 7c906d7b92394cc30ed94a714b199467c269cadf | https://github.com/christiancosgrove/cs767hw3/tree/7c906d7b92394cc30ed94a714b199467c269cadf |
ConvModel | import torch
import torch.nn as nn
import torch.nn.functional as F
class ConvModel(nn.Module):
def __init__(self):
super(ConvModel, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(6, 16, 5)
self.fc1 = nn.Linear(16 * 5 ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | chetanseth/pytorch | ConvModel | false | 9,906 | [
"MIT"
] | 0 | 001aaf56ee72e0a8b4df5fe8ad84fda6354a084c | https://github.com/chetanseth/pytorch/tree/001aaf56ee72e0a8b4df5fe8ad84fda6354a084c |
PixelwiseNorm | import torch
import torch as th
class PixelwiseNorm(th.nn.Module):
def __init__(self):
super(PixelwiseNorm, self).__init__()
def forward(self, x, alpha=1e-08):
"""
forward pass of the module
:param x: input activations volume
:param alpha: small number for numerical s... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch as th
assert_size_stride = torch._C._dynamo.guards.assert_size_str... | alexeyhorkin/ProGAN-PyTorch | PixelwiseNorm | false | 9,907 | [
"MIT"
] | 0 | 731ba596e9366c602a771a40b81957cd12386836 | https://github.com/alexeyhorkin/ProGAN-PyTorch/tree/731ba596e9366c602a771a40b81957cd12386836 |
MinibatchStdDev | import torch
import torch as th
class MinibatchStdDev(th.nn.Module):
"""
Minibatch standard deviation layer for the discriminator
"""
def __init__(self):
"""
derived class constructor
"""
super(MinibatchStdDev, self).__init__()
def forward(self, x, alpha=1e-08):
... | 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 as th
assert_size_stride = torch._C._dynamo.guards.assert_size_str... | alexeyhorkin/ProGAN-PyTorch | MinibatchStdDev | false | 9,908 | [
"MIT"
] | 0 | 731ba596e9366c602a771a40b81957cd12386836 | https://github.com/alexeyhorkin/ProGAN-PyTorch/tree/731ba596e9366c602a771a40b81957cd12386836 |
CoxPHLoss | import torch
from torch import Tensor
def cox_ph_loss_sorted(log_h: 'Tensor', events: 'Tensor', eps: 'float'=1e-07
) ->Tensor:
"""Requires the input to be sorted by descending duration time.
See DatasetDurationSorted.
We calculate the negative log of $(rac{h_i}{\\sum_{j \\in R_i} h_j})^d$,
where... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid, split_scan_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 ... | bseewald/pycox | CoxPHLoss | false | 9,909 | [
"BSD-2-Clause"
] | 0 | 366348d51ecd902a01ab830b2f0a4cf1694d9ae2 | https://github.com/bseewald/pycox/tree/366348d51ecd902a01ab830b2f0a4cf1694d9ae2 |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self, smooth=0, eps=1e-07):
super(DiceLoss, self).__init__()
self.smooth = smooth
self.eps = eps
def forward(self, output, target):
return 1 - (2 * torch.sum(output * target) + self.smooth) / (torch.
... | 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... | bielrv/open-solution-salt-identification-solution-6 | DiceLoss | false | 9,910 | [
"MIT"
] | 0 | 5993494aa2e446991c7f43e0cf1ec996620dfa80 | https://github.com/bielrv/open-solution-salt-identification-solution-6/tree/5993494aa2e446991c7f43e0cf1ec996620dfa80 |
Generator | import torch
import torch.nn.functional as F
from torch import nn
class Generator(nn.Module):
def __init__(self, d_model, vocab_size):
super(Generator, self).__init__()
self.proj = nn.Linear(d_model, vocab_size)
def forward(self, x, temperature):
return F.log_softmax(self.proj(x) / t... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | chanhee0222/feed2resp | Generator | false | 9,911 | [
"MIT"
] | 0 | 16dc7071f17af56cbf019eeabcd12a5dbd0693e7 | https://github.com/chanhee0222/feed2resp/tree/16dc7071f17af56cbf019eeabcd12a5dbd0693e7 |
ShakeResNet | import math
import torch
from torch.nn import functional as F
from torch import nn
class ShakeShake(torch.autograd.Function):
@staticmethod
def forward(ctx, x1, x2, training=True):
if training:
alpha = torch.FloatTensor(x1.size(0)).uniform_()
alpha = alpha.view(alpha.size(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 math
from torch.nn imp... | ang421/dda | ShakeResNet | false | 9,912 | [
"MIT"
] | 0 | 391ad696ec8479ce41a0d7d6bfbfae06edaddf67 | https://github.com/ang421/dda/tree/391ad696ec8479ce41a0d7d6bfbfae06edaddf67 |
ShakeResNeXt | import math
import torch
from torch.nn import functional as F
from torch import nn
class ShakeShake(torch.autograd.Function):
@staticmethod
def forward(ctx, x1, x2, training=True):
if training:
alpha = torch.FloatTensor(x1.size(0)).uniform_()
alpha = alpha.view(alpha.size(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 math
from torch.nn imp... | ang421/dda | ShakeResNeXt | false | 9,913 | [
"MIT"
] | 0 | 391ad696ec8479ce41a0d7d6bfbfae06edaddf67 | https://github.com/ang421/dda/tree/391ad696ec8479ce41a0d7d6bfbfae06edaddf67 |
Attention | import torch
from torch import nn
from torch import einsum
class Attention(nn.Module):
def __init__(self, dim_in, dim_out, dim_inner, causal=False):
super().__init__()
self.scale = dim_inner ** -0.5
self.causal = causal
self.to_qkv = nn.Linear(dim_in, dim_inner * 3, 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.... | cpmolnar/gMLP-Disaster-Tweets | Attention | false | 9,914 | [
"MIT"
] | 0 | 7b13651c2260bc112d706a99466c069fb9348205 | https://github.com/cpmolnar/gMLP-Disaster-Tweets/tree/7b13651c2260bc112d706a99466c069fb9348205 |
EqualLinearActModule | import torch
import torch.nn as nn
from functools import partial
from copy import deepcopy
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 ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 functools import partial
from copy import deepcopy
fr... | Sardhendu/mmediting | EqualLinearActModule | false | 9,915 | [
"Apache-2.0"
] | 0 | 623b59ac758d856abc9fab7e845beeab61074d8f | https://github.com/Sardhendu/mmediting/tree/623b59ac758d856abc9fab7e845beeab61074d8f |
RecognizeNet | import torch
import torch.nn as nn
class RecognizeNet(nn.Module):
def __init__(self, num_classes=3):
super(RecognizeNet, self).__init__()
self.conv1 = nn.Conv2d(in_channels=3, out_channels=32, kernel_size=
3, stride=1, padding=1)
self.relu1 = nn.ReLU()
self.pool1 = 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_... | ckfanzhe/Face_recognize-Pytorch- | RecognizeNet | false | 9,916 | [
"Apache-2.0"
] | 0 | 0cf0853a26a25d0166f0082d8171160daa4cf747 | https://github.com/ckfanzhe/Face_recognize-Pytorch-/tree/0cf0853a26a25d0166f0082d8171160daa4cf747 |
AdversarialNetwork | import torch
import torch.nn as nn
class AdversarialNetwork(nn.Module):
def __init__(self, in_feature):
super(AdversarialNetwork, self).__init__()
self.ad_layer1 = nn.Linear(in_feature, 1024)
self.ad_layer2 = nn.Linear(1024, 1024)
self.ad_layer3 = nn.Linear(1024, 1)
self.a... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | caozhangjie/kinetics_i3d_pytorch | AdversarialNetwork | false | 9,917 | [
"MIT"
] | 0 | 237713bb76cf71b6d60d1a4df98f00df3a489cc3 | https://github.com/caozhangjie/kinetics_i3d_pytorch/tree/237713bb76cf71b6d60d1a4df98f00df3a489cc3 |
TemporalConvModel | import torch
import torch.nn as nn
class TemporalConvModel(nn.Module):
def __init__(self, in_feature, seq_len):
super(TemporalConvModel, self).__init__()
self.conv1 = nn.Conv1d(in_feature, 256, 1, 1)
self.conv2 = nn.Conv1d(256, 256, 3, 1, 1)
self.conv3 = nn.Conv1d(256, 256, 3, 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_... | caozhangjie/kinetics_i3d_pytorch | TemporalConvModel | false | 9,918 | [
"MIT"
] | 0 | 237713bb76cf71b6d60d1a4df98f00df3a489cc3 | https://github.com/caozhangjie/kinetics_i3d_pytorch/tree/237713bb76cf71b6d60d1a4df98f00df3a489cc3 |
UpsampleConvLayer | import torch
class UpsampleConvLayer(torch.nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride,
upsample=None):
super().__init__()
self.upsample = upsample
reflectpad = kernel_size // 2
self.reflectionpad = torch.nn.ReflectionPad2d(reflectpad)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 | UpsampleConvLayer | false | 9,919 | [
"MIT"
] | 0 | 7bde13bc954566088c477065adb5c4e4214c28bb | https://github.com/bruchano/ImageStyler/tree/7bde13bc954566088c477065adb5c4e4214c28bb |
BilinearClassifyBlock | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
class BilinearClassifyBlock(nn.Module):
def __init__(self, in_channels, out_channels):
super(BilinearClassifyBlock, self).__init__()
self.compress = nn.Conv3d(in_channels=in_channels, ou... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | caijh33/I3D_CTC | BilinearClassifyBlock | false | 9,920 | [
"Apache-2.0"
] | 0 | dd73ece2b810eed775fc847b7017080902e9c260 | https://github.com/caijh33/I3D_CTC/tree/dd73ece2b810eed775fc847b7017080902e9c260 |
OrthogonalLoss | import torch
import torch.nn.functional as F
from torch import nn
class OrthogonalLoss(nn.Module):
def __init__(self):
super(OrthogonalLoss, self).__init__()
def forward(self, features, descriptor, labels):
features = F.normalize(features, dim=1)
labels_equal = torch.eq(labels.unsque... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | chrisbyd/ContrastiveVehicleQuant | OrthogonalLoss | false | 9,921 | [
"MIT"
] | 0 | bf471988868cf0cb9713002dd1d6726272ecce7f | https://github.com/chrisbyd/ContrastiveVehicleQuant/tree/bf471988868cf0cb9713002dd1d6726272ecce7f |
SoftQNetwork | import torch
import torch.nn.functional as F
import torch.nn as nn
class SoftQNetwork(nn.Module):
def __init__(self, num_inputs, num_actions, hidden_size=[400, 300],
init_w=0.003):
super(SoftQNetwork, self).__init__()
self.linear1 = nn.Linear(num_inputs + num_actions, hidden_size[0])
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | constancecrozier/CityLearn | SoftQNetwork | false | 9,922 | [
"MIT"
] | 0 | c92f981771d29181cffce448a31d8f367a668175 | https://github.com/constancecrozier/CityLearn/tree/c92f981771d29181cffce448a31d8f367a668175 |
SmallAdversarialNetwork | import torch
import torch.nn as nn
class SmallAdversarialNetwork(nn.Module):
def __init__(self, in_feature):
super(SmallAdversarialNetwork, self).__init__()
self.ad_layer1 = nn.Linear(in_feature, 256)
self.ad_layer2 = nn.Linear(256, 1)
self.ad_layer1.weight.data.normal_(0, 0.01)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | caozhangjie/kinetics_i3d_pytorch | SmallAdversarialNetwork | false | 9,923 | [
"MIT"
] | 0 | 237713bb76cf71b6d60d1a4df98f00df3a489cc3 | https://github.com/caozhangjie/kinetics_i3d_pytorch/tree/237713bb76cf71b6d60d1a4df98f00df3a489cc3 |
VGG19Decoder1 | import torch
import torch.nn as nn
from collections import OrderedDict
class VGG19Decoder1(nn.Module):
def __init__(self):
super(VGG19Decoder1, self).__init__()
self.blocks = OrderedDict([('pad1_1', nn.ReflectionPad2d(1)), (
'conv1_1', nn.Conv2d(64, 3, 3, 1, 0))])
self.seq = 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.triton_helpers import math as tl_math
import torch.... | chenhsiu48/PytorchWCT | VGG19Decoder1 | false | 9,924 | [
"MIT"
] | 0 | c3346ebaec95358ad1d4d5a519d5d0e7de73bc75 | https://github.com/chenhsiu48/PytorchWCT/tree/c3346ebaec95358ad1d4d5a519d5d0e7de73bc75 |
Convlayer | 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.triton_helpers import math as tl_math
assert_size_s... | bruchano/ImageStyler | Convlayer | false | 9,925 | [
"MIT"
] | 0 | 7bde13bc954566088c477065adb5c4e4214c28bb | https://github.com/bruchano/ImageStyler/tree/7bde13bc954566088c477065adb5c4e4214c28bb |
Generator | import torch
import torch.nn as nn
class Generator(nn.Module):
"""Define standard linear + softmax generation step."""
def __init__(self, d_model, vocab):
super(Generator, self).__init__()
self.d_model = d_model
self.proj1 = nn.Linear(self.d_model, self.d_model)
self.proj = nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | context-aware-Failure-Identification/CLog | Generator | false | 9,926 | [
"MIT"
] | 0 | ef2c87605fa3cdb6db6666c754311ab9c3fed371 | https://github.com/context-aware-Failure-Identification/CLog/tree/ef2c87605fa3cdb6db6666c754311ab9c3fed371 |
GaussianBlock | 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
from torch._inductor.runtime import triton_helpers
import math
import torch.nn a... | bouracha/Gen_Motion | GaussianBlock | false | 9,927 | [
"MIT"
] | 0 | 873caa496d14c9a9723581cdf1464f44db4cf358 | https://github.com/bouracha/Gen_Motion/tree/873caa496d14c9a9723581cdf1464f44db4cf358 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.