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 |
|---|---|---|---|---|---|---|---|---|---|---|
TransposeGatedConv2d | import torch
import torch.nn as nn
from torch.nn import functional as F
from torch.nn import Parameter
def l2normalize(v, eps=1e-12):
return v / (v.norm() + eps)
class LayerNorm(nn.Module):
def __init__(self, num_features, eps=1e-08, affine=True):
super(LayerNorm, self).__init__()
self.num_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | piggy2303/DeepFillv2_Pytorch | TransposeGatedConv2d | false | 7,479 | [
"MIT"
] | 1 | dd35299f11704f878ed7a33e14ccd51a9d64baaf | https://github.com/piggy2303/DeepFillv2_Pytorch/tree/dd35299f11704f878ed7a33e14ccd51a9d64baaf |
BasePolicy | import torch
import torch.nn as nn
import torch.nn.functional as F
class BasePolicy(nn.Module):
"""
Base policy network
"""
def __init__(self, input_dim, out_dim, hidden_dim=64, nonlin=F.
leaky_relu, norm_in=False, onehot_dim=0):
"""
Inputs:
input_dim (int): Number... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.functional as F
assert_size_stride = torch... | pohanchi/DL_final_project | BasePolicy | false | 7,480 | [
"Apache-2.0"
] | 1 | 8ade422f61a2e8bd4256523ebda56e19b189fe91 | https://github.com/pohanchi/DL_final_project/tree/8ade422f61a2e8bd4256523ebda56e19b189fe91 |
ContinuousCritic | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class ContinuousCritic(nn.Module):
"""ContinuousCritic network
:param state_size: the size of the 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
import numpy as np
import torch.nn as nn
assert_size_stride = torch._C._dynamo.g... | pjordan/rlcc | ContinuousCritic | false | 7,481 | [
"Apache-2.0"
] | 1 | e84b8b5c14680dbad2efae22756fb40606b2384a | https://github.com/pjordan/rlcc/tree/e84b8b5c14680dbad2efae22756fb40606b2384a |
Net | import torch
import torch.nn as nn
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(kernel_size=5, in_channels=3, out_channels=3)
self.pool1 = nn.MaxPool2d(kernel_size=2, stride=2)
self.conv2 = nn.Conv2d(kernel_size=5, in_channels=3, 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_... | pippinhio/image-recognition | Net | false | 7,482 | [
"MIT"
] | 1 | 89569a0d66ae144d2f6e6f2d73a8577ef8b2272b | https://github.com/pippinhio/image-recognition/tree/89569a0d66ae144d2f6e6f2d73a8577ef8b2272b |
AddBroadcastPosEmbed | import torch
import torch.nn as nn
def tensor_slice(x, begin, size):
assert all([(b >= 0) for b in begin])
size = [(l - b if s == -1 else s) for s, b, l in zip(size, begin, x.shape)]
assert all([(s >= 0) for s in size])
slices = [slice(b, b + s) for b, s in zip(begin, size)]
return x[slices]
cla... | 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... | pointoflight/VideoGPT | AddBroadcastPosEmbed | false | 7,483 | [
"MIT"
] | 1 | 85f19d8cb0d251238f295f0294e69b9299c13e21 | https://github.com/pointoflight/VideoGPT/tree/85f19d8cb0d251238f295f0294e69b9299c13e21 |
Model | import torch
from torch import nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self):
super(Model, self).__init__()
self.conv1_7x7_s2 = nn.Conv2d(3, 64, kernel_size=7, stride=2, padding=3
)
self.pool1_3x3_s2 = nn.MaxPool2d(3, stride=2, ceil_mode=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.... | m-decoster/DeepHand-PyTorch | Model | false | 7,484 | [
"MIT"
] | 1 | ece77e04ec261a540b011fd00584bfc6d7337dc5 | https://github.com/m-decoster/DeepHand-PyTorch/tree/ece77e04ec261a540b011fd00584bfc6d7337dc5 |
SamePadConv3d | import torch
import torch.nn as nn
import torch.nn.functional as F
class SamePadConv3d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
bias=True):
super().__init__()
if isinstance(kernel_size, int):
kernel_size = (kernel_size,) * 3
if 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | pointoflight/VideoGPT | SamePadConv3d | false | 7,485 | [
"MIT"
] | 1 | 85f19d8cb0d251238f295f0294e69b9299c13e21 | https://github.com/pointoflight/VideoGPT/tree/85f19d8cb0d251238f295f0294e69b9299c13e21 |
SamePadConvTranspose3d | import torch
import torch.nn as nn
import torch.nn.functional as F
class SamePadConvTranspose3d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
bias=True):
super().__init__()
if isinstance(kernel_size, int):
kernel_size = (kernel_size,) * 3
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | pointoflight/VideoGPT | SamePadConvTranspose3d | false | 7,486 | [
"MIT"
] | 1 | 85f19d8cb0d251238f295f0294e69b9299c13e21 | https://github.com/pointoflight/VideoGPT/tree/85f19d8cb0d251238f295f0294e69b9299c13e21 |
Pooler | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.optim.lr_scheduler import *
def linear(x):
return x
def activation(func_a):
"""Activation function wrapper
"""
try:
f = eval(func_a)
except:
f = linear
return f
class DropoutWrapper(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
import torch.nn as nn
import torch.nn.functional as F
from torch.optim.lr_schedu... | praj000/DeepPavlov | Pooler | false | 7,487 | [
"Apache-2.0"
] | 1 | 3c9e4c989c6f6b89cd187f0ec2e2b7c71d1e3bf3 | https://github.com/praj000/DeepPavlov/tree/3c9e4c989c6f6b89cd187f0ec2e2b7c71d1e3bf3 |
ReconstructionLoss | import torch
import torch.nn as nn
from functools import reduce
import torch.utils.data
class BaseModule(nn.Module):
"""
Implements the basic module.
All other modules inherit from this one
"""
def load_w(self, checkpoint_path):
"""
Loads a checkpoint into the state_dict.
... | 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 functools import reduce
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
e... | ppalaupuigdevall/moments-vae | ReconstructionLoss | false | 7,488 | [
"MIT"
] | 1 | 99384094b5b7213e7669ad492f1b56216045b190 | https://github.com/ppalaupuigdevall/moments-vae/tree/99384094b5b7213e7669ad492f1b56216045b190 |
_DQN | import torch
from torch import nn
import torch.nn.functional as F
class _DQN(nn.Module):
def __init__(self, observation_space, action_space):
super(_DQN, self).__init__()
self.fc1 = nn.Linear(observation_space, 8)
self.fc2 = nn.Linear(8, 4)
self.fc3 = nn.Linear(4, action_space)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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... | pouyan9675/DeepFlappyBird | _DQN | false | 7,489 | [
"MIT"
] | 1 | 3dc727cc7fb2ce9e0e665d26770c08d3e924f6c2 | https://github.com/pouyan9675/DeepFlappyBird/tree/3dc727cc7fb2ce9e0e665d26770c08d3e924f6c2 |
Advantage_estimate | import torch
import torch.nn as nn
import torch.nn.functional as F
class Advantage_estimate(nn.Module):
def __init__(self, input_shape, output_shape, device, hidden_shape=128):
super(Advantage_estimate, self).__init__()
self.device = device
self.dropout = nn.Dropout(p=0.01)
self.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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | pupupue/Deep-RL-atari | Advantage_estimate | false | 7,490 | [
"MIT"
] | 1 | 9b97157f87826feafcf272761d7eef9693a2b2c4 | https://github.com/pupupue/Deep-RL-atari/tree/9b97157f87826feafcf272761d7eef9693a2b2c4 |
InverseSigmoidTransformer | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.functional as F
from torch.distributions.utils import probs_to_logits
class Bijection(nn.Module):
"""
An invertible transformation.
"""
def __init__(self):
super().__init__()
def forward(self, inputs, context):
... | 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... | probabll/dgm.pt | InverseSigmoidTransformer | false | 7,491 | [
"MIT"
] | 1 | 95b5b1eb798b87c3d621e7416cc1c423c076c865 | https://github.com/probabll/dgm.pt/tree/95b5b1eb798b87c3d621e7416cc1c423c076c865 |
Value_estimate | import torch
import torch.nn as nn
import torch.nn.functional as F
class Value_estimate(nn.Module):
def __init__(self, input_shape, device, output_shape=1, hidden_shape=128):
super(Value_estimate, self).__init__()
self.device = device
self.dropout = nn.Dropout(p=0.01)
self.input_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_... | pupupue/Deep-RL-atari | Value_estimate | false | 7,492 | [
"MIT"
] | 1 | 9b97157f87826feafcf272761d7eef9693a2b2c4 | https://github.com/pupupue/Deep-RL-atari/tree/9b97157f87826feafcf272761d7eef9693a2b2c4 |
SigmoidTransformer | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.functional as F
from torch.distributions.utils import probs_to_logits
class Bijection(nn.Module):
"""
An invertible transformation.
"""
def __init__(self):
super().__init__()
def forward(self, inputs, context):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torch.nn as nn
import torch.utils.data
import torch.nn.... | probabll/dgm.pt | SigmoidTransformer | false | 7,493 | [
"MIT"
] | 1 | 95b5b1eb798b87c3d621e7416cc1c423c076c865 | https://github.com/probabll/dgm.pt/tree/95b5b1eb798b87c3d621e7416cc1c423c076c865 |
distLinear | import torch
import torch.nn as nn
from torch.nn.utils.weight_norm import WeightNorm
import torch.optim
class distLinear(nn.Module):
def __init__(self, indim, outdim):
super(distLinear, self).__init__()
self.L = nn.Linear(indim, outdim, bias=False)
self.class_wise_learnable_norm = 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.triton_helpers import libdevice
import torch.nn as ... | prabhat1081/self-supervision-cs221 | distLinear | false | 7,494 | [
"Apache-2.0"
] | 1 | 41912c01dd7bf44d45a27d7c715a8db2ee9bbc28 | https://github.com/prabhat1081/self-supervision-cs221/tree/41912c01dd7bf44d45a27d7c715a8db2ee9bbc28 |
GumbelSoftmaxLayer | import torch
import torch.nn as nn
from torch.distributions import RelaxedOneHotCategorical
import torch.nn.parallel
import torch.utils.data
import torch.distributions
def gumbel_softmax_sample(logits: 'torch.Tensor', temperature: 'float'=1.0,
training: 'bool'=True, straight_through: 'bool'=False):
size = log... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from torch.distributions import RelaxedOneHotCategorical
import torch.nn.parallel
import torch.utils.data
import torch... | ptigas/EGG | GumbelSoftmaxLayer | false | 7,495 | [
"MIT"
] | 1 | 5319cc9de2c17bc72de717737cfbb5be2285c59b | https://github.com/ptigas/EGG/tree/5319cc9de2c17bc72de717737cfbb5be2285c59b |
Crop | import torch
from typing import cast
from torch import nn
from torchvision.transforms import functional as F
import torch.nn.functional as F
import torchvision.transforms.functional as F
import torch.autograd
class Crop(nn.Module):
def __init__(self, *, top: int, left: int, height: int, width: int) ->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 import nn
import torch.autograd
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dy... | pystiche/papers | Crop | false | 7,496 | [
"BSD-3-Clause"
] | 1 | 0d8179dc51f6eda0b27fa525dc0b86b866bc88e1 | https://github.com/pystiche/papers/tree/0d8179dc51f6eda0b27fa525dc0b86b866bc88e1 |
TonemappedRelativeMSE | import torch
def _tonemap(im):
"""Helper Reinhards tonemapper.
Args:
im(torch.Tensor): image to tonemap.
Returns:
(torch.Tensor) tonemaped image.
"""
im = torch.clamp(im, min=0)
return im / (1 + im)
class TonemappedRelativeMSE(torch.nn.Module):
"""Relative mean-squared er... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | qbhan/pathembed | TonemappedRelativeMSE | false | 7,497 | [
"MIT"
] | 1 | c21823529840593bf606e10696f5879e5adb51b2 | https://github.com/qbhan/pathembed/tree/c21823529840593bf606e10696f5879e5adb51b2 |
ReinforcedReceiver | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.utils.data
from torch.distributions import Bernoulli
import torch.distributions
class ReinforcedReceiver(nn.Module):
def __init__(self, n_bits, n_hidden):
super(ReinforcedReceiver, self).__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import to... | ptigas/EGG | ReinforcedReceiver | false | 7,498 | [
"MIT"
] | 1 | 5319cc9de2c17bc72de717737cfbb5be2285c59b | https://github.com/ptigas/EGG/tree/5319cc9de2c17bc72de717737cfbb5be2285c59b |
Luong_Attention | import torch
import torch.nn as nn
import torch.nn.functional as F
class Luong_Attention(nn.Module):
def __init__(self, hidden_size, score='general'):
super(Luong_Attention, self).__init__()
assert score.lower() in ['concat', 'general', 'dot']
self.score = score.lower()
def wn(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.... | placaille/nmt-comp550 | Luong_Attention | false | 7,499 | [
"MIT"
] | 1 | 5809ca68dbd7e5452361700f905740a783f9451c | https://github.com/placaille/nmt-comp550/tree/5809ca68dbd7e5452361700f905740a783f9451c |
TensorPermute | import torch
import torch.utils.data
class TensorPermute(torch.nn.Module):
"""
Convert a torch.FloatTensor of shape (NUM_IMAGES x CHANNELS x HEIGHT x WIDTH) to
a torch.FloatTensor of shape (CHANNELS x NUM_IMAGES x HEIGHT x WIDTH).
"""
def forward(self, tensor):
return tensor.permute(1, 0,... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_... | pz-white/pykale | TensorPermute | false | 7,500 | [
"MIT"
] | 1 | de40d1e8a88aa824ffbd1e072b02fe92b57b7c69 | https://github.com/pz-white/pykale/tree/de40d1e8a88aa824ffbd1e072b02fe92b57b7c69 |
OptimizedMLP | import torch
import torch.optim
import torch.jit
import torch.nn as nn
class OptimizedMLP(nn.Module):
def __init__(self, num_in_features: 'int', num_out_features: 'int'):
super(OptimizedMLP, self).__init__()
self.act = nn.ELU()
self.l_in = nn.Linear(in_features=num_in_features, out_featur... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.optim
... | plaveczlambert/deep_euler_tests | OptimizedMLP | false | 7,501 | [
"MIT"
] | 1 | a3ceef98ba76bd7a00ccd3c773cd9850311b3b1a | https://github.com/plaveczlambert/deep_euler_tests/tree/a3ceef98ba76bd7a00ccd3c773cd9850311b3b1a |
Net | import torch
from torch import nn
class Net(nn.Module):
def __init__(self, input_size, output_size, num_emojis, dropout):
super().__init__()
self.V = torch.nn.Parameter(torch.empty(num_emojis, output_size).
uniform_(-0.1, 0.1))
self.dropout = torch.nn.Dropout(p=dropout)
... | 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... | pwiercinski/emoji2vec_pytorch | Net | false | 7,502 | [
"MIT"
] | 1 | be7c3297998baa85a9542c0d2183d1dbed0f3adb | https://github.com/pwiercinski/emoji2vec_pytorch/tree/be7c3297998baa85a9542c0d2183d1dbed0f3adb |
Rotate | import torch
from typing import cast
from torch import nn
from torchvision.transforms import functional as F
import torch.nn.functional as F
import torchvision.transforms.functional as F
import torch.autograd
class Rotate(nn.Module):
def __init__(self, angle: 'float') ->None:
super().__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.triton_helpers import libdevice
from torch import n... | pystiche/papers | Rotate | false | 7,503 | [
"BSD-3-Clause"
] | 1 | 0d8179dc51f6eda0b27fa525dc0b86b866bc88e1 | https://github.com/pystiche/papers/tree/0d8179dc51f6eda0b27fa525dc0b86b866bc88e1 |
srcEncoder | import torch
import torch.nn as nn
class srcEncoder(nn.Module):
def __init__(self, in_ch, hid_ch):
super(srcEncoder, self).__init__()
self.act = nn.ReLU()
self.conv1 = nn.Conv2d(in_ch, hid_ch, kernel_size=3, padding=1)
self.conv2 = nn.Conv2d(hid_ch, hid_ch, kernel_size=3, padding=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | qbhan/pathembed | srcEncoder | false | 7,504 | [
"MIT"
] | 1 | c21823529840593bf606e10696f5879e5adb51b2 | https://github.com/qbhan/pathembed/tree/c21823529840593bf606e10696f5879e5adb51b2 |
TonemappedMSE | import torch
def _tonemap(im):
"""Helper Reinhards tonemapper.
Args:
im(torch.Tensor): image to tonemap.
Returns:
(torch.Tensor) tonemaped image.
"""
im = torch.clamp(im, min=0)
return im / (1 + im)
class TonemappedMSE(torch.nn.Module):
"""Mean-squared error on tonemaped ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | qbhan/pathembed | TonemappedMSE | false | 7,505 | [
"MIT"
] | 1 | c21823529840593bf606e10696f5879e5adb51b2 | https://github.com/qbhan/pathembed/tree/c21823529840593bf606e10696f5879e5adb51b2 |
Residual_Block | import torch
import torch.nn as nn
class AddCoords(nn.Module):
def __init__(self, with_r=False):
super().__init__()
self.with_r = with_r
def forward(self, input_tensor):
"""
@param input_tensor: shape(batch, channel, x_dim, y_dim)
"""
batch_size, _, x_dim, y_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.... | patrickacole/ccsrresnet | Residual_Block | false | 7,506 | [
"MIT"
] | 1 | 693d6673c26860bc9f7ced187006d8ef0a8386e6 | https://github.com/patrickacole/ccsrresnet/tree/693d6673c26860bc9f7ced187006d8ef0a8386e6 |
InformedSender | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.utils.data
import torch.distributions
class InformedSender(nn.Module):
def __init__(self, game_size, feat_size, embedding_size, hidden_size,
vocab_size=100, temp=1.0):
super(InformedSender, se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ptigas/EGG | InformedSender | false | 7,507 | [
"MIT"
] | 1 | 5319cc9de2c17bc72de717737cfbb5be2285c59b | https://github.com/ptigas/EGG/tree/5319cc9de2c17bc72de717737cfbb5be2285c59b |
ResBlock | import torch
import torch.nn as nn
class ResBlock(nn.Module):
def __init__(self, in_ch, hid_ch):
super(ResBlock, self).__init__()
self.act = nn.ReLU()
self.conv1 = nn.Conv2d(in_ch, hid_ch, kernel_size=3, padding=1)
self.conv2 = nn.Conv2d(hid_ch, hid_ch, kernel_size=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._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | qbhan/pathembed | ResBlock | false | 7,508 | [
"MIT"
] | 1 | c21823529840593bf606e10696f5879e5adb51b2 | https://github.com/qbhan/pathembed/tree/c21823529840593bf606e10696f5879e5adb51b2 |
FeatureEncoder | import torch
import torch.nn as nn
class ResBlock(nn.Module):
def __init__(self, in_ch, hid_ch):
super(ResBlock, self).__init__()
self.act = nn.ReLU()
self.conv1 = nn.Conv2d(in_ch, hid_ch, kernel_size=3, padding=1)
self.conv2 = nn.Conv2d(hid_ch, hid_ch, kernel_size=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._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | qbhan/pathembed | FeatureEncoder | false | 7,509 | [
"MIT"
] | 1 | c21823529840593bf606e10696f5879e5adb51b2 | https://github.com/qbhan/pathembed/tree/c21823529840593bf606e10696f5879e5adb51b2 |
PredictionHead | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class PredictionHead(nn.Module):
"""
Simple classification prediction-head block to plug ontop of the 4D
output of a CNN.
Args:
num_classes: the number of different classes that can be predicted.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | pz-white/pykale | PredictionHead | false | 7,510 | [
"MIT"
] | 1 | de40d1e8a88aa824ffbd1e072b02fe92b57b7c69 | https://github.com/pz-white/pykale/tree/de40d1e8a88aa824ffbd1e072b02fe92b57b7c69 |
LinearDiag | import torch
import torch.nn as nn
class LinearDiag(nn.Module):
def __init__(self, num_features, bias=False):
super(LinearDiag, self).__init__()
weight = torch.FloatTensor(num_features).fill_(1)
self.weight = nn.Parameter(weight, requires_grad=True)
if bias:
bias = 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | qianrusun1015/E3BM-1 | LinearDiag | false | 7,511 | [
"Apache-2.0"
] | 1 | d2c957bdff66fe28a288f1518f224a1e034d543f | https://github.com/qianrusun1015/E3BM-1/tree/d2c957bdff66fe28a288f1518f224a1e034d543f |
FeatExemplarAvgBlock | import torch
import torch.nn as nn
class FeatExemplarAvgBlock(nn.Module):
def __init__(self, nFeat):
super(FeatExemplarAvgBlock, self).__init__()
def forward(self, features_train, labels_train):
labels_train_transposed = labels_train.transpose(1, 2)
weight_novel = torch.bmm(labels_tr... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | qianrusun1015/E3BM-1 | FeatExemplarAvgBlock | false | 7,512 | [
"Apache-2.0"
] | 1 | d2c957bdff66fe28a288f1518f224a1e034d543f | https://github.com/qianrusun1015/E3BM-1/tree/d2c957bdff66fe28a288f1518f224a1e034d543f |
CONV | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class CONV(nn.Module):
def __init__(self, input_shape, device):
super(CONV, self).__init__()
self.device = device
self.input_shape = input_shape
self.poolavg = nn.AvgPool2d(2, 2)
self.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 numpy as np
import tor... | pupupue/Deep-RL-atari | CONV | false | 7,513 | [
"MIT"
] | 1 | 9b97157f87826feafcf272761d7eef9693a2b2c4 | https://github.com/pupupue/Deep-RL-atari/tree/9b97157f87826feafcf272761d7eef9693a2b2c4 |
Quantization | import torch
import torch.utils.data
import torch.nn as nn
class Quant(torch.autograd.Function):
@staticmethod
def forward(ctx, input):
input = torch.clamp(input, 0, 1)
output = (input * 255.0).round() / 255.0
return output
@staticmethod
def backward(ctx, grad_output):
... | 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... | qwopqwop200/Fast-Invertible-Rescaling-Net | Quantization | false | 7,514 | [
"MIT"
] | 1 | 871733f2eee7929d6b37c4d1d6a27347b39b67a9 | https://github.com/qwopqwop200/Fast-Invertible-Rescaling-Net/tree/871733f2eee7929d6b37c4d1d6a27347b39b67a9 |
kernelPredictor | import torch
import torch.nn as nn
class kernelPredictor(nn.Module):
def __init__(self, in_ch, hid_ch, pred_kernel_size=21):
super(kernelPredictor, self).__init__()
self.act = nn.ReLU()
self.conv1 = nn.Conv2d(in_ch, hid_ch, kernel_size=1)
self.conv2 = nn.Conv2d(hid_ch, pred_kernel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | qbhan/pathembed | kernelPredictor | false | 7,515 | [
"MIT"
] | 1 | c21823529840593bf606e10696f5879e5adb51b2 | https://github.com/qbhan/pathembed/tree/c21823529840593bf606e10696f5879e5adb51b2 |
GatedFusion | import torch
import torch.nn as nn
class GatedFusion(nn.Module):
"""
Reference:
- ACL2020, Document-Level Event Role Filler Extraction using Multi-Granularity Contextualized Encoding
"""
def __init__(self, n_in):
super().__init__()
self.n_in = n_in
self.hidden2scalar1 ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | qinyan-li/DocEE | GatedFusion | false | 7,516 | [
"MIT"
] | 1 | e8d2202a44907df5f12f9a67180d849a54421ab7 | https://github.com/qinyan-li/DocEE/tree/e8d2202a44907df5f12f9a67180d849a54421ab7 |
Attention | import torch
import torch.nn as nn
import torch.nn.functional as F
class Attention(nn.Module):
"""
Applies an attention mechanism on the output features from the decoder.
「A Structured Self-Attentive Sentence Embedding」 Paper
https://arxiv.org/abs/1703.03130
.. math::
\\begin{array}{ll}
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | qute012/Korean-Speech-Recognition | Attention | false | 7,517 | [
"Apache-2.0"
] | 1 | 0e037fd03df1ad6bf1084ee748781cdf4d428940 | https://github.com/qute012/Korean-Speech-Recognition/tree/0e037fd03df1ad6bf1084ee748781cdf4d428940 |
L1 | import torch
import torch.utils.data
import torch.nn as nn
class L1(nn.Module):
def __init__(self, eps=1e-06):
super(L1, self).__init__()
self.eps = eps
def forward(self, x, target):
diff = x - target
return torch.mean(torch.sum(torch.sqrt(diff * diff + self.eps), (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 libdevice
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dy... | qwopqwop200/Fast-Invertible-Rescaling-Net | L1 | false | 7,518 | [
"MIT"
] | 1 | 871733f2eee7929d6b37c4d1d6a27347b39b67a9 | https://github.com/qwopqwop200/Fast-Invertible-Rescaling-Net/tree/871733f2eee7929d6b37c4d1d6a27347b39b67a9 |
FullyConnected2 | import torch
import torch.nn as nn
class FullyConnected2(nn.Module):
def __init__(self, hidden_size, output_size):
super(FullyConnected2, self).__init__()
self.lrelu = nn.LeakyReLU(0.1)
self.linear_layer = nn.Linear(hidden_size, hidden_size, bias=True)
self.linear_layer_1 = 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 torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | qweas120/Active_VLN | FullyConnected2 | false | 7,519 | [
"MIT"
] | 1 | d5dabd5fe6127bcfec023b90f14a4ba5ac671f9b | https://github.com/qweas120/Active_VLN/tree/d5dabd5fe6127bcfec023b90f14a4ba5ac671f9b |
FullyConnected | import torch
import torch.nn as nn
class FullyConnected(nn.Module):
def __init__(self, hidden_size, output_size):
super(FullyConnected, self).__init__()
self.lrelu = nn.LeakyReLU(0.1)
self.linear_layer = nn.Linear(hidden_size, output_size, bias=False)
def forward(self, input):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | qweas120/Active_VLN | FullyConnected | false | 7,520 | [
"MIT"
] | 1 | d5dabd5fe6127bcfec023b90f14a4ba5ac671f9b | https://github.com/qweas120/Active_VLN/tree/d5dabd5fe6127bcfec023b90f14a4ba5ac671f9b |
PA | import torch
import torch.utils.data
import torch.nn as nn
class PA(nn.Module):
def __init__(self, nf):
super(PA, self).__init__()
self.conv = nn.Conv2d(nf, nf, 1)
self.sigmoid = nn.Sigmoid()
def forward(self, x):
y = self.conv(x)
y = self.sigmoid(y)
out = tor... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dyn... | qwopqwop200/Fast-Invertible-Rescaling-Net | PA | false | 7,521 | [
"MIT"
] | 1 | 871733f2eee7929d6b37c4d1d6a27347b39b67a9 | https://github.com/qwopqwop200/Fast-Invertible-Rescaling-Net/tree/871733f2eee7929d6b37c4d1d6a27347b39b67a9 |
TextureLoss | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
def gram_matrix(input):
a, b, c, d = input.size()
features = input.view(a, b, c * d)
G = torch.bmm(features, torch.transpose(features, 1, 2))
return G.div(b * c * d)
class TextureLoss(nn.Module):
def __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
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dyn... | qwopqwop200/Fast-Invertible-Rescaling-Net | TextureLoss | false | 7,522 | [
"MIT"
] | 1 | 871733f2eee7929d6b37c4d1d6a27347b39b67a9 | https://github.com/qwopqwop200/Fast-Invertible-Rescaling-Net/tree/871733f2eee7929d6b37c4d1d6a27347b39b67a9 |
Conv2dMtl | from torch.nn import Module
import math
import torch
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
from torch.nn.modules.utils import _pair
class _ConvNdMtl(Module):
def __init__(self, in_channels, out_channels, kernel_size, stride,
pa... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
import math
from torch.nn.parameter import Parameter... | qianrusun1015/E3BM-1 | Conv2dMtl | false | 7,523 | [
"Apache-2.0"
] | 1 | d2c957bdff66fe28a288f1518f224a1e034d543f | https://github.com/qianrusun1015/E3BM-1/tree/d2c957bdff66fe28a288f1518f224a1e034d543f |
L2 | import torch
import torch.utils.data
import torch.nn as nn
class L2(nn.Module):
def __init__(self):
super(L2, self).__init__()
def forward(self, x, target):
return torch.mean(torch.sum((x - target) ** 2, (1, 2, 3)))
def get_inputs():
return [torch.rand([4, 4, 4, 4]), 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
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | qwopqwop200/Fast-Invertible-Rescaling-Net | L2 | false | 7,524 | [
"MIT"
] | 1 | 871733f2eee7929d6b37c4d1d6a27347b39b67a9 | https://github.com/qwopqwop200/Fast-Invertible-Rescaling-Net/tree/871733f2eee7929d6b37c4d1d6a27347b39b67a9 |
NoiseInjection | import torch
import torch.nn as nn
import torch.nn.parallel
class NoiseInjection(nn.Module):
def __init__(self, channel):
super().__init__()
self.weight = nn.Parameter(0.01 * torch.randn(1, channel, 1, 1))
def forward(self, feat, noise=None):
if noise is None:
noise = tor... | import torch
from torch import device
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | rakshithShetty/SemanticAdversary | NoiseInjection | false | 7,526 | [
"MIT"
] | 1 | e6d50f00af6f7d847cba4210613afea4be773254 | https://github.com/rakshithShetty/SemanticAdversary/tree/e6d50f00af6f7d847cba4210613afea4be773254 |
GaussianSmoothing | import math
import torch
import torch.nn as nn
import torch.nn.parallel
class GaussianSmoothing(nn.Module):
"""
Apply gaussian smoothing on a
1d, 2d or 3d tensor. Filtering is performed seperately for each channel
in the input using a depthwise convolution.
Arguments:
channels (int, sequen... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.nn.parallel
assert_size_stride = ... | rakshithShetty/SemanticAdversary | GaussianSmoothing | false | 7,528 | [
"MIT"
] | 1 | e6d50f00af6f7d847cba4210613afea4be773254 | https://github.com/rakshithShetty/SemanticAdversary/tree/e6d50f00af6f7d847cba4210613afea4be773254 |
TransformerEncoderLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.utils.data
import torch.distributions
class TransformerEncoderLayer(nn.Module):
def __init__(self, embed_dim, num_heads, hidden_size, dropout=0.0,
attention_dropout=0.0, activation_dropout=0.0):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ptigas/EGG | TransformerEncoderLayer | false | 7,529 | [
"MIT"
] | 1 | 5319cc9de2c17bc72de717737cfbb5be2285c59b | https://github.com/ptigas/EGG/tree/5319cc9de2c17bc72de717737cfbb5be2285c59b |
FocalLoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
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()
class Focal... | 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
... | raman32/LDAM-DRW | FocalLoss | false | 7,530 | [
"MIT"
] | 1 | 7ce2251c01b94c7259108a1e188457f0b720651d | https://github.com/raman32/LDAM-DRW/tree/7ce2251c01b94c7259108a1e188457f0b720651d |
F_conv | import torch
import warnings
import torch.nn as nn
import torch.nn.functional as F
class F_conv(nn.Module):
"""ResNet transformation, not itself reversible, just used below"""
def __init__(self, in_channels, channels, channels_hidden=None, stride=
None, kernel_size=3, leaky_slope=0.1, batch_norm=Fals... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 warnings
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guar... | ramonpeter/LaSeR | F_conv | false | 7,531 | [
"MIT"
] | 1 | 28daa6876256501ed0d3e84a4ddfedc7892bd528 | https://github.com/ramonpeter/LaSeR/tree/28daa6876256501ed0d3e84a4ddfedc7892bd528 |
Critic | import torch
class Critic(torch.nn.Module):
def __init__(self, critic_lr, critic_epochs):
super(Critic, self).__init__()
self.initialize_network()
self.optimizer = torch.optim.Adam(lr=critic_lr, params=self.
parameters())
self.loss = torch.nn.MSELoss()
self.dev... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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
assert_size_stride ... | Gregory-Eales/Proximal-Policy-Optimization | Critic | false | 7,532 | [
"Apache-2.0"
] | 1 | 134f930bd1436c34e79af9344fe70f75e11c8a30 | https://github.com/Gregory-Eales/Proximal-Policy-Optimization/tree/134f930bd1436c34e79af9344fe70f75e11c8a30 |
scaleCompositor | import torch
import torch.nn as nn
class ResBlock(nn.Module):
def __init__(self, in_ch, hid_ch):
super(ResBlock, self).__init__()
self.act = nn.ReLU()
self.conv1 = nn.Conv2d(in_ch, hid_ch, kernel_size=3, padding=1)
self.conv2 = nn.Conv2d(hid_ch, hid_ch, kernel_size=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._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | qbhan/pathembed | scaleCompositor | false | 7,533 | [
"MIT"
] | 1 | c21823529840593bf606e10696f5879e5adb51b2 | https://github.com/qbhan/pathembed/tree/c21823529840593bf606e10696f5879e5adb51b2 |
NormedLinear | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
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__()
self.weight = Pa... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | raman32/LDAM-DRW | NormedLinear | false | 7,534 | [
"MIT"
] | 1 | 7ce2251c01b94c7259108a1e188457f0b720651d | https://github.com/raman32/LDAM-DRW/tree/7ce2251c01b94c7259108a1e188457f0b720651d |
ParagraphPlanSelectionAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.cuda
import torch.distributed
def aeq(*args):
"""
Assert all arguments have the same value
"""
arguments = (arg for arg in args)
first = next(arguments)
assert all(arg == first for arg in arguments
), 'Not ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ratishsp/data2text-seq-plan-py | ParagraphPlanSelectionAttention | false | 7,535 | [
"MIT"
] | 1 | 16b5242903371280cae8d23ad5a2472d539ea744 | https://github.com/ratishsp/data2text-seq-plan-py/tree/16b5242903371280cae8d23ad5a2472d539ea744 |
GlobalAttentionContext | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.cuda
import torch.distributed
def aeq(*args):
"""
Assert all arguments have the same value
"""
arguments = (arg for arg in args)
first = next(arguments)
assert all(arg == first for arg in arguments
), 'Not ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ratishsp/data2text-seq-plan-py | GlobalAttentionContext | false | 7,537 | [
"MIT"
] | 1 | 16b5242903371280cae8d23ad5a2472d539ea744 | https://github.com/ratishsp/data2text-seq-plan-py/tree/16b5242903371280cae8d23ad5a2472d539ea744 |
CCX_loss | import torch
import torch.utils.data
import torch.nn as nn
class CCX_loss(nn.Module):
def __init__(self, eps=1e-06, h=0.5):
super(CCX_loss, self).__init__()
self.eps = eps
self.h = h
def forward(self, x, y):
N, C, _H, _W = x.size()
y_mu = y.mean(3).mean(2).mean(0).res... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | qwopqwop200/Fast-Invertible-Rescaling-Net | CCX_loss | false | 7,538 | [
"MIT"
] | 1 | 871733f2eee7929d6b37c4d1d6a27347b39b67a9 | https://github.com/qwopqwop200/Fast-Invertible-Rescaling-Net/tree/871733f2eee7929d6b37c4d1d6a27347b39b67a9 |
DepthConv2dv2 | import torch
import numpy as np
import torch.nn as nn
from torch.autograd import Variable
class tLN(nn.Module):
def __init__(self, dimension, eps=1e-08, trainable=True):
super(tLN, self).__init__()
self.eps = eps
if trainable:
self.gain = nn.Parameter(torch.ones(1, dimension, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import numpy as np
... | rbodo/pytorch-OpCounter | DepthConv2dv2 | false | 7,539 | [
"MIT"
] | 1 | 1857cbb5f9e53343fb349af84efdfde2554a2691 | https://github.com/rbodo/pytorch-OpCounter/tree/1857cbb5f9e53343fb349af84efdfde2554a2691 |
tLN | import torch
import torch.nn as nn
from torch.autograd import Variable
class tLN(nn.Module):
def __init__(self, dimension, eps=1e-08, trainable=True):
super(tLN, self).__init__()
self.eps = eps
if trainable:
self.gain = nn.Parameter(torch.ones(1, dimension, 1, 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 libdevice
import torch.nn as nn
from torch.autograd import Variable
assert_size_stride = ... | rbodo/pytorch-OpCounter | tLN | false | 7,540 | [
"MIT"
] | 1 | 1857cbb5f9e53343fb349af84efdfde2554a2691 | https://github.com/rbodo/pytorch-OpCounter/tree/1857cbb5f9e53343fb349af84efdfde2554a2691 |
LearnedKernel | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class LearnedKernel(nn.Module):
def __init__(self, args: 'Namespace'):
super(LearnedKernel, self).__init__()
self.A = nn.Linear(args.ffn_hidden_size, args.ffn_hidden_size)
def forward(self, encodings: 'torch.Ten... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | AayushGrover/ViscaNet | LearnedKernel | false | 7,541 | [
"MIT"
] | 1 | 41786e10b84f2264b638567bdce1c189c1b66b00 | https://github.com/AayushGrover/ViscaNet/tree/41786e10b84f2264b638567bdce1c189c1b66b00 |
ProteinResNetPooler | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class ProteinResNetPooler(nn.Module):
def __init__(self, config):
super().__init__()
self.attention_weights = nn.Linear(config.hidden_size, 1)
self.dense = nn.Linear(config.hidden_size, config.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.triton_helpers import libdevice, math as tl_math
im... | rdedhia/tape | ProteinResNetPooler | false | 7,542 | [
"BSD-3-Clause"
] | 1 | 421feeb589e4469fb18e297d233d12c1e682338a | https://github.com/rdedhia/tape/tree/421feeb589e4469fb18e297d233d12c1e682338a |
Scale | import torch
from torch import nn
class Scale(nn.Module):
def __init__(self, num_features):
super().__init__()
self.num_features = num_features
self.scale = nn.Parameter(torch.zeros(num_features))
self.register_buffer('saved_mean', torch.zeros(num_features))
self.register_... | 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... | rgflowopen/rg-flow | Scale | false | 7,543 | [
"MIT"
] | 1 | f1ebb56e3e51bb26ecc2f10fe61eb34cae18398b | https://github.com/rgflowopen/rg-flow/tree/f1ebb56e3e51bb26ecc2f10fe61eb34cae18398b |
Swish | import torch
from torch import nn
class Swish(nn.Module):
def __init__(self, num_features):
super().__init__()
self.num_features = num_features
self.scale = nn.Parameter(torch.ones(num_features))
def forward(self, x):
return x * torch.sigmoid(self.scale * x)
def extra_re... | 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... | rgflowopen/rg-flow | Swish | false | 7,544 | [
"MIT"
] | 1 | f1ebb56e3e51bb26ecc2f10fe61eb34cae18398b | https://github.com/rgflowopen/rg-flow/tree/f1ebb56e3e51bb26ecc2f10fe61eb34cae18398b |
PADB | import torch
import torch.utils.data
import torch.nn as nn
class PA(nn.Module):
def __init__(self, nf):
super(PA, self).__init__()
self.conv = nn.Conv2d(nf, nf, 1)
self.sigmoid = nn.Sigmoid()
def forward(self, x):
y = self.conv(x)
y = self.sigmoid(y)
out = tor... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dyn... | qwopqwop200/Fast-Invertible-Rescaling-Net | PADB | false | 7,545 | [
"MIT"
] | 1 | 871733f2eee7929d6b37c4d1d6a27347b39b67a9 | https://github.com/qwopqwop200/Fast-Invertible-Rescaling-Net/tree/871733f2eee7929d6b37c4d1d6a27347b39b67a9 |
tLNv2 | import torch
import torch.nn as nn
from torch.autograd import Variable
def my_mean(x):
f = x.shape[-1]
mean = x[..., 0]
for i in range(1, f):
mean += x[..., i]
return mean[..., None] / f
class tLNv2(nn.Module):
def __init__(self, dimension, eps=1e-08, trainable=True):
super(tLNv... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
from torch.autograd import Variable
assert_size_stride = ... | rbodo/pytorch-OpCounter | tLNv2 | false | 7,546 | [
"MIT"
] | 1 | 1857cbb5f9e53343fb349af84efdfde2554a2691 | https://github.com/rbodo/pytorch-OpCounter/tree/1857cbb5f9e53343fb349af84efdfde2554a2691 |
Net1 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.parallel
import torch.optim
class Net1(nn.Module):
def __init__(self):
super(Net1, self).__init__()
self.conv1 = nn.Conv2d(1, 32, 3, 1)
self.conv2... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | ringier-data/deep-learning-containers | Net1 | false | 7,547 | [
"Apache-2.0"
] | 1 | e939ceee48a426f9ae4e0b50317dc2fa8845a312 | https://github.com/ringier-data/deep-learning-containers/tree/e939ceee48a426f9ae4e0b50317dc2fa8845a312 |
F_fully_convolutional | import torch
import torch.nn as nn
import torch.nn.functional as F
class F_fully_convolutional(nn.Module):
def __init__(self, in_channels, out_channels, internal_size=256,
kernel_size=3, leaky_slope=0.02):
super().__init__()
pad = kernel_size // 2
self.leaky_slope = leaky_slope
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | ramonpeter/LaSeR | F_fully_convolutional | false | 7,548 | [
"MIT"
] | 1 | 28daa6876256501ed0d3e84a4ddfedc7892bd528 | https://github.com/ramonpeter/LaSeR/tree/28daa6876256501ed0d3e84a4ddfedc7892bd528 |
DepthConv2d | import torch
import numpy as np
import torch.nn as nn
from torch.autograd import Variable
class tLN(nn.Module):
def __init__(self, dimension, eps=1e-08, trainable=True):
super(tLN, self).__init__()
self.eps = eps
if trainable:
self.gain = nn.Parameter(torch.ones(1, dimension, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import numpy as np
... | rbodo/pytorch-OpCounter | DepthConv2d | false | 7,549 | [
"MIT"
] | 1 | 1857cbb5f9e53343fb349af84efdfde2554a2691 | https://github.com/rbodo/pytorch-OpCounter/tree/1857cbb5f9e53343fb349af84efdfde2554a2691 |
PrimaryCapsules | import torch
import torch.nn as nn
def squash(s, dim=-1):
"""
"Squashing" non-linearity that shrunks short vectors to almost zero length and long vectors to a length slightly below 1
Eq. (1): v_j = ||s_j||^2 / (1 + ||s_j||^2) * s_j / ||s_j||
Args:
s: Vector before activation
dim: Dimension along which t... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | richardsun-voyager/capsule-network | PrimaryCapsules | false | 7,550 | [
"MIT"
] | 1 | 349cec1caa9ab95ff4b3333c33d04b1bdb442f67 | https://github.com/richardsun-voyager/capsule-network/tree/349cec1caa9ab95ff4b3333c33d04b1bdb442f67 |
ChannelAttentionModule | import torch
import torch.nn as nn
import torch.nn.functional as F
class ChannelAttentionModule(nn.Module):
def __init__(self):
super(ChannelAttentionModule, self).__init__()
self.beta = nn.Parameter(torch.zeros(1), requires_grad=True)
def forward(self, A):
batchsize, num_channels, h... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | rinkwitz/Thesis_Semantic_Image_Segmentation_on_Satellite_Imagery_using_UNets | ChannelAttentionModule | false | 7,551 | [
"MIT"
] | 1 | 75d3a4a536f6ef81fe0efd4f5fbba32b627a7472 | https://github.com/rinkwitz/Thesis_Semantic_Image_Segmentation_on_Satellite_Imagery_using_UNets/tree/75d3a4a536f6ef81fe0efd4f5fbba32b627a7472 |
Concat2d | import torch
import torch.nn as nn
import torch.nn.functional as F
class Concat2d(nn.Module):
def __init__(self):
super(Concat2d, self).__init__()
def forward(self, x_down, x_enc):
if x_down.shape[-1] > x_enc.shape[-1]:
p = (x_down.shape[-1] - x_enc.shape[-1]) // 2
if... | 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... | rinkwitz/Thesis_Semantic_Image_Segmentation_on_Satellite_Imagery_using_UNets | Concat2d | false | 7,552 | [
"MIT"
] | 1 | 75d3a4a536f6ef81fe0efd4f5fbba32b627a7472 | https://github.com/rinkwitz/Thesis_Semantic_Image_Segmentation_on_Satellite_Imagery_using_UNets/tree/75d3a4a536f6ef81fe0efd4f5fbba32b627a7472 |
ResBlock | import torch
import torch.nn as nn
from torch.nn import functional as F
class ResBlock(nn.Module):
"""Residual block with bilinear upsampling/downsampling.
Args:
in_channels (int): Channel number of the input.
out_channels (int): Channel number of the output.
mode (str): Upsampling/do... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | rawandahmad698/GFPGAN | ResBlock | false | 7,553 | [
"BSD-3-Clause"
] | 1 | 4700bf1a94ec9c36746f660db19f4f03e0eed9b0 | https://github.com/rawandahmad698/GFPGAN/tree/4700bf1a94ec9c36746f660db19f4f03e0eed9b0 |
CapsuleLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class MarginLoss(nn.Module):
def __init__(self, size_average=False, loss_lambda=0.5):
"""
Margin loss for digit existence
Eq. (4): L_k = T_k * max(0, m+ - ||v_k||)^2 + lambda * (1 - T_k) * max(0, ||v_k|| - m-)^2
Args:
size_ave... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.nn.functional as F
assert_size_stride = torch._C._dyna... | richardsun-voyager/capsule-network | CapsuleLoss | false | 7,554 | [
"MIT"
] | 1 | 349cec1caa9ab95ff4b3333c33d04b1bdb442f67 | https://github.com/richardsun-voyager/capsule-network/tree/349cec1caa9ab95ff4b3333c33d04b1bdb442f67 |
GAT | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
def attention(query, key, value, mask=None, dropout=None, return_scores=False):
"""Compute 'Scaled Dot Product Attention'"""
d_k = query.size(-1)
scores = torch.matmul(query, key.transpose(-2, -1)) / math.sqrt(d_k)
if mask ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | qinyan-li/DocEE | GAT | false | 7,555 | [
"MIT"
] | 1 | e8d2202a44907df5f12f9a67180d849a54421ab7 | https://github.com/qinyan-li/DocEE/tree/e8d2202a44907df5f12f9a67180d849a54421ab7 |
ResBlock | import torch
from torch import nn
import torch.nn.functional as F
class LinearAndMultiply(nn.Module):
def __init__(self, input_size, output_size, use_multiply=True,
linear_block=nn.Linear):
super().__init__()
self._activation = nn.CELU()
self._linear = linear_block(input_size, 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.triton_helpers import libdevice
from torch import n... | rgreenblatt/path | ResBlock | false | 7,556 | [
"MIT"
] | 1 | 2057618ee3a6067c230c1c1c40856d2c9f5006b0 | https://github.com/rgreenblatt/path/tree/2057618ee3a6067c230c1c1c40856d2c9f5006b0 |
SAM | import torch
import torch.nn as nn
class SAM(nn.Module):
def __init__(self, channels_in):
super(SAM, self).__init__()
self.channels_in = channels_in
self.avg_pool = nn.AvgPool3d(kernel_size=(self.channels_in, 1, 1))
self.max_pool = nn.MaxPool3d(kernel_size=(self.channels_in, 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | rinkwitz/Thesis_Semantic_Image_Segmentation_on_Satellite_Imagery_using_UNets | SAM | false | 7,557 | [
"MIT"
] | 1 | 75d3a4a536f6ef81fe0efd4f5fbba32b627a7472 | https://github.com/rinkwitz/Thesis_Semantic_Image_Segmentation_on_Satellite_Imagery_using_UNets/tree/75d3a4a536f6ef81fe0efd4f5fbba32b627a7472 |
Affine | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
class Affine(nn.Module):
def __init__(self, dim):
super().__init__()
self.alpha = nn.Parameter(torch.ones((1, 1, dim)))
self.beta = nn.Parameter(torch.zeros((1, 1, dim)))
def forward(self, x):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty... | rioyokotalab/pytorch-image-models | Affine | false | 7,558 | [
"Apache-2.0"
] | 1 | 87d8d3c14b64bb6a76402f363a1e1ee1829bca93 | https://github.com/rioyokotalab/pytorch-image-models/tree/87d8d3c14b64bb6a76402f363a1e1ee1829bca93 |
PositionalAttentionModule | import torch
import torch.nn as nn
import torch.nn.functional as F
class PositionalAttentionModule(nn.Module):
def __init__(self, in_channels):
super(PositionalAttentionModule, self).__init__()
self.in_channels = in_channels
self.conv_B = nn.Conv2d(in_channels=self.in_channels, out_channe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | rinkwitz/Thesis_Semantic_Image_Segmentation_on_Satellite_Imagery_using_UNets | PositionalAttentionModule | false | 7,559 | [
"MIT"
] | 1 | 75d3a4a536f6ef81fe0efd4f5fbba32b627a7472 | https://github.com/rinkwitz/Thesis_Semantic_Image_Segmentation_on_Satellite_Imagery_using_UNets/tree/75d3a4a536f6ef81fe0efd4f5fbba32b627a7472 |
UpConcat2d | import torch
import torch.nn as nn
import torch.nn.functional as F
class UpConcat2d(nn.Module):
def __init__(self, in_channels_conv, out_channels_conv, scale_factor=2):
super(UpConcat2d, self).__init__()
self.in_channels_conv = in_channels_conv
self.out_channels_conv = out_channels_conv
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | rinkwitz/Thesis_Semantic_Image_Segmentation_on_Satellite_Imagery_using_UNets | UpConcat2d | false | 7,560 | [
"MIT"
] | 1 | 75d3a4a536f6ef81fe0efd4f5fbba32b627a7472 | https://github.com/rinkwitz/Thesis_Semantic_Image_Segmentation_on_Satellite_Imagery_using_UNets/tree/75d3a4a536f6ef81fe0efd4f5fbba32b627a7472 |
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(DiscShiftLoss, self).__init__()
self.loss_weight = loss_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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | rivergold/mmediting | DiscShiftLoss | false | 7,561 | [
"Apache-2.0"
] | 1 | fd972635c48bb065db29d1b5090592a87c7263d2 | https://github.com/rivergold/mmediting/tree/fd972635c48bb065db29d1b5090592a87c7263d2 |
Attention | import torch
from torch import nn
class Attention(nn.Module):
def __init__(self, heads, dim, hidden_dim):
super().__init__()
self.dim = dim
self.hdim = hidden_dim
self.heads = heads
self.to_q = nn.Linear(dim, hidden_dim * heads)
self.to_k = nn.Linear(dim, hidden_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 import triton_helpers
from torch._inductor.runtime.... | rish-16/audio-tf-pytorch | Attention | false | 7,562 | [
"MIT"
] | 1 | 397a6e9f1a97cce774202d392eb9706f0483405c | https://github.com/rish-16/audio-tf-pytorch/tree/397a6e9f1a97cce774202d392eb9706f0483405c |
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... | rivergold/mmediting | CharbonnierCompLoss | false | 7,563 | [
"Apache-2.0"
] | 1 | fd972635c48bb065db29d1b5090592a87c7263d2 | https://github.com/rivergold/mmediting/tree/fd972635c48bb065db29d1b5090592a87c7263d2 |
sAG | import torch
import torch.nn as nn
class sAG(nn.Module):
def __init__(self, num_channels_in_enc, num_channels_in_dec):
super(sAG, self).__init__()
self.num_channels_in_enc = num_channels_in_enc
self.num_channels_in_dec = num_channels_in_dec
self.ch_max_pool_enc = nn.MaxPool3d(kern... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | rinkwitz/Thesis_Semantic_Image_Segmentation_on_Satellite_Imagery_using_UNets | sAG | false | 7,564 | [
"MIT"
] | 1 | 75d3a4a536f6ef81fe0efd4f5fbba32b627a7472 | https://github.com/rinkwitz/Thesis_Semantic_Image_Segmentation_on_Satellite_Imagery_using_UNets/tree/75d3a4a536f6ef81fe0efd4f5fbba32b627a7472 |
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... | rivergold/mmediting | L1CompositionLoss | false | 7,565 | [
"Apache-2.0"
] | 1 | fd972635c48bb065db29d1b5090592a87c7263d2 | https://github.com/rivergold/mmediting/tree/fd972635c48bb065db29d1b5090592a87c7263d2 |
DeepSupervisionModule | import torch
import torch.nn as nn
class DeepSupervisionModule(nn.Module):
def __init__(self, up_sampling_factors=(2, 2, 2)):
super(DeepSupervisionModule, self).__init__()
self.up = nn.UpsamplingBilinear2d(scale_factor=2)
self.up_sampling_factors = up_sampling_factors
def forward(sel... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | rinkwitz/Thesis_Semantic_Image_Segmentation_on_Satellite_Imagery_using_UNets | DeepSupervisionModule | false | 7,566 | [
"MIT"
] | 1 | 75d3a4a536f6ef81fe0efd4f5fbba32b627a7472 | https://github.com/rinkwitz/Thesis_Semantic_Image_Segmentation_on_Satellite_Imagery_using_UNets/tree/75d3a4a536f6ef81fe0efd4f5fbba32b627a7472 |
Attention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class Attention(nn.Module):
def __init__(self, embed_dim, hidden_dim=None, out_dim=None, n_head=1,
score_function='dot_product', dropout=0):
""" Attention Mechanism
:param embed_dim:
:param hidden_dim:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | rmarcacini/LC-ABSA | Attention | false | 7,567 | [
"MIT"
] | 1 | 90ae7f41b3766761005caf015292926127fe3949 | https://github.com/rmarcacini/LC-ABSA/tree/90ae7f41b3766761005caf015292926127fe3949 |
Conv | import torch
import torch.utils.data
from torch import nn
class Conv(nn.Module):
"""
2d卷积
先batchnorm再ReLU,默认有ReLU但是没有BN
默认小核
"""
def __init__(self, inp_dim, out_dim, kernel_size=3, stride=1, bn=False,
relu=True):
super(Conv, self).__init__()
self.inp_dim = inp_dim
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | rm-rf-me/Study-stacked-hourglass | Conv | false | 7,568 | [
"BSD-3-Clause"
] | 1 | 48441f0dd5ae3397470c70db0f50ab5576b9d2f2 | https://github.com/rm-rf-me/Study-stacked-hourglass/tree/48441f0dd5ae3397470c70db0f50ab5576b9d2f2 |
LandmarkHead | import torch
import torch.nn as nn
from itertools import product as product
class LandmarkHead(nn.Module):
def __init__(self, inchannels=512, num_anchors=3):
super(LandmarkHead, self).__init__()
self.conv1x1 = nn.Conv2d(inchannels, num_anchors * 8, kernel_size=(
1, 1), stride=1, paddi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from itertools import product as product
assert_size_strid... | qw85639229/Car_License_SVM | LandmarkHead | false | 7,569 | [
"MIT"
] | 1 | c5b0062e84e5000c7940b1d90cc7c63e52afed21 | https://github.com/qw85639229/Car_License_SVM/tree/c5b0062e84e5000c7940b1d90cc7c63e52afed21 |
Attention | import torch
import torch.nn.functional as F
class Attention(torch.nn.Module):
def __init__(self, features, attn_dim):
super(Attention, self).__init__()
self.to_q = torch.nn.Linear(features, attn_dim)
self.to_k = torch.nn.Linear(features, attn_dim)
self.to_v = torch.nn.Linear(feat... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | rish-16/pytorch-graphdl | Attention | false | 7,570 | [
"MIT"
] | 1 | 631da8cbf24e67fab2122c507e1935d4acf26e41 | https://github.com/rish-16/pytorch-graphdl/tree/631da8cbf24e67fab2122c507e1935d4acf26e41 |
DQN | import torch
import torch.nn as nn
import torch.nn.functional as F
class DQN(nn.Module):
"""
Deep Q-Network: Actor (Policy) Model.
(function approximator for the Q-table)
"""
def __init__(self, state_size, action_size, seed, fc1_unit=64, fc2_unit=64
):
"""
Initialize 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
import torch.nn as nn
assert_... | qarchli/dqn-on-space-invaders | DQN | false | 7,571 | [
"MIT"
] | 1 | 148f1a7b65b2f47dab736b08cc7d6b7de1725a00 | https://github.com/qarchli/dqn-on-space-invaders/tree/148f1a7b65b2f47dab736b08cc7d6b7de1725a00 |
HeatmapLoss | import torch
import torch.utils.data
class HeatmapLoss(torch.nn.Module):
"""
loss for detection heatmap
"""
def __init__(self):
super(HeatmapLoss, self).__init__()
def forward(self, pred, gt):
l = (pred - gt) ** 2
l = l.mean(dim=3).mean(dim=2).mean(dim=1)
return l... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_... | rm-rf-me/Study-stacked-hourglass | HeatmapLoss | false | 7,572 | [
"BSD-3-Clause"
] | 1 | 48441f0dd5ae3397470c70db0f50ab5576b9d2f2 | https://github.com/rm-rf-me/Study-stacked-hourglass/tree/48441f0dd5ae3397470c70db0f50ab5576b9d2f2 |
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... | rivergold/mmediting | MSECompositionLoss | false | 7,573 | [
"Apache-2.0"
] | 1 | fd972635c48bb065db29d1b5090592a87c7263d2 | https://github.com/rivergold/mmediting/tree/fd972635c48bb065db29d1b5090592a87c7263d2 |
Entmax15 | from torch.autograd import Function
import torch
import torch.nn as nn
def _make_ix_like(X, dim):
d = X.size(dim)
rho = torch.arange(1, d + 1, device=X.device, dtype=X.dtype)
view = [1] * X.dim()
view[0] = -1
return rho.view(view).transpose(0, dim)
def _roll_last(X, dim):
if 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._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch.autograd import F... | roholazandie/entmax | Entmax15 | false | 7,574 | [
"MIT"
] | 1 | 657374e6a792ec6840b6f78bc759cc1f51570aad | https://github.com/roholazandie/entmax/tree/657374e6a792ec6840b6f78bc759cc1f51570aad |
TransformerLayer | import torch
from torch import nn
from typing import Optional
class TransformerLayer(nn.Module):
"""TransformerEncoderLayer is made up of self-attn and feedforward network.
This standard encoder layer is based on the paper "Attention Is All You Need".
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszko... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | rgreenblatt/path | TransformerLayer | false | 7,575 | [
"MIT"
] | 1 | 2057618ee3a6067c230c1c1c40856d2c9f5006b0 | https://github.com/rgreenblatt/path/tree/2057618ee3a6067c230c1c1c40856d2c9f5006b0 |
AE | import torch
import torch.nn as nn
class AE(nn.Module):
def __init__(self):
super(AE, self).__init__()
self.leaky_reLU = nn.LeakyReLU(0.2)
self.pool = nn.MaxPool2d(kernel_size=2, stride=2, padding=1,
return_indices=True)
self.unpool = nn.MaxUnpool2d(kernel_size=2, stri... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | personwhofloat/Line-Segmentation-Model | AE | false | 7,576 | [
"MIT"
] | 1 | f00b65c7914f44fa31e14d41120903d0da2d5496 | https://github.com/personwhofloat/Line-Segmentation-Model/tree/f00b65c7914f44fa31e14d41120903d0da2d5496 |
GeM | import torch
import torch.nn.functional as F
def gem(x, p=3, eps=1e-06):
return F.avg_pool2d(x.clamp(min=eps).pow(p), (x.size(-2), x.size(-1))).pow(
1.0 / p)
class GeM(torch.nn.Module):
"""
Implementation of GeM pooling.
https://paperswithcode.com/method/generalized-mean-pooling
NOTE:
... | 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.functional a... | rskmoi/landmark-retrieval-2020-with-pytorch | GeM | false | 7,577 | [
"MIT"
] | 1 | 41917b1f588b5ad396cb1095867a0f042c611675 | https://github.com/rskmoi/landmark-retrieval-2020-with-pytorch/tree/41917b1f588b5ad396cb1095867a0f042c611675 |
L2Norm | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class L2Norm(nn.Module):
"""
Scale shall be learnable according to original paper
scale: initial scale number
chan_num: L2Norm channel number (norm over 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 import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import... | rotorliu/DALI | L2Norm | false | 7,578 | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 4ea3529fc9b35cbdf09b260ec95197cfd52c0395 | https://github.com/rotorliu/DALI/tree/4ea3529fc9b35cbdf09b260ec95197cfd52c0395 |
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.... | rivergold/mmediting | SRCNN | false | 7,579 | [
"Apache-2.0"
] | 1 | fd972635c48bb065db29d1b5090592a87c7263d2 | https://github.com/rivergold/mmediting/tree/fd972635c48bb065db29d1b5090592a87c7263d2 |
Swish | from torch.autograd import Function
import torch
from torch import nn
def swish(x, beta=1.0):
"""Swish activation.
'https://arxiv.org/pdf/1710.05941.pdf'
Args:
x: Input tensor.
beta:
"""
return SwishOP.apply(x, beta)
class SwishOP(Function):
@staticmethod
def forward(ctx... | 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.autograd import Function
from torch import nn
assert_size_stri... | sailfish009/torch-toolbox | Swish | false | 7,580 | [
"BSD-3-Clause"
] | 1 | 80dfc22c697b9f323e097de72af04f0e5435d7b4 | https://github.com/sailfish009/torch-toolbox/tree/80dfc22c697b9f323e097de72af04f0e5435d7b4 |
Encoder | import torch
import torch.nn as nn
class Encoder(nn.Module):
"""
Takes in data, returns mu and sigma for variational approximation of latent variable.
"""
def __init__(self, alph_size, seq_len, z_dim=30, hidden_architecture=[
1500, 1500]):
super(Encoder, self).__init__()
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.... | rorymaizels/AC299r | Encoder | false | 7,581 | [
"MIT"
] | 1 | eb4b76ad52a10b9af0579ec3f725ec8fc90b00f1 | https://github.com/rorymaizels/AC299r/tree/eb4b76ad52a10b9af0579ec3f725ec8fc90b00f1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.