entry_point stringlengths 1 65 | original_triton_code stringlengths 4.5k 619k | python_code stringlengths 208 60.9k | 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 | pytorch_code stringlengths 200 4.05k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
SqueezeInitBlock | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.utils.data
import torch.nn as nn
class SqueezeInitBlock(nn.Module):
"""
SqueezeNet specific initial block.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
kernel_size : int or tuple/... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | HyperGAN/imgclsmob | SqueezeInitBlock | false | 17,682 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | import torch
import torch.utils.data
import torch.nn as nn
class Model(nn.Module):
"""
SqueezeNet specific initial block.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
kernel_size : int or tuple/list of 2 i... |
WRNBottleneck | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.utils.data
import torch.nn as nn
def wrn_conv1x1(in_channels, out_channels, stride, activate):
"""
1x1 version of the WRN specific convolution block.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of outpu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | HyperGAN/imgclsmob | WRNBottleneck | false | 17,683 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | import torch
import torch.utils.data
import torch.nn as nn
def wrn_conv1x1(in_channels, out_channels, stride, activate):
"""
1x1 version of the WRN specific convolution block.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of outpu... |
NasMaxPoolBlock | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.utils.data
import torch.nn as nn
class NasMaxPoolBlock(nn.Module):
"""
NASNet specific Max pooling layer with extra padding.
Parameters:
----------
extra_padding : bool, default False
Whether to use extra padding.
"""
def __init__(self, extra_padding=Fal... | 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.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guard... | HyperGAN/imgclsmob | NasMaxPoolBlock | false | 17,684 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | import torch
import torch.utils.data
import torch.nn as nn
class Model(nn.Module):
"""
NASNet specific Max pooling layer with extra padding.
Parameters:
----------
extra_padding : bool, default False
Whether to use extra padding.
"""
def __init__(self, extra_padding=False):
... |
NasPathBranch | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.utils.data
import torch.nn as nn
def conv1x1(in_channels, out_channels, stride=1, groups=1, bias=False):
"""
Convolution 1x1 layer.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
st... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | HyperGAN/imgclsmob | NasPathBranch | false | 17,685 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | import torch
import torch.utils.data
import torch.nn as nn
def conv1x1(in_channels, out_channels, stride=1, groups=1, bias=False):
"""
Convolution 1x1 layer.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
st... |
NasAvgPoolBlock | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.utils.data
import torch.nn as nn
class NasAvgPoolBlock(nn.Module):
"""
NASNet specific 3x3 Average pooling layer with extra padding.
Parameters:
----------
extra_padding : bool, default False
Whether to use extra padding.
"""
def __init__(self, extra_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.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | HyperGAN/imgclsmob | NasAvgPoolBlock | false | 17,686 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | import torch
import torch.utils.data
import torch.nn as nn
class Model(nn.Module):
"""
NASNet specific 3x3 Average pooling layer with extra padding.
Parameters:
----------
extra_padding : bool, default False
Whether to use extra padding.
"""
def __init__(self, extra_padding=False... |
SPHead | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
from inspect import isfunction
def get_activation_layer(activation):
"""
Create activation layer from string/function.
Parameters:
----------
activation : function, or str, or nn.Module
Activation f... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | HyperGAN/imgclsmob | SPHead | false | 17,687 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
from inspect import isfunction
def get_activation_layer(activation):
"""
Create activation layer from string/function.
Parameters:
----------
activation : function, or str, or nn.Module
Activation f... |
XConv2d | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
class XConv2d(nn.Conv2d):
"""
X-Convolution layer.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
kernel_size : int ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dyn... | HyperGAN/imgclsmob | XConv2d | false | 17,688 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Conv2d):
"""
X-Convolution layer.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
kernel_size : int or... |
IBNbResInitBlock | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.utils.data
import torch.nn as nn
def ibnb_conv7x7_block(in_channels, out_channels, stride=1, padding=3, bias
=False, activate=True):
"""
7x7 version of the IBN(b)-ResNet specific convolution block.
Parameters:
----------
in_channels : int
Number of input chan... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | HyperGAN/imgclsmob | IBNbResInitBlock | false | 17,689 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | import torch
import torch.utils.data
import torch.nn as nn
def ibnb_conv7x7_block(in_channels, out_channels, stride=1, padding=3, bias
=False, activate=True):
"""
7x7 version of the IBN(b)-ResNet specific convolution block.
Parameters:
----------
in_channels : int
Number of input chan... |
Conv2dBlock | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn.functional as F
from torch import nn
class AdaptiveInstanceNorm2d(nn.Module):
def __init__(self, num_features, eps=1e-05, momentum=0.1):
super(AdaptiveInstanceNorm2d, self).__init__()
self.num_features = num_features
self.eps = eps
self.momentum = mome... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn.functional as... | MattAlexMiracle/SmartPatch | Conv2dBlock | false | 17,690 | [
"MIT"
] | 7 | c485cb433d8e085d6eae10a335ee19f5e6c1a41c | https://github.com/MattAlexMiracle/SmartPatch/tree/c485cb433d8e085d6eae10a335ee19f5e6c1a41c | import torch
import torch.nn.functional as F
from torch import nn
class AdaptiveInstanceNorm2d(nn.Module):
def __init__(self, num_features, eps=1e-05, momentum=0.1):
super().__init__()
self.num_features = num_features
self.eps = eps
self.momentum = momentum
self.weight = N... |
WRNUnit | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.utils.data
import torch.nn as nn
def wrn_conv1x1(in_channels, out_channels, stride, activate):
"""
1x1 version of the WRN specific convolution block.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of outpu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | HyperGAN/imgclsmob | WRNUnit | false | 17,691 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | import torch
import torch.utils.data
import torch.nn as nn
def wrn_conv1x1(in_channels, out_channels, stride, activate):
"""
1x1 version of the WRN specific convolution block.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of outpu... |
WRNInitBlock | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.utils.data
import torch.nn as nn
class WRNConv(nn.Module):
"""
WRN specific convolution block.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
kernel_size : int or tuple/list of 2 in... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | HyperGAN/imgclsmob | WRNInitBlock | false | 17,692 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | import torch
import torch.utils.data
import torch.nn as nn
class WRNConv(nn.Module):
"""
WRN specific convolution block.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
kernel_size : int or tuple/list of 2 in... |
AlexOutputBlock | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.utils.data
import torch.nn as nn
class AlexDense(nn.Module):
"""
AlexNet specific dense block.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
"""
def __init__(self, in_channels... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | HyperGAN/imgclsmob | AlexOutputBlock | false | 17,693 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | import torch
import torch.utils.data
import torch.nn as nn
class AlexDense(nn.Module):
"""
AlexNet specific dense block.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
"""
def __init__(self, in_channels... |
Swish | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.parallel
class Swish(nn.Module):
def __init__(self):
super(Swish, self).__init__()
def forward(self, x):
return 1.78718727865 * (x * torch.sigmoid(x) - 0.20662096414)
def get_inputs():
return [torch.rand([4, 4, ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
import torch.nn.parallel
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty... | Manojbhat09/Sane-annotation-shape-complete | Swish | false | 17,694 | [
"Apache-2.0"
] | 9 | 03b298b2c0a187be979ff31ad2a39238b72a6d78 | https://github.com/Manojbhat09/Sane-annotation-shape-complete/tree/03b298b2c0a187be979ff31ad2a39238b72a6d78 | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.parallel
class Model(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
return 1.78718727865 * (x * torch.sigmoid(x) - 0.20662096414)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
d... |
NLL | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.parallel
class NLL(nn.Module):
def __init__(self):
super(NLL, self).__init__()
def forward(self, x):
return torch.mean(x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.utils.data
import torch.nn.parallel
assert_size_stride... | Manojbhat09/Sane-annotation-shape-complete | NLL | false | 17,695 | [
"Apache-2.0"
] | 9 | 03b298b2c0a187be979ff31ad2a39238b72a6d78 | https://github.com/Manojbhat09/Sane-annotation-shape-complete/tree/03b298b2c0a187be979ff31ad2a39238b72a6d78 | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.parallel
class Model(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
return torch.mean(x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return []
|
NavigatorBranch | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.utils.data
import torch.nn as nn
def conv1x1(in_channels, out_channels, stride=1, groups=1, bias=False):
"""
Convolution 1x1 layer.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
st... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | HyperGAN/imgclsmob | NavigatorBranch | false | 17,696 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | import torch
import torch.utils.data
import torch.nn as nn
def conv1x1(in_channels, out_channels, stride=1, groups=1, bias=False):
"""
Convolution 1x1 layer.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
st... |
Classify | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
def autopad(k, p=None):
if p is None:
p = k // 2 if isinstance(k, int) else [(x // 2) for x in k]
return p
class Flatten(nn.Module):
@staticmethod
def forward(x):
return x.view(x.size(0), -1)
class Classify(nn.Module):
def __init__(self, c1,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Mac-AI/BNA-traffic-mapper | Classify | false | 17,697 | [
"MIT"
] | 4 | 9fcc3f516e18e19704444b6b848fc8aa356007bc | https://github.com/Mac-AI/BNA-traffic-mapper/tree/9fcc3f516e18e19704444b6b848fc8aa356007bc | import torch
import torch.nn as nn
def autopad(k, p=None):
if p is None:
p = k // 2 if isinstance(k, int) else [(x // 2) for x in k]
return p
class Flatten(nn.Module):
@staticmethod
def forward(x):
return x.view(x.size(0), -1)
class Model(nn.Module):
def __init__(self, c1, c2... |
Norm | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.parallel
class Norm(nn.Module):
def __init__(self, dims):
super(Norm, self).__init__()
self.dims = dims
def forward(self, x):
z2 = torch.norm(x, p=2)
out = z2 - self.dims
out = out * 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.nn as nn
import... | Manojbhat09/Sane-annotation-shape-complete | Norm | false | 17,698 | [
"Apache-2.0"
] | 9 | 03b298b2c0a187be979ff31ad2a39238b72a6d78 | https://github.com/Manojbhat09/Sane-annotation-shape-complete/tree/03b298b2c0a187be979ff31ad2a39238b72a6d78 | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.parallel
class Model(nn.Module):
def __init__(self, dims):
super().__init__()
self.dims = dims
def forward(self, x):
z2 = torch.norm(x, p=2)
out = z2 - self.dims
out = out * out
return ... |
BowEncoder | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
from torch.nn import functional as F
class BowEncoder(nn.Module):
"""
static information extractor
"""
def __init__(self, num_words, bow_mid_hid, dropout):
super().__init__()
self.fc1 = nn.Linear(num_words, bow_mid_hid)
self.fc_trans = 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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | Maxpa1n/case2vec | BowEncoder | false | 17,699 | [
"Apache-2.0"
] | 8 | 1e8f7a9ccbd5ef01409c7f03110b708bce467161 | https://github.com/Maxpa1n/case2vec/tree/1e8f7a9ccbd5ef01409c7f03110b708bce467161 | import torch
import torch.nn as nn
from torch.nn import functional as F
class Model(nn.Module):
"""
static information extractor
"""
def __init__(self, num_words, bow_mid_hid, dropout):
super().__init__()
self.fc1 = nn.Linear(num_words, bow_mid_hid)
self.fc_trans = nn.Linear(b... |
EquivariantLayer | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.parallel
from torch.nn.modules.batchnorm import _BatchNorm
class MyBatchNorm1d(_BatchNorm):
"""Applies Batch Normalization over a 2d or 3d input that is seen as a
mini-batch.
.. math::
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | Manojbhat09/Sane-annotation-shape-complete | EquivariantLayer | false | 17,700 | [
"Apache-2.0"
] | 9 | 03b298b2c0a187be979ff31ad2a39238b72a6d78 | https://github.com/Manojbhat09/Sane-annotation-shape-complete/tree/03b298b2c0a187be979ff31ad2a39238b72a6d78 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.parallel
from torch.nn.modules.batchnorm import _BatchNorm
class MyBatchNorm1d(_BatchNorm):
"""Applies Batch Normalization over a 2d or 3d input that is seen as a
mini-batch.
.. math::
... |
Critic | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.parallel
class Critic(nn.Module):
def __init__(self, state_dim, action_dim):
super(Critic, self).__init__()
self.l1 = nn.Linear(state_dim + action_dim, 400)
self.l2 = nn.Linear(400, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | Manojbhat09/Sane-annotation-shape-complete | Critic | false | 17,701 | [
"Apache-2.0"
] | 9 | 03b298b2c0a187be979ff31ad2a39238b72a6d78 | https://github.com/Manojbhat09/Sane-annotation-shape-complete/tree/03b298b2c0a187be979ff31ad2a39238b72a6d78 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.parallel
class Model(nn.Module):
def __init__(self, state_dim, action_dim):
super().__init__()
self.l1 = nn.Linear(state_dim + action_dim, 400)
self.l2 = nn.Linear(400, 300)
... |
extractNet_connected_v2 | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
class extractNet_connected_v2(nn.Module):
def __init__(self):
super(extractNet_connected_v2, self).__init__()
self.conv1 = nn.Conv2d(3, 16, 3, stride=2, padding=1)
self.conv2 = nn.Conv2d(16, 32, 3, stride=2, 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_... | MNRKhan/aps360-project | extractNet_connected_v2 | false | 17,702 | [
"MIT"
] | 3 | 1d91a4262c95cd6b5610aae16e1a30f2749a4373 | https://github.com/MNRKhan/aps360-project/tree/1d91a4262c95cd6b5610aae16e1a30f2749a4373 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(3, 16, 3, stride=2, padding=1)
self.conv2 = nn.Conv2d(16, 32, 3, stride=2, padding=1)
self.conv3 = nn.Conv2d(32, 64, 3, stride=2... |
Actor | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.parallel
class Actor(nn.Module):
def __init__(self, state_dim, action_dim, max_action):
super(Actor, self).__init__()
self.l1 = nn.Linear(state_dim, 400)
self.l2 = nn.Linear(400, 300... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Manojbhat09/Sane-annotation-shape-complete | Actor | false | 17,703 | [
"Apache-2.0"
] | 9 | 03b298b2c0a187be979ff31ad2a39238b72a6d78 | https://github.com/Manojbhat09/Sane-annotation-shape-complete/tree/03b298b2c0a187be979ff31ad2a39238b72a6d78 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.parallel
class Model(nn.Module):
def __init__(self, state_dim, action_dim, max_action):
super().__init__()
self.l1 = nn.Linear(state_dim, 400)
self.l2 = nn.Linear(400, 300)
s... |
quadexp | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch as tr
import torch.nn as nn
class quadexp(nn.Module):
def __init__(self, sigma=2.0):
super(quadexp, self).__init__()
self.sigma = sigma
def forward(self, x):
return tr.exp(-x ** 2 / self.sigma ** 2)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | MichaelArbel/MMD-gradient-flow | quadexp | false | 17,704 | [
"BSD-3-Clause"
] | 5 | aa7be78c53c1995ae156fb04b6f1b4fcf02dd039 | https://github.com/MichaelArbel/MMD-gradient-flow/tree/aa7be78c53c1995ae156fb04b6f1b4fcf02dd039 | import torch
import torch as tr
import torch.nn as nn
class Model(nn.Module):
def __init__(self, sigma=2.0):
super().__init__()
self.sigma = sigma
def forward(self, x):
return tr.exp(-x ** 2 / self.sigma ** 2)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_i... |
OneHiddenLayer | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch as tr
import torch.nn as nn
class quadexp(nn.Module):
def __init__(self, sigma=2.0):
super(quadexp, self).__init__()
self.sigma = sigma
def forward(self, x):
return tr.exp(-x ** 2 / self.sigma ** 2)
class OneHiddenLayer(nn.Module):
def __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.... | MichaelArbel/MMD-gradient-flow | OneHiddenLayer | false | 17,705 | [
"BSD-3-Clause"
] | 5 | aa7be78c53c1995ae156fb04b6f1b4fcf02dd039 | https://github.com/MichaelArbel/MMD-gradient-flow/tree/aa7be78c53c1995ae156fb04b6f1b4fcf02dd039 | import torch
import torch as tr
import torch.nn as nn
class quadexp(nn.Module):
def __init__(self, sigma=2.0):
super().__init__()
self.sigma = sigma
def forward(self, x):
return tr.exp(-x ** 2 / self.sigma ** 2)
class Model(nn.Module):
def __init__(self, d_int, H, d_out, non_l... |
ConcatBlock | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional
class ConcatBlock(nn.Module):
def __init__(self, in_channels, out_channels):
super(ConcatBlock, self).__init__()
self.in_chns = in_channels
self.out_chns = out_channels
self.conv1 = nn.Conv2d(self.in_chns, self.in_chns,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
assert_size_stride = torch._C._... | Luoxd1996/awesome-semi-supervised-learning-for-medical-image-segmentation | ConcatBlock | false | 17,706 | [
"MIT"
] | 6 | 34d78f41e4fa5927b03cb9f9b2fd473cd16f5e57 | https://github.com/Luoxd1996/awesome-semi-supervised-learning-for-medical-image-segmentation/tree/34d78f41e4fa5927b03cb9f9b2fd473cd16f5e57 | import torch
import torch.nn as nn
import torch.nn.functional
class Model(nn.Module):
def __init__(self, in_channels, out_channels):
super().__init__()
self.in_chns = in_channels
self.out_chns = out_channels
self.conv1 = nn.Conv2d(self.in_chns, self.in_chns, kernel_size=1,
... |
ActFirstResBlock | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn.functional as F
from torch import nn
class AdaptiveInstanceNorm2d(nn.Module):
def __init__(self, num_features, eps=1e-05, momentum=0.1):
super(AdaptiveInstanceNorm2d, self).__init__()
self.num_features = num_features
self.eps = eps
self.momentum = mome... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | MattAlexMiracle/SmartPatch | ActFirstResBlock | false | 17,707 | [
"MIT"
] | 7 | c485cb433d8e085d6eae10a335ee19f5e6c1a41c | https://github.com/MattAlexMiracle/SmartPatch/tree/c485cb433d8e085d6eae10a335ee19f5e6c1a41c | import torch
import torch.nn.functional as F
from torch import nn
class AdaptiveInstanceNorm2d(nn.Module):
def __init__(self, num_features, eps=1e-05, momentum=0.1):
super().__init__()
self.num_features = num_features
self.eps = eps
self.momentum = momentum
self.weight = N... |
BCELoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.nn.functional as F
class BCELoss(nn.Module):
def forward(self, pos_score, neg_score, average=True):
pos_loss = -F.log_softmax(pos_score, dim=1)[:, 1]
neg_loss = -F.log_softmax(neg_score, dim=1)[:, 0]
loss = pos_loss.sum() + neg_loss.sum()
... | 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
... | MaybeS/mnist | BCELoss | false | 17,708 | [
"MIT"
] | 8 | d0aeafce97d7308dc84adbb6ad8e547776db0cd5 | https://github.com/MaybeS/mnist/tree/d0aeafce97d7308dc84adbb6ad8e547776db0cd5 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def forward(self, pos_score, neg_score, average=True):
pos_loss = -F.log_softmax(pos_score, dim=1)[:, 1]
neg_loss = -F.log_softmax(neg_score, dim=1)[:, 0]
loss = pos_loss.sum() + neg_loss.sum()
... |
OutPutBlock | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional
class OutPutBlock(nn.Module):
def __init__(self, in_channels, out_channels):
super(OutPutBlock, self).__init__()
self.in_chns = in_channels
self.out_chns = out_channels
self.conv1 = nn.Conv2d(self.in_chns, self.in_chns ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
assert_size_stride = torch._C._... | Luoxd1996/awesome-semi-supervised-learning-for-medical-image-segmentation | OutPutBlock | false | 17,709 | [
"MIT"
] | 6 | 34d78f41e4fa5927b03cb9f9b2fd473cd16f5e57 | https://github.com/Luoxd1996/awesome-semi-supervised-learning-for-medical-image-segmentation/tree/34d78f41e4fa5927b03cb9f9b2fd473cd16f5e57 | import torch
import torch.nn as nn
import torch.nn.functional
class Model(nn.Module):
def __init__(self, in_channels, out_channels):
super().__init__()
self.in_chns = in_channels
self.out_chns = out_channels
self.conv1 = nn.Conv2d(self.in_chns, self.in_chns // 2, kernel_size
... |
SeE_Block | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
class SeE_Block(nn.Module):
def __init__(self, channel):
super(SeE_Block, self).__init__()
self.channel = channel
self.relu = nn.ReLU()
self.sigmoid = nn.Sigmoid()
self.fc1 = nn.Conv2d(self.channel, self.ch... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | Mhaiyang/TCSVT2021_DCENet | SeE_Block | false | 17,710 | [
"BSD-3-Clause"
] | 4 | aae8c7643402c15847836c0ce4934b743e11fd8a | https://github.com/Mhaiyang/TCSVT2021_DCENet/tree/aae8c7643402c15847836c0ce4934b743e11fd8a | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, channel):
super().__init__()
self.channel = channel
self.relu = nn.ReLU()
self.sigmoid = nn.Sigmoid()
self.fc1 = nn.Conv2d(self.channel, self.channel, 1, 1, 0)
... |
NoisyOneHiddenLayer | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch as tr
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
class quadexp(nn.Module):
def __init__(self, sigma=2.0):
super(quadexp, self).__init__()
self.sigma = sigma
def forward(self, x):
return tr.exp(-x ** 2 / self.sig... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | MichaelArbel/MMD-gradient-flow | NoisyOneHiddenLayer | false | 17,711 | [
"BSD-3-Clause"
] | 5 | aa7be78c53c1995ae156fb04b6f1b4fcf02dd039 | https://github.com/MichaelArbel/MMD-gradient-flow/tree/aa7be78c53c1995ae156fb04b6f1b4fcf02dd039 | import torch
import torch as tr
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
class quadexp(nn.Module):
def __init__(self, sigma=2.0):
super().__init__()
self.sigma = sigma
def forward(self, x):
return tr.exp(-x ** 2 / self.sigma ** 2)
cl... |
StdConv2d | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn.functional as F
import torch.nn as nn
class StdConv2d(nn.Conv2d):
def forward(self, x):
w = self.weight
v, m = torch.var_mean(w, dim=[1, 2, 3], keepdim=True, unbiased=False)
w = (w - m) / torch.sqrt(v + 1e-05)
return F.conv2d(x, w, self.bias, self.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.triton_helpers import libdevice
import torch.nn as ... | MetaMain/ViTRobust | StdConv2d | false | 17,712 | [
"BSD-3-Clause"
] | 6 | 5bca523f430933469d9f82022e334839388cee7a | https://github.com/MetaMain/ViTRobust/tree/5bca523f430933469d9f82022e334839388cee7a | import torch
import torch.nn.functional as F
import torch.nn as nn
class Model(nn.Conv2d):
def forward(self, x):
w = self.weight
v, m = torch.var_mean(w, dim=[1, 2, 3], keepdim=True, unbiased=False)
w = (w - m) / torch.sqrt(v + 1e-05)
return F.conv2d(x, w, self.bias, self.stride, ... |
TripletLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.nn.functional as F
class TripletLoss(nn.Module):
"""
Triplet loss
Takes embeddings of an anchor sample, a positive sample and a negative sample
"""
def __init__(self, margin=4.0, size_average=True):
super(TripletLoss, self).__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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | MikeLagunes/Supervised-Triplet-Network | TripletLoss | false | 17,713 | [
"MIT"
] | 6 | 575bcaf8f17affb0ff0e93212dde0f3f634c196f | https://github.com/MikeLagunes/Supervised-Triplet-Network/tree/575bcaf8f17affb0ff0e93212dde0f3f634c196f | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
"""
Triplet loss
Takes embeddings of an anchor sample, a positive sample and a negative sample
"""
def __init__(self, margin=4.0, size_average=True):
super().__init__()
self.margin = margin
... |
MultiheadAttention | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | from torch.nn import Module
import torch
from torch.nn import Linear
from torch.nn.init import xavier_uniform_
from torch.nn.init import constant_
from torch.nn.init import xavier_normal_
from torch.nn.parameter import Parameter
from torch.nn import functional as F
class MultiheadAttention(Module):
"""Allows the ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Mehrad0711/HUBERT | MultiheadAttention | false | 17,714 | [
"MIT"
] | 3 | 2f13fd2f7f5a2ec13544f4007158b582ae7408c3 | https://github.com/Mehrad0711/HUBERT/tree/2f13fd2f7f5a2ec13544f4007158b582ae7408c3 | from torch.nn import Module
import torch
from torch.nn import Linear
from torch.nn.init import xavier_uniform_
from torch.nn.init import constant_
from torch.nn.init import xavier_normal_
from torch.nn.parameter import Parameter
from torch.nn import functional as F
class Model(Module):
"""Allows the model to join... |
LossEnergy | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
from torch import nn
class WaveFunctionLoss(nn.Module):
"""Base class for all wave function loss functions.
Any such loss must be derived from the local energy and wave function
values, :math:`L(\\{E_\\text{loc}[\\psi],\\ln|\\psi|,w\\})`, using also
importance-sampling weights *w*.
... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | MikeEntwistle/deepqmc | LossEnergy | false | 17,715 | [
"MIT"
] | 4 | b5c20bf1768f04227becd5079c6b40aefc97d26c | https://github.com/MikeEntwistle/deepqmc/tree/b5c20bf1768f04227becd5079c6b40aefc97d26c | import torch
from torch import nn
class WaveFunctionLoss(nn.Module):
"""Base class for all wave function loss functions.
Any such loss must be derived from the local energy and wave function
values, :math:`L(\\{E_\\text{loc}[\\psi],\\ln|\\psi|,w\\})`, using also
importance-sampling weights *w*.
... |
WrapPad2d | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.nn.init
import torch.optim
class WrapPad2d(nn.Module):
"""Create a padding layer that wraps the data
Arguments:
padding (int): the size of the padding
"""
def __init__(self, padding):
super(WrapPad2d, self).__init__()
self.paddi... | 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
import torch.optim
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_... | NREL/deep-image-prior-cfd | WrapPad2d | false | 17,716 | [
"Apache-2.0"
] | 5 | 85a86ac10bef070b1a973d2a6569849583e08d79 | https://github.com/NREL/deep-image-prior-cfd/tree/85a86ac10bef070b1a973d2a6569849583e08d79 | import torch
import torch.nn as nn
import torch.nn.init
import torch.optim
class Model(nn.Module):
"""Create a padding layer that wraps the data
Arguments:
padding (int): the size of the padding
"""
def __init__(self, padding):
super().__init__()
self.padding = padding
d... |
FiLM | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional
class FiLM(nn.Module):
def __init__(self, output_size, gating_size):
super().__init__()
self.scale = nn.Linear(gating_size, output_size[0])
self.shift = nn.Linear(gating_size, output_size[0])
def forward(self, x, gating):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
assert_size_stride = torch._C._... | MichalOp/StarTrain | FiLM | false | 17,717 | [
"MIT"
] | 7 | e8dddf879f103e18239ad37b373c9b51fbbe093b | https://github.com/MichalOp/StarTrain/tree/e8dddf879f103e18239ad37b373c9b51fbbe093b | import torch
import torch.nn as nn
import torch.nn.functional
class Model(nn.Module):
def __init__(self, output_size, gating_size):
super().__init__()
self.scale = nn.Linear(gating_size, output_size[0])
self.shift = nn.Linear(gating_size, output_size[0])
def forward(self, x, gating):... |
MultiHeadedAttention | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import math
import torch
from torch import Tensor
from torch import nn
class MultiHeadedAttention(nn.Module):
"""
Multi-Head Attention module from "Attention is All You Need"
Implementation modified from OpenNMT-py.
https://github.com/OpenNMT/OpenNMT-py
"""
def __init__(self, num_heads: 'int... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Merterm/-Modeling-Intensification-for-SLG | MultiHeadedAttention | false | 17,718 | [
"MIT"
] | 5 | 800fff3d3c7bacc86c1db8382f7c2e68d2f0c074 | https://github.com/Merterm/-Modeling-Intensification-for-SLG/tree/800fff3d3c7bacc86c1db8382f7c2e68d2f0c074 | import math
import torch
from torch import Tensor
from torch import nn
class Model(nn.Module):
"""
Multi-Head Attention module from "Attention is All You Need"
Implementation modified from OpenNMT-py.
https://github.com/OpenNMT/OpenNMT-py
"""
def __init__(self, num_heads: 'int', size: 'int',... |
DiceLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self):
super(DiceLoss, self).__init__()
def forward(self, input, target):
smooth = 1.0
intersection = (input * target).sum()
return 1 - (2.0 * intersection + smooth) / (input.sum() + target.
... | 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... | MichalBusta/OpenCitiesAIC | DiceLoss | false | 17,719 | [
"MIT"
] | 7 | 2358118a782edde27a588d6adaf79941cbd90de6 | https://github.com/MichalBusta/OpenCitiesAIC/tree/2358118a782edde27a588d6adaf79941cbd90de6 | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self):
super().__init__()
def forward(self, input, target):
smooth = 1.0
intersection = (input * target).sum()
return 1 - (2.0 * intersection + smooth) / (input.sum() + target.
sum() + smooth)... |
GLU | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional
class GLU(nn.Module):
def __init__(self, input_size, gating_size, output_size):
super().__init__()
self.gate = nn.Linear(gating_size, input_size)
self.lin = nn.Linear(input_size, output_size)
def forward(self, x, gating):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
assert_size_stride = torch._C._... | MichalOp/StarTrain | GLU | false | 17,720 | [
"MIT"
] | 7 | e8dddf879f103e18239ad37b373c9b51fbbe093b | https://github.com/MichalOp/StarTrain/tree/e8dddf879f103e18239ad37b373c9b51fbbe093b | import torch
import torch.nn as nn
import torch.nn.functional
class Model(nn.Module):
def __init__(self, input_size, gating_size, output_size):
super().__init__()
self.gate = nn.Linear(gating_size, input_size)
self.lin = nn.Linear(input_size, output_size)
def forward(self, x, gating)... |
TripletSoftmaxLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.nn.functional as F
class TripletSoftmaxLoss(nn.Module):
"""
Triplet loss
Takes embeddings of an anchor sample, a positive sample, a negative sample, logits and class labels
"""
def __init__(self, margin=0.0, size_average=True, lambda_factor=0.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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | MikeLagunes/Supervised-Triplet-Network | TripletSoftmaxLoss | false | 17,721 | [
"MIT"
] | 6 | 575bcaf8f17affb0ff0e93212dde0f3f634c196f | https://github.com/MikeLagunes/Supervised-Triplet-Network/tree/575bcaf8f17affb0ff0e93212dde0f3f634c196f | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
"""
Triplet loss
Takes embeddings of an anchor sample, a positive sample, a negative sample, logits and class labels
"""
def __init__(self, margin=0.0, size_average=True, lambda_factor=0.0):
super()... |
EdgeLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.nn.functional as F
def cross_entropy(logits, labels):
return torch.mean((1 - labels) * logits + torch.log(1 + torch.exp(-logits))
)
class EdgeLoss(nn.Module):
def __init__(self):
super().__init__()
laplace = torch.FloatTensor([[-1, -1,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
im... | Mhaiyang/TCSVT2021_DCENet | EdgeLoss | false | 17,722 | [
"BSD-3-Clause"
] | 4 | aae8c7643402c15847836c0ce4934b743e11fd8a | https://github.com/Mhaiyang/TCSVT2021_DCENet/tree/aae8c7643402c15847836c0ce4934b743e11fd8a | import torch
import torch.nn as nn
import torch.nn.functional as F
def cross_entropy(logits, labels):
return torch.mean((1 - labels) * logits + torch.log(1 + torch.exp(-logits))
)
class Model(nn.Module):
def __init__(self):
super().__init__()
laplace = torch.FloatTensor([[-1, -1, -1... |
Model | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, in_dim, out_dim):
super(Model, self).__init__()
self.out_dim = out_dim
self.fc1 = nn.Linear(in_dim, in_dim // 2)
self.fc2 = nn.Linear(in_dim // 2, in_dim // 4)
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.... | MiscellaneousStuff/tlol-py | Model | false | 17,723 | [
"MIT"
] | 4 | 60477b4f794daa12930d7bbec4cf692bab426a33 | https://github.com/MiscellaneousStuff/tlol-py/tree/60477b4f794daa12930d7bbec4cf692bab426a33 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, in_dim, out_dim):
super(Model, self).__init__()
self.out_dim = out_dim
self.fc1 = nn.Linear(in_dim, in_dim // 2)
self.fc2 = nn.Linear(in_dim // 2, in_dim // 4)
sel... |
ScaleUp | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
from torch.nn import Parameter
class ScaleUp(nn.Module):
"""ScaleUp"""
def __init__(self, scale):
super(ScaleUp, self).__init__()
self.scale = Parameter(torch.tensor(scale))
def forward(self, x):
return x * self.scale
def get_inputs():
ret... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from torch.nn import Parameter
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = to... | NTDXYG/DeepPseudo | ScaleUp | false | 17,724 | [
"Apache-2.0"
] | 7 | 0d89045ea145f23259306eb024e9bbe261f33d9b | https://github.com/NTDXYG/DeepPseudo/tree/0d89045ea145f23259306eb024e9bbe261f33d9b | import torch
import torch.nn as nn
from torch.nn import Parameter
class Model(nn.Module):
"""ScaleUp"""
def __init__(self, scale):
super().__init__()
self.scale = Parameter(torch.tensor(scale))
def forward(self, x):
return x * self.scale
def get_inputs():
return [torch.rand... |
ClampNorm | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
from torch import nn
class ClampNorm(nn.Module):
def __init__(self):
super(ClampNorm, self).__init__()
def forward(self, x):
out = x.clamp(0.0, 1.0)
return out / out.sum(1, keepdim=True)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | NREL/ml-combustion-pdf-models | ClampNorm | false | 17,725 | [
"Apache-2.0"
] | 6 | 0505b9c54ab4c1e2b7ef8ca9f59f76bfb2e3732d | https://github.com/NREL/ml-combustion-pdf-models/tree/0505b9c54ab4c1e2b7ef8ca9f59f76bfb2e3732d | import torch
from torch import nn
class Model(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
out = x.clamp(0.0, 1.0)
return out / out.sum(1, keepdim=True)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return []
|
RelErrorLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
from torch import nn
class RelErrorLoss(nn.Module):
def __init__(self):
super(RelErrorLoss, self).__init__()
self.eps = 1e-06
def forward(self, input, target):
return torch.mean(torch.abs(target - input) / (target + self.eps))
def get_inputs():
return [torch.rand([... | 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 nn
a... | NREL/ml-combustion-pdf-models | RelErrorLoss | false | 17,726 | [
"Apache-2.0"
] | 6 | 0505b9c54ab4c1e2b7ef8ca9f59f76bfb2e3732d | https://github.com/NREL/ml-combustion-pdf-models/tree/0505b9c54ab4c1e2b7ef8ca9f59f76bfb2e3732d | import torch
from torch import nn
class Model(nn.Module):
def __init__(self):
super().__init__()
self.eps = 1e-06
def forward(self, input, target):
return torch.mean(torch.abs(target - input) / (target + self.eps))
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand(... |
SSP | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
def ssp(*args, **kwargs):
return F.softplus(*args, **kwargs) - np.log(2)
class SSP(nn.Softplus):
def forward(self, xs):
return ssp(xs, self.beta, self.threshold)
def get_inputs():
return [torch.rand([4, 4, 4,... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import numpy as np
from torch import nn
import torch.nn.functi... | MikeEntwistle/deepqmc | SSP | false | 17,727 | [
"MIT"
] | 4 | b5c20bf1768f04227becd5079c6b40aefc97d26c | https://github.com/MikeEntwistle/deepqmc/tree/b5c20bf1768f04227becd5079c6b40aefc97d26c | import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
def ssp(*args, **kwargs):
return F.softplus(*args, **kwargs) - np.log(2)
class Model(nn.Softplus):
def forward(self, xs):
return ssp(xs, self.beta, self.threshold)
def get_inputs():
return [torch.rand([4, 4, ... |
SoftTargetCrossEntropy | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.nn.functional as F
class SoftTargetCrossEntropy(nn.Module):
def __init__(self, reduce='mean'):
super(SoftTargetCrossEntropy, self).__init__()
self.criterion = nn.KLDivLoss(reduction=reduce)
self.reduce = reduce
def forward(self, x, targ... | 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... | MichalBusta/OpenCitiesAIC | SoftTargetCrossEntropy | false | 17,728 | [
"MIT"
] | 7 | 2358118a782edde27a588d6adaf79941cbd90de6 | https://github.com/MichalBusta/OpenCitiesAIC/tree/2358118a782edde27a588d6adaf79941cbd90de6 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, reduce='mean'):
super().__init__()
self.criterion = nn.KLDivLoss(reduction=reduce)
self.reduce = reduce
def forward(self, x, target, mask=None):
x = F.log_softmax(x, ... |
SoftmaxImage | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
from torch import nn
class SoftmaxImage(nn.Module):
"""Apply Softmax on an image.
Softmax2d applies on second dimension (i.e. channels), which is
not what I want. This applies along the H and W dimensions, where
(N, C, H, W) is the size of the input.
"""
def __init__(self, chan... | 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 nn
a... | NREL/ml-combustion-pdf-models | SoftmaxImage | false | 17,729 | [
"Apache-2.0"
] | 6 | 0505b9c54ab4c1e2b7ef8ca9f59f76bfb2e3732d | https://github.com/NREL/ml-combustion-pdf-models/tree/0505b9c54ab4c1e2b7ef8ca9f59f76bfb2e3732d | import torch
from torch import nn
class Model(nn.Module):
"""Apply Softmax on an image.
Softmax2d applies on second dimension (i.e. channels), which is
not what I want. This applies along the H and W dimensions, where
(N, C, H, W) is the size of the input.
"""
def __init__(self, channels, h... |
ElectronicAsymptotic | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
from torch import nn
class ElectronicAsymptotic(nn.Module):
"""Jastrow factor with a correct electronic cusp.
The Jastrow factor is calculated from distances between all pairs of
electrons, :math:`d_{ij}`,
.. math::
\\mathrm \\gamma
:=\\sum_{ij}-\\frac{c}{\\alpha(1+\\alp... | 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... | MikeEntwistle/deepqmc | ElectronicAsymptotic | false | 17,730 | [
"MIT"
] | 4 | b5c20bf1768f04227becd5079c6b40aefc97d26c | https://github.com/MikeEntwistle/deepqmc/tree/b5c20bf1768f04227becd5079c6b40aefc97d26c | import torch
from torch import nn
class Model(nn.Module):
"""Jastrow factor with a correct electronic cusp.
The Jastrow factor is calculated from distances between all pairs of
electrons, :math:`d_{ij}`,
.. math::
\\mathrm \\gamma
:=\\sum_{ij}-\\frac{c}{\\alpha(1+\\alpha d_{ij})}
... |
CNNLayer | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
class CNNLayer(nn.Module):
def __init__(self, input_size, in_channels, out_channels, kernel_width,
act_fun=nn.ReLU, drop_prob=0.1):
"""Initilize CNN layer.
Args:
input_size [int]: embedding dim or the last 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.... | NUSTM/PyTorch-DNN | CNNLayer | false | 17,731 | [
"MIT"
] | 5 | 3cea33380df60e5db307cab50f273efe9ac445c1 | https://github.com/NUSTM/PyTorch-DNN/tree/3cea33380df60e5db307cab50f273efe9ac445c1 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, input_size, in_channels, out_channels, kernel_width,
act_fun=nn.ReLU, drop_prob=0.1):
"""Initilize CNN layer.
Args:
input_size [int]: embedding dim or the last dim of... |
SyntacticGCN | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
class SyntacticGCN(nn.Module):
def __init__(self, input_size, hidden_size, num_labels, bias=True):
super(SyntacticGCN, self).__init__()
self.input_size = input_size
self.hidden_size = hidden_size
self.num_labels = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | NLP-Discourse-SoochowU/TDDiscourseParser | SyntacticGCN | false | 17,732 | [
"Apache-2.0"
] | 9 | 2f9c7cef85c564c47b368ee4935caf1fad7c598d | https://github.com/NLP-Discourse-SoochowU/TDDiscourseParser/tree/2f9c7cef85c564c47b368ee4935caf1fad7c598d | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, input_size, hidden_size, num_labels, bias=True):
super().__init__()
self.input_size = input_size
self.hidden_size = hidden_size
self.num_labels = num_labels
self.W... |
ValueNetwork | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
class ValueNetwork(nn.Module):
"""
Value network V(s_t) = E[G_t | s_t] to use as a baseline in the reinforce
update. This a Neural Net with 1 hidden layer
"""
def __init__(self, num_inputs, hidden_dim):
super(ValueNetwork,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | NadeemWard/pytorch_simple_policy_gradients | ValueNetwork | false | 17,733 | [
"MIT"
] | 5 | d0ae66b46860504a077fdffdac45b5077c12c480 | https://github.com/NadeemWard/pytorch_simple_policy_gradients/tree/d0ae66b46860504a077fdffdac45b5077c12c480 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
"""
Value network V(s_t) = E[G_t | s_t] to use as a baseline in the reinforce
update. This a Neural Net with 1 hidden layer
"""
def __init__(self, num_inputs, hidden_dim):
super().__init__()
... |
Softmax_Policy | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
class Softmax_Policy(nn.Module):
"""
Simple neural network with softmax action selection
"""
def __init__(self, num_inputs, hidden_size, action_space):
super(Softmax_Policy, self).__init__()
num_outputs = 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._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | NadeemWard/pytorch_simple_policy_gradients | Softmax_Policy | false | 17,734 | [
"MIT"
] | 5 | d0ae66b46860504a077fdffdac45b5077c12c480 | https://github.com/NadeemWard/pytorch_simple_policy_gradients/tree/d0ae66b46860504a077fdffdac45b5077c12c480 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
"""
Simple neural network with softmax action selection
"""
def __init__(self, num_inputs, hidden_size, action_space):
super().__init__()
num_outputs = action_space
self.linear1 = nn.Lin... |
Decoder | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
from torch import nn
class Decoder(nn.Module):
def __init__(self, layer_sizes, latent_size, nlabels):
super(Decoder, self).__init__()
self.MLP = nn.Sequential()
input_size = latent_size + nlabels
for i, (in_size, out_size) in enumerate(zip([input_size] +
l... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | NREL/ml-combustion-pdf-models | Decoder | false | 17,735 | [
"Apache-2.0"
] | 6 | 0505b9c54ab4c1e2b7ef8ca9f59f76bfb2e3732d | https://github.com/NREL/ml-combustion-pdf-models/tree/0505b9c54ab4c1e2b7ef8ca9f59f76bfb2e3732d | import torch
from torch import nn
class Model(nn.Module):
def __init__(self, layer_sizes, latent_size, nlabels):
super().__init__()
self.MLP = nn.Sequential()
input_size = latent_size + nlabels
for i, (in_size, out_size) in enumerate(zip([input_size] +
layer_sizes[:-1]... |
LossW2V | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
class LossW2V(nn.Module):
"""Triplet loss with hard positive/negative mining.
Reference:
Hermans et al. In Defense of the Triplet Loss for Person Re-Identification. arXiv:1703.07737.
Code imported from https://github.com/Cysu/open-reid/blob/master/reid/loss/triplet.... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | Nabeel-Malkani/Digital-Image-Processing | LossW2V | false | 17,736 | [
"MIT"
] | 4 | dee03cb61c54db55c5a2bfa9ca0f9dea7dba66a6 | https://github.com/Nabeel-Malkani/Digital-Image-Processing/tree/dee03cb61c54db55c5a2bfa9ca0f9dea7dba66a6 | import torch
import torch.nn as nn
class Model(nn.Module):
"""Triplet loss with hard positive/negative mining.
Reference:
Hermans et al. In Defense of the Triplet Loss for Person Re-Identification. arXiv:1703.07737.
Code imported from https://github.com/Cysu/open-reid/blob/master/reid/loss/triplet.py... |
EntropyLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.nn.functional as F
class EntropyLoss(nn.Module):
def __init__(self):
super(EntropyLoss, self).__init__()
def forward(self, x):
out = F.softmax(x, dim=1) * F.log_softmax(x, dim=1)
out = -1.0 * out.sum(dim=1)
return out.mean()
d... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | NYCU-MLLab/Strategic-Optimization-for-Worst-case-Augmentation | EntropyLoss | false | 17,737 | [
"MIT"
] | 3 | fd0feab42151c0bae60712480301ea26f627a81d | https://github.com/NYCU-MLLab/Strategic-Optimization-for-Worst-case-Augmentation/tree/fd0feab42151c0bae60712480301ea26f627a81d | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
out = F.softmax(x, dim=1) * F.log_softmax(x, dim=1)
out = -1.0 * out.sum(dim=1)
return out.mean()
def get_inputs():
re... |
CNN | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
class CNN(nn.Module):
def __init__(self, input_size=50, hidden_size=256, dropout=0,
kernel_size=3, padding=1, activation_function=F.relu):
"""
Args:
input_size: dimention of input embedding
kernel_s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | NanoGDA/gda-extraction | CNN | false | 17,738 | [
"MIT"
] | 4 | 9dfedc54dab10ee4e90d8af622bcaf97e6dc2422 | https://github.com/NanoGDA/gda-extraction/tree/9dfedc54dab10ee4e90d8af622bcaf97e6dc2422 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, input_size=50, hidden_size=256, dropout=0,
kernel_size=3, padding=1, activation_function=F.relu):
"""
Args:
input_size: dimention of input embedding
kernel... |
SimSiamLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
class SimSiamLoss(nn.Module):
"""
Loss function defined in https://arxiv.org/abs/2011.10566
"""
def __init__(self):
super(SimSiamLoss, self).__init__()
def forward(self, zx, zy, px, py):
loss = -(zx.detach() * py).sum(dim=1).mean()
loss ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | NeurAI-Lab/DoGo | SimSiamLoss | false | 17,739 | [
"MIT"
] | 3 | e3038204f15a40a2d5caca20bb171c87a40d95ba | https://github.com/NeurAI-Lab/DoGo/tree/e3038204f15a40a2d5caca20bb171c87a40d95ba | import torch
import torch.nn as nn
class Model(nn.Module):
"""
Loss function defined in https://arxiv.org/abs/2011.10566
"""
def __init__(self):
super().__init__()
def forward(self, zx, zy, px, py):
loss = -(zx.detach() * py).sum(dim=1).mean()
loss += -(zy.detach() * px).... |
Smooth_Loss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
class Smooth_Loss(nn.Module):
def __init__(self):
super(Smooth_Loss, self).__init__()
def forward(self, x):
loss_smooth = torch.mean(torch.abs(x[:, :, :, :-1] - x[:, :, :, 1:])
) + torch.mean(torch.abs(x[:, :, :-1, :] - x[:, :, 1:, :]))
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | NeilDG/SGID-PFF | Smooth_Loss | false | 17,740 | [
"MIT"
] | 8 | e027ac65e63f3c052665290cd0438bb7bdeabf9f | https://github.com/NeilDG/SGID-PFF/tree/e027ac65e63f3c052665290cd0438bb7bdeabf9f | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
loss_smooth = torch.mean(torch.abs(x[:, :, :, :-1] - x[:, :, :, 1:])
) + torch.mean(torch.abs(x[:, :, :-1, :] - x[:, :, 1:, :]))
return loss_smooth
de... |
TFConvNet | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn.functional as F
import torch.nn as nn
class TFConvNet(nn.Module):
"""
Network architecture in the Tensorflow image classification tutorial
"""
def __init__(self):
super(TFConvNet, self).__init__()
self.conv1 = nn.Conv2d(3, 32, 3)
self.pool = nn.Max... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn.functional as... | NVlabs/FedFomo | TFConvNet | false | 17,741 | [
"BSD-3-Clause-Attribution"
] | 7 | fe04f6641407bce4fc58ea3fbf8cb314f9af8629 | https://github.com/NVlabs/FedFomo/tree/fe04f6641407bce4fc58ea3fbf8cb314f9af8629 | import torch
import torch.nn.functional as F
import torch.nn as nn
class Model(nn.Module):
"""
Network architecture in the Tensorflow image classification tutorial
"""
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(3, 32, 3)
self.pool = nn.MaxPool2d(2, 2)
... |
JsdCrossEntropy | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.nn.functional as F
class JsdCrossEntropy(nn.Module):
def __init__(self):
super(JsdCrossEntropy, self).__init__()
def forward(self, net_1_logits, net_2_logits):
net_1_probs = F.softmax(net_1_logits, dim=1)
net_2_probs = F.softmax(net_2_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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | NYCU-MLLab/Strategic-Optimization-for-Worst-case-Augmentation | JsdCrossEntropy | false | 17,742 | [
"MIT"
] | 3 | fd0feab42151c0bae60712480301ea26f627a81d | https://github.com/NYCU-MLLab/Strategic-Optimization-for-Worst-case-Augmentation/tree/fd0feab42151c0bae60712480301ea26f627a81d | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self):
super().__init__()
def forward(self, net_1_logits, net_2_logits):
net_1_probs = F.softmax(net_1_logits, dim=1)
net_2_probs = F.softmax(net_2_logits, dim=1)
total_m =... |
IBLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.nn.functional as F
class EntropyLoss(nn.Module):
def __init__(self):
super(EntropyLoss, self).__init__()
def forward(self, x):
out = F.softmax(x, dim=1) * F.log_softmax(x, dim=1)
out = -1.0 * out.sum(dim=1)
return out.mean()
c... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | NYCU-MLLab/Strategic-Optimization-for-Worst-case-Augmentation | IBLoss | false | 17,743 | [
"MIT"
] | 3 | fd0feab42151c0bae60712480301ea26f627a81d | https://github.com/NYCU-MLLab/Strategic-Optimization-for-Worst-case-Augmentation/tree/fd0feab42151c0bae60712480301ea26f627a81d | import torch
import torch.nn as nn
import torch.nn.functional as F
class EntropyLoss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
out = F.softmax(x, dim=1) * F.log_softmax(x, dim=1)
out = -1.0 * out.sum(dim=1)
return out.mean()
class Model(nn.Mod... |
Critic | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
def weight_init(m):
"""Custom weight init for Conv2D and Linear layers."""
if isinstance(m, nn.Linear):
nn.init.orthogonal_(m.weight.data)
m.bias.data.fill_(0.0)
elif isinstance(m, nn.Conv2d) or isinstance(m, nn.ConvTranspo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | LQNew/AUMC | Critic | false | 17,744 | [
"MIT"
] | 5 | c3ce9c289bc8c0912431d68ec4fe260f640df3bc | https://github.com/LQNew/AUMC/tree/c3ce9c289bc8c0912431d68ec4fe260f640df3bc | import torch
import torch.nn as nn
import torch.nn.functional as F
def weight_init(m):
"""Custom weight init for Conv2D and Linear layers."""
if isinstance(m, nn.Linear):
nn.init.orthogonal_(m.weight.data)
m.bias.data.fill_(0.0)
elif isinstance(m, nn.Conv2d) or isinstance(m, nn.ConvTranspo... |
CosineSimilarityLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | from torch.nn import Module
import torch
import torch.nn.functional as F
class BaseLoss(Module):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
class CosineSimilarityLoss(BaseLoss):
def __init__(self, dim=1, eps=1e-08, reduction='mean', *args, **kwargs):
super().__i... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch.nn import Module
... | NullConvergence/torch_temp | CosineSimilarityLoss | false | 17,745 | [
"MIT"
] | 3 | 29a0d7190f0be6124f51bd85b8320cd8b3cef29a | https://github.com/NullConvergence/torch_temp/tree/29a0d7190f0be6124f51bd85b8320cd8b3cef29a | from torch.nn import Module
import torch
import torch.nn.functional as F
class BaseLoss(Module):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
class Model(BaseLoss):
def __init__(self, dim=1, eps=1e-08, reduction='mean', *args, **kwargs):
super().__init__(*args, **... |
ResBlock | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
def get_same_padding(kernel_size, dilation):
kernel_size = kernel_size + (kernel_size - 1) * (dilation - 1)
padding = (kernel_size - 1) // 2
return padding
class ResBlock(nn.Module):
def __init__(self, inplanes, planes, kernel_size=3, stride=1, dilation=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_... | NeilDG/SGID-PFF | ResBlock | false | 17,746 | [
"MIT"
] | 8 | e027ac65e63f3c052665290cd0438bb7bdeabf9f | https://github.com/NeilDG/SGID-PFF/tree/e027ac65e63f3c052665290cd0438bb7bdeabf9f | import torch
import torch.nn as nn
def get_same_padding(kernel_size, dilation):
kernel_size = kernel_size + (kernel_size - 1) * (dilation - 1)
padding = (kernel_size - 1) // 2
return padding
class Model(nn.Module):
def __init__(self, inplanes, planes, kernel_size=3, stride=1, dilation=1):
s... |
BinaryTreeGRULayer | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
class BinaryTreeGRULayer(nn.Module):
def __init__(self, hidden_dim):
super(BinaryTreeGRULayer, self).__init__()
self.fc1 = nn.Linear(in_features=2 * hidden_dim, out_features=3 *
hidden_dim)
self.fc2 = nn.Linear(in_features=2 * hidden_dim, 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
import torch.nn as ... | NanoGDA/gda-extraction | BinaryTreeGRULayer | false | 17,747 | [
"MIT"
] | 4 | 9dfedc54dab10ee4e90d8af622bcaf97e6dc2422 | https://github.com/NanoGDA/gda-extraction/tree/9dfedc54dab10ee4e90d8af622bcaf97e6dc2422 | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self, hidden_dim):
super().__init__()
self.fc1 = nn.Linear(in_features=2 * hidden_dim, out_features=3 *
hidden_dim)
self.fc2 = nn.Linear(in_features=2 * hidden_dim, out_features=
hidden_dim)
... |
Select | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
from torch.nn import Parameter
from torch.nn.parameter import Parameter
class Select(nn.Module):
def __init__(self, c):
super(Select, self).__init__()
self.weight = Parameter(torch.ones(c, requires_grad=False))
def forward(self, 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
from torch.nn import Parameter
from torch.nn.parameter import Parameter
assert_size_stride = torch._C._dynamo.guards.a... | Nuctech-AI/LBS_pruning | Select | false | 17,748 | [
"MIT"
] | 6 | d2f67b287b69968b54a55fc3d25e26eef64d29a7 | https://github.com/Nuctech-AI/LBS_pruning/tree/d2f67b287b69968b54a55fc3d25e26eef64d29a7 | import torch
import torch.nn as nn
from torch.nn import Parameter
from torch.nn.parameter import Parameter
class Model(nn.Module):
def __init__(self, c):
super().__init__()
self.weight = Parameter(torch.ones(c, requires_grad=False))
def forward(self, input):
"""
input_tensor:... |
PositionalEncoding | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import math
import torch
class PositionalEncoding(torch.nn.Module):
"""
Positional encoding for Transformer
Parameters
----------
hidden_size : `int`, required
Hidden size of positional encoding.
Must match hidden size of input tokens.
dropout : `float`, required
Dropo... | 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 math
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda... | Nemexur/nonauto-lm | PositionalEncoding | false | 17,750 | [
"Apache-2.0"
] | 3 | 6f237e4fc2b3b679cd92126ea5facd58d3cf6e75 | https://github.com/Nemexur/nonauto-lm/tree/6f237e4fc2b3b679cd92126ea5facd58d3cf6e75 | import math
import torch
class Model(torch.nn.Module):
"""
Positional encoding for Transformer
Parameters
----------
hidden_size : `int`, required
Hidden size of positional encoding.
Must match hidden size of input tokens.
dropout : `float`, required
Dropout probabilit... |
BinResBlock | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
def get_same_padding(kernel_size, dilation):
kernel_size = kernel_size + (kernel_size - 1) * (dilation - 1)
padding = (kernel_size - 1) // 2
return padding
class BinResBlock(nn.Module):
def __init__(self, inplanes, kernel_size=3, dilation=1):
super(BinResB... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | NeilDG/SGID-PFF | BinResBlock | false | 17,751 | [
"MIT"
] | 8 | e027ac65e63f3c052665290cd0438bb7bdeabf9f | https://github.com/NeilDG/SGID-PFF/tree/e027ac65e63f3c052665290cd0438bb7bdeabf9f | import torch
import torch.nn as nn
def get_same_padding(kernel_size, dilation):
kernel_size = kernel_size + (kernel_size - 1) * (dilation - 1)
padding = (kernel_size - 1) // 2
return padding
class Model(nn.Module):
def __init__(self, inplanes, kernel_size=3, dilation=1):
super().__init__()
... |
ConvReluPool | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
from torch.nn import functional as F
def Conv2d(fIn, fOut, k, stride=1):
"""torch Conv2d with same padding"""
assert k % 2 == 0
pad = int((k - 1) / 2)
return torch.nn.Conv2d(fIn, fOut, k, stride=stride, padding=pad)
def Pool(k, stride=1, pad=0):
return torch.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_... | NeuralMMO/baselines | ConvReluPool | false | 17,752 | [
"MIT"
] | 7 | 407004cfd0c0959b871a982adf49e4fe667df8de | https://github.com/NeuralMMO/baselines/tree/407004cfd0c0959b871a982adf49e4fe667df8de | import torch
import torch.nn as nn
from torch.nn import functional as F
def Conv2d(fIn, fOut, k, stride=1):
"""torch Conv2d with same padding"""
assert k % 2 == 0
pad = int((k - 1) / 2)
return torch.nn.Conv2d(fIn, fOut, k, stride=stride, padding=pad)
def Pool(k, stride=1, pad=0):
return torch.nn... |
RNN | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.init
class RNN(nn.Module):
def __init__(self, data_size, hidden_size, output_size):
super(RNN, self).__init__()
self.hidden_size = hidden_size
input_size = data_size + hidden_size
self.i2h = nn.Linear(input_size, 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
import torch.nn as nn
import torch.nn.init
assert_size_stride = torch._C._dynamo... | OBA9k/Test_dev | RNN | false | 17,753 | [
"Apache-2.0"
] | 4 | bfdd337fb56ca160e1d09b6c310d1e6037d55fcd | https://github.com/OBA9k/Test_dev/tree/bfdd337fb56ca160e1d09b6c310d1e6037d55fcd | import torch
import torch.nn as nn
import torch.nn.init
class Model(nn.Module):
def __init__(self, data_size, hidden_size, output_size):
super().__init__()
self.hidden_size = hidden_size
input_size = data_size + hidden_size
self.i2h = nn.Linear(input_size, hidden_size)
sel... |
DownsampleA | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.nn.init
class DownsampleA(nn.Module):
def __init__(self, nIn, nOut, stride):
super(DownsampleA, self).__init__()
self.avg = nn.AvgPool2d(kernel_size=1, stride=stride)
def forward(self, x):
return torch.cat((self.avg(x), x.mul(0)), 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
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... | OBA9k/Test_dev | DownsampleA | false | 17,754 | [
"Apache-2.0"
] | 4 | bfdd337fb56ca160e1d09b6c310d1e6037d55fcd | https://github.com/OBA9k/Test_dev/tree/bfdd337fb56ca160e1d09b6c310d1e6037d55fcd | import torch
import torch.nn as nn
import torch.nn.init
class Model(nn.Module):
def __init__(self, nIn, nOut, stride):
super().__init__()
self.avg = nn.AvgPool2d(kernel_size=1, stride=stride)
def forward(self, x):
return torch.cat((self.avg(x), x.mul(0)), 1)
def get_inputs():
r... |
AdaIN | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
class AdaIN(nn.Module):
def __init__(self, style_dim, num_features):
super().__init__()
self.norm = nn.InstanceNorm2d(num_features, affine=False)
self.fc = nn.Linear(style_dim, num_features * 2)
def forward(self, x, s):
h = self.fc(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
import torch.nn as ... | ORANZINO/bouquet_server | AdaIN | false | 17,755 | [
"MIT"
] | 7 | 2ce1bb59df15297878c555dd97e0f27b5202ed02 | https://github.com/ORANZINO/bouquet_server/tree/2ce1bb59df15297878c555dd97e0f27b5202ed02 | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self, style_dim, num_features):
super().__init__()
self.norm = nn.InstanceNorm2d(num_features, affine=False)
self.fc = nn.Linear(style_dim, num_features * 2)
def forward(self, x, s):
h = self.fc(s)
... |
Linear_2L | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.utils.data
class Linear_2L(nn.Module):
def __init__(self, input_dim, output_dim, n_hid):
super(Linear_2L, self).__init__()
self.n_hid = n_hid
self.input_dim = input_dim
self.output_dim = output_dim
self.fc1 = nn.Linear(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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | Neronjust2017/Bayesian-neural-networks | Linear_2L | false | 17,756 | [
"MIT"
] | 4 | 9d7f781f5c2dfa8fadf26300b4b5b64366c939cd | https://github.com/Neronjust2017/Bayesian-neural-networks/tree/9d7f781f5c2dfa8fadf26300b4b5b64366c939cd | import torch
import torch.nn as nn
import torch.utils.data
class Model(nn.Module):
def __init__(self, input_dim, output_dim, n_hid):
super().__init__()
self.n_hid = n_hid
self.input_dim = input_dim
self.output_dim = output_dim
self.fc1 = nn.Linear(input_dim, self.n_hid)
... |
ShuffleBlock | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
class ShuffleBlock(nn.Module):
def __init__(self, groups=2):
super(ShuffleBlock, self).__init__()
self.groups = groups
def forward(self, x):
"""Channel shuffle: [N,C,H,W] -> [N,g,C/g,H,W] -> [N,C/g,g,H,w] -> [N,C,H,W]"""
N, C, H, W = x.size(... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | ORNL/AADL | ShuffleBlock | false | 17,757 | [
"BSD-3-Clause"
] | 6 | 8a509676d0a0a78f1f334a3dc93e92721cfcfe90 | https://github.com/ORNL/AADL/tree/8a509676d0a0a78f1f334a3dc93e92721cfcfe90 | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self, groups=2):
super().__init__()
self.groups = groups
def forward(self, x):
"""Channel shuffle: [N,C,H,W] -> [N,g,C/g,H,W] -> [N,C/g,g,H,w] -> [N,C,H,W]"""
N, C, H, W = x.size()
g = self.groups... |
RotaryEmbedding | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
from typing import *
class RotaryEmbedding(torch.nn.Module):
"""`Rotary Position Embedding <https://arxiv.org/abs/2104.09864v2>
Args:
rotary_dim (int): rotary dimension
"""
def __init__(self, rotary_dim: 'int'):
super().__init__()
self.rotary_dim = rotary_dim
... | 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
from typing import *
assert_size_stride = torch._C._dynamo.gua... | OpenBMB/ModelCenter | RotaryEmbedding | false | 17,758 | [
"Apache-2.0"
] | 4 | 28073f24a67f6c0beb4fd5e2cd13284f9de2284a | https://github.com/OpenBMB/ModelCenter/tree/28073f24a67f6c0beb4fd5e2cd13284f9de2284a | import torch
from typing import *
class Model(torch.nn.Module):
"""`Rotary Position Embedding <https://arxiv.org/abs/2104.09864v2>
Args:
rotary_dim (int): rotary dimension
"""
def __init__(self, rotary_dim: 'int'):
super().__init__()
self.rotary_dim = rotary_dim
def fixe... |
ResBlk | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
def normalize(x, eps=1e-06):
"""Apply min-max normalization."""
x = x.contiguous()
N, C, H, W = x.size()
x_ = x.view(N * C, -1)
max_val = torch.max(x_, dim=1, keepdim=True)[0]
min_val = torch.min(x_, dim=1, keepdim=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | ORANZINO/bouquet_server | ResBlk | false | 17,759 | [
"MIT"
] | 7 | 2ce1bb59df15297878c555dd97e0f27b5202ed02 | https://github.com/ORANZINO/bouquet_server/tree/2ce1bb59df15297878c555dd97e0f27b5202ed02 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
def normalize(x, eps=1e-06):
"""Apply min-max normalization."""
x = x.contiguous()
N, C, H, W = x.size()
x_ = x.view(N * C, -1)
max_val = torch.max(x_, dim=1, keepdim=True)[0]
min_val = torch.min(x_, dim=1, keepdim=... |
sum_squared_error | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
from torch.nn.modules.loss import _Loss
class sum_squared_error(_Loss):
"""
Definition: sum_squared_error = 1/2 * nn.MSELoss(reduction = 'sum')
The backward is defined as: input-target
"""
def __init__(self, size_average=None, reduce=None, reduction='sum'):
super(sum_squared_... | 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.nn.modules.loss import _Loss
assert_size_stride = torch._C._dynamo.guards.asse... | ORNL/AADL | sum_squared_error | false | 17,760 | [
"BSD-3-Clause"
] | 6 | 8a509676d0a0a78f1f334a3dc93e92721cfcfe90 | https://github.com/ORNL/AADL/tree/8a509676d0a0a78f1f334a3dc93e92721cfcfe90 | import torch
from torch.nn.modules.loss import _Loss
class Model(_Loss):
"""
Definition: sum_squared_error = 1/2 * nn.MSELoss(reduction = 'sum')
The backward is defined as: input-target
"""
def __init__(self, size_average=None, reduce=None, reduction='sum'):
super().__init__(size_average,... |
HardAttn | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
from torch.nn import functional as F
from torchvision.transforms import *
class HardAttn(nn.Module):
"""Hard Attention (Sec. 3.1.II)"""
def __init__(self, in_channels):
super(HardAttn, self).__init__()
self.fc = nn.Linear(in_channels, 4 * 2)
self.ini... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | KevinDocel/deep-person-reid | HardAttn | false | 17,761 | [
"MIT"
] | 8 | fafcb5e39837b8e441e7b6f57d5355f50d28c81d | https://github.com/KevinDocel/deep-person-reid/tree/fafcb5e39837b8e441e7b6f57d5355f50d28c81d | import torch
import torch.nn as nn
from torch.nn import functional as F
from torchvision.transforms import *
class Model(nn.Module):
"""Hard Attention (Sec. 3.1.II)"""
def __init__(self, in_channels):
super().__init__()
self.fc = nn.Linear(in_channels, 4 * 2)
self.init_params()
d... |
Linear_2L_KFRA | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.utils.data
def sample_K_laplace_MN(MAP, upper_Qinv, lower_HHinv):
Z = MAP.data.new(MAP.size()).normal_(mean=0, std=1)
all_mtx_sample = MAP + torch.matmul(torch.matmul(lower_HHinv, Z),
upper_Qinv)
weight_mtx_sample = all_mtx_sample[:, :-1]
bias_mt... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | Neronjust2017/Bayesian-neural-networks | Linear_2L_KFRA | false | 17,762 | [
"MIT"
] | 4 | 9d7f781f5c2dfa8fadf26300b4b5b64366c939cd | https://github.com/Neronjust2017/Bayesian-neural-networks/tree/9d7f781f5c2dfa8fadf26300b4b5b64366c939cd | import torch
import torch.nn as nn
import torch.utils.data
def sample_K_laplace_MN(MAP, upper_Qinv, lower_HHinv):
Z = MAP.data.new(MAP.size()).normal_(mean=0, std=1)
all_mtx_sample = MAP + torch.matmul(torch.matmul(lower_HHinv, Z),
upper_Qinv)
weight_mtx_sample = all_mtx_sample[:, :-1]
bias_mt... |
VdLinear | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
def calculate_kl(log_alpha):
return 0.5 * torch.sum(torch.log1p(torch.exp(-log_alpha)))
class VdLinear(nn.Module):
"""
variational dropout
"""
def __init__(self, n_in, n_out, alpha_shape=(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, math as tl_math
im... | Neronjust2017/Bayesian-neural-networks | VdLinear | false | 17,763 | [
"MIT"
] | 4 | 9d7f781f5c2dfa8fadf26300b4b5b64366c939cd | https://github.com/Neronjust2017/Bayesian-neural-networks/tree/9d7f781f5c2dfa8fadf26300b4b5b64366c939cd | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
def calculate_kl(log_alpha):
return 0.5 * torch.sum(torch.log1p(torch.exp(-log_alpha)))
class Model(nn.Module):
"""
variational dropout
"""
def __init__(self, n_in, n_out, alpha_shape=(1, 1),... |
KLLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.nn.functional as F
class KLLoss(nn.Module):
"""
KL-Divergence symmetric loss between two distributions
Used in here for knowledge distillation
"""
def __init__(self):
super(KLLoss, self).__init__()
self.similarity_f = nn.CosineSimila... | 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... | NeurAI-Lab/DoGo | KLLoss | false | 17,764 | [
"MIT"
] | 3 | e3038204f15a40a2d5caca20bb171c87a40d95ba | https://github.com/NeurAI-Lab/DoGo/tree/e3038204f15a40a2d5caca20bb171c87a40d95ba | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
"""
KL-Divergence symmetric loss between two distributions
Used in here for knowledge distillation
"""
def __init__(self):
super().__init__()
self.similarity_f = nn.CosineSimilarity(dim=2)
... |
Linear_1L | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.utils.data
class Linear_1L(nn.Module):
def __init__(self, input_dim, output_dim, n_hid):
super(Linear_1L, self).__init__()
self.input_dim = input_dim
self.output_dim = output_dim
self.fc1 = nn.Linear(input_dim, n_hid)
self.fc... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | Neronjust2017/Bayesian-neural-networks | Linear_1L | false | 17,765 | [
"MIT"
] | 4 | 9d7f781f5c2dfa8fadf26300b4b5b64366c939cd | https://github.com/Neronjust2017/Bayesian-neural-networks/tree/9d7f781f5c2dfa8fadf26300b4b5b64366c939cd | import torch
import torch.nn as nn
import torch.utils.data
class Model(nn.Module):
def __init__(self, input_dim, output_dim, n_hid):
super().__init__()
self.input_dim = input_dim
self.output_dim = output_dim
self.fc1 = nn.Linear(input_dim, n_hid)
self.fc2 = nn.Linear(n_hid... |
Loss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import math
import torch
import torch.nn as nn
import torch.utils.data
class Loss(nn.Module):
def __init__(self, type_in='pred_intervals', alpha=0.1, loss_type=
'qd_soft', censor_R=False, soften=100.0, lambda_in=10.0, sigma_in=
0.5, use_cuda=True):
super().__init__()
self.alpha = ... | 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
... | Neronjust2017/Bayesian-neural-networks | Loss | false | 17,766 | [
"MIT"
] | 4 | 9d7f781f5c2dfa8fadf26300b4b5b64366c939cd | https://github.com/Neronjust2017/Bayesian-neural-networks/tree/9d7f781f5c2dfa8fadf26300b4b5b64366c939cd | import math
import torch
import torch.nn as nn
import torch.utils.data
class Model(nn.Module):
def __init__(self, type_in='pred_intervals', alpha=0.1, loss_type=
'qd_soft', censor_R=False, soften=100.0, lambda_in=10.0, sigma_in=
0.5, use_cuda=True):
super().__init__()
self.alpha =... |
PSLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.fft
class PSLoss(nn.Module):
def __init__(self):
super().__init__()
self.l1_loss = torch.nn.L1Loss()
def forward(self, x, y):
x_power = torch.abs(torch.fft.fftn(x, dim=[2, 3]))
y_power = torch.abs(torch.fft.fftn(y, dim=[2, 3]))
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | NejcHirci/material-addon | PSLoss | false | 17,767 | [
"MIT"
] | 4 | c08e2081413c3319b712c2f7193ac8013f601382 | https://github.com/NejcHirci/material-addon/tree/c08e2081413c3319b712c2f7193ac8013f601382 | import torch
import torch.nn as nn
import torch.fft
class Model(nn.Module):
def __init__(self):
super().__init__()
self.l1_loss = torch.nn.L1Loss()
def forward(self, x, y):
x_power = torch.abs(torch.fft.fftn(x, dim=[2, 3]))
y_power = torch.abs(torch.fft.fftn(y, dim=[2, 3]))
... |
ResolutionScalingLayer | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.fft
class ResolutionScalingLayer(nn.Module):
"""Implements the resolution scaling layer.
Basically, this layer can be used to upsample feature maps from spatial domain
with nearest neighbor interpolation.
"""
def __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
import torch.nn as nn
import torch.fft
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo... | NejcHirci/material-addon | ResolutionScalingLayer | false | 17,768 | [
"MIT"
] | 4 | c08e2081413c3319b712c2f7193ac8013f601382 | https://github.com/NejcHirci/material-addon/tree/c08e2081413c3319b712c2f7193ac8013f601382 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.fft
class Model(nn.Module):
"""Implements the resolution scaling layer.
Basically, this layer can be used to upsample feature maps from spatial domain
with nearest neighbor interpolation.
"""
def __init__(self, scale_facto... |
PositionalEncoding | # AOT ID: ['1_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import math
import torch
from torch import nn
class PositionalEncoding(nn.Module):
"""Implement the PE function."""
def __init__(self, d_model, dropout, max_len=5000):
super(PositionalEncoding, self).__init__()
self.dropout = nn.Dropout(p=dropout)
pe = torch.zeros(max_len, d_model)
... | 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 math
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guard... | OpenNLPhub/MRC_NER | PositionalEncoding | false | 17,769 | [
"MIT"
] | 4 | 27ca063764aed9eb5f2ac672bb10052acbf374a5 | https://github.com/OpenNLPhub/MRC_NER/tree/27ca063764aed9eb5f2ac672bb10052acbf374a5 | import math
import torch
from torch import nn
class Model(nn.Module):
"""Implement the PE function."""
def __init__(self, d_model, dropout, max_len=5000):
super().__init__()
self.dropout = nn.Dropout(p=dropout)
pe = torch.zeros(max_len, d_model)
position = torch.arange(0, max_... |
InstanceNormLayer | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.fft
class InstanceNormLayer(nn.Module):
"""Implements instance normalization layer."""
def __init__(self, epsilon=1e-08):
super().__init__()
self.eps = epsilon
def forward(self, x):
if len(x.shape) != 4:
raise ValueError... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.fft
assert_size_stride = torch._C._dynamo.gu... | NejcHirci/material-addon | InstanceNormLayer | false | 17,770 | [
"MIT"
] | 4 | c08e2081413c3319b712c2f7193ac8013f601382 | https://github.com/NejcHirci/material-addon/tree/c08e2081413c3319b712c2f7193ac8013f601382 | import torch
import torch.nn as nn
import torch.fft
class Model(nn.Module):
"""Implements instance normalization layer."""
def __init__(self, epsilon=1e-08):
super().__init__()
self.eps = epsilon
def forward(self, x):
if len(x.shape) != 4:
raise ValueError(
... |
AdaptiveInstanceNormalization | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.fft
class AdaptiveInstanceNormalization(nn.Module):
def and__init__(self):
super(AdaptiveInstanceNormalization, self).__init__()
def forward(self, x, mean, std):
whitened_x = torch.nn.functional.instance_norm(x)
return whitened_x * std ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.fft
assert_size_stride = torch._C._dynamo.gu... | NejcHirci/material-addon | AdaptiveInstanceNormalization | false | 17,771 | [
"MIT"
] | 4 | c08e2081413c3319b712c2f7193ac8013f601382 | https://github.com/NejcHirci/material-addon/tree/c08e2081413c3319b712c2f7193ac8013f601382 | import torch
import torch.nn as nn
import torch.fft
class Model(nn.Module):
def and__init__(self):
super().__init__()
def forward(self, x, mean, std):
whitened_x = torch.nn.functional.instance_norm(x)
return whitened_x * std + mean
def get_inputs():
return [torch.rand([4, 4, 4,... |
VGGLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.fft
class VGGLoss(nn.Module):
def __init__(self):
super().__init__()
self.mse_loss = torch.nn.MSELoss()
def forward(self, x, y):
loss = torch.tensor(0.0, device=x[0].device)
input_features = x
output_features = y
... | 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.fft
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo... | NejcHirci/material-addon | VGGLoss | false | 17,772 | [
"MIT"
] | 4 | c08e2081413c3319b712c2f7193ac8013f601382 | https://github.com/NejcHirci/material-addon/tree/c08e2081413c3319b712c2f7193ac8013f601382 | import torch
import torch.nn as nn
import torch.fft
class Model(nn.Module):
def __init__(self):
super().__init__()
self.mse_loss = torch.nn.MSELoss()
def forward(self, x, y):
loss = torch.tensor(0.0, device=x[0].device)
input_features = x
output_features = y
f... |
NegPearson | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class NegPearson(nn.Module):
def __init__(self):
super(NegPearson, self).__init__()
return
def forward(self, preds, labels):
loss = 0
for i in range(preds.shape[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
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.... | Oichii/resnet3D_pulse | NegPearson | false | 17,773 | [
"MIT"
] | 4 | d123abfdb14eedc972ab1e0c4c3026fe8c4074af | https://github.com/Oichii/resnet3D_pulse/tree/d123abfdb14eedc972ab1e0c4c3026fe8c4074af | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class Model(nn.Module):
def __init__(self):
super().__init__()
return
def forward(self, preds, labels):
loss = 0
for i in range(preds.shape[0]):
sum_x = torch.su... |
FocalLoss1 | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.onnx
class FocalLoss1(nn.Module):
def __init__(self, gamma):
super(FocalLoss1, self).__init__()
self.gamma = gamma
def forward(self, input, target):
if not target.size() == input.size():
raise... | 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... | OnurUner/DeepSide | FocalLoss1 | false | 17,774 | [
"MIT"
] | 4 | dffb7ddc1d1bde36bbf5abb6eac107d39985c57a | https://github.com/OnurUner/DeepSide/tree/dffb7ddc1d1bde36bbf5abb6eac107d39985c57a | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.onnx
class Model(nn.Module):
def __init__(self, gamma):
super().__init__()
self.gamma = gamma
def forward(self, input, target):
if not target.size() == input.size():
raise ValueError(
... |
GramMatrix | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.fft
class GramMatrix(torch.nn.Module):
def forward(self, input):
b, c, h, w = input.size()
features = input.view(b, c, h * w)
gram_matrix = torch.bmm(features, features.transpose(1, 2))
gram_matrix.div_(h * w)
return gram_matrix
def get_inputs()... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.fft
assert_size_stride = torch._C._dynamo.guards.assert_size_stride... | NejcHirci/material-addon | GramMatrix | false | 17,775 | [
"MIT"
] | 4 | c08e2081413c3319b712c2f7193ac8013f601382 | https://github.com/NejcHirci/material-addon/tree/c08e2081413c3319b712c2f7193ac8013f601382 | import torch
import torch.fft
class Model(torch.nn.Module):
def forward(self, input):
b, c, h, w = input.size()
features = input.view(b, c, h * w)
gram_matrix = torch.bmm(features, features.transpose(1, 2))
gram_matrix.div_(h * w)
return gram_matrix
def get_inputs():
... |
Mapping | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.fft
class Mapping(nn.Module):
def __init__(self, z_size, out_size):
super(Mapping, self).__init__()
self.out_size = out_size
self.mapping_layers = nn.ModuleList()
self.linear = nn.Linear(z_size, z_size)
self.relu = nn.ReLU(in... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | NejcHirci/material-addon | Mapping | false | 17,776 | [
"MIT"
] | 4 | c08e2081413c3319b712c2f7193ac8013f601382 | https://github.com/NejcHirci/material-addon/tree/c08e2081413c3319b712c2f7193ac8013f601382 | import torch
import torch.nn as nn
import torch.fft
class Model(nn.Module):
def __init__(self, z_size, out_size):
super().__init__()
self.out_size = out_size
self.mapping_layers = nn.ModuleList()
self.linear = nn.Linear(z_size, z_size)
self.relu = nn.ReLU(inplace=True)
... |
FocusLayer | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
class FocusLayer(nn.Module):
def __init__(self, c1, c2, k=1):
super(FocusLayer, self).__init__()
def forward(self, x):
return torch.cat([x[..., ::2], x[..., 1::2]], dim=1)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | OrigamiSL/TCCT2021-Neurocomputing- | FocusLayer | false | 17,777 | [
"Apache-2.0"
] | 4 | c98c7add5d68510db61f49038970d145393d42a5 | https://github.com/OrigamiSL/TCCT2021-Neurocomputing-/tree/c98c7add5d68510db61f49038970d145393d42a5 | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self, c1, c2, k=1):
super().__init__()
def forward(self, x):
return torch.cat([x[..., ::2], x[..., 1::2]], dim=1)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [4, 4]
|
vd_linear_1L | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import math
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
def calculate_kl(log_alpha):
return 0.5 * torch.sum(torch.log1p(torch.exp(-log_alpha)))
class VdLinear(nn.Module):
"""
variational dropout
"""
def __init__(self, n_in, n_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.... | Neronjust2017/Bayesian-neural-networks | vd_linear_1L | false | 17,778 | [
"MIT"
] | 4 | 9d7f781f5c2dfa8fadf26300b4b5b64366c939cd | https://github.com/Neronjust2017/Bayesian-neural-networks/tree/9d7f781f5c2dfa8fadf26300b4b5b64366c939cd | import math
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
def calculate_kl(log_alpha):
return 0.5 * torch.sum(torch.log1p(torch.exp(-log_alpha)))
class VdLinear(nn.Module):
"""
variational dropout
"""
def __init__(self, n_in, n_ou... |
GramLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.fft
class GramMatrix(torch.nn.Module):
def forward(self, input):
b, c, h, w = input.size()
features = input.view(b, c, h * w)
gram_matrix = torch.bmm(features, features.transpose(1, 2))
gram_matrix.div_(h * w)
return gram_mat... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | NejcHirci/material-addon | GramLoss | false | 17,779 | [
"MIT"
] | 4 | c08e2081413c3319b712c2f7193ac8013f601382 | https://github.com/NejcHirci/material-addon/tree/c08e2081413c3319b712c2f7193ac8013f601382 | import torch
import torch.nn as nn
import torch.fft
class GramMatrix(torch.nn.Module):
def forward(self, input):
b, c, h, w = input.size()
features = input.view(b, c, h * w)
gram_matrix = torch.bmm(features, features.transpose(1, 2))
gram_matrix.div_(h * w)
return gram_mat... |
vd_linear_1L_hetero | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import math
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
def calculate_kl(log_alpha):
return 0.5 * torch.sum(torch.log1p(torch.exp(-log_alpha)))
class VdLinear(nn.Module):
"""
variational dropout
"""
def __init__(self, n_in, n_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.... | Neronjust2017/Bayesian-neural-networks | vd_linear_1L_hetero | false | 17,780 | [
"MIT"
] | 4 | 9d7f781f5c2dfa8fadf26300b4b5b64366c939cd | https://github.com/Neronjust2017/Bayesian-neural-networks/tree/9d7f781f5c2dfa8fadf26300b4b5b64366c939cd | import math
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
def calculate_kl(log_alpha):
return 0.5 * torch.sum(torch.log1p(torch.exp(-log_alpha)))
class VdLinear(nn.Module):
"""
variational dropout
"""
def __init__(self, n_in, n_ou... |
Net | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as f
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.fc1 = nn.Linear(28 * 28, 1024)
self.fc2 = nn.Linear(1024, 10)
def forward(self, x):
x = f.relu(self.fc1(x.view(-1, 28 * 28)))
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | PacktPublishing/Hands-On-Computer-Vision-with-PyTorch-1.x | Net | false | 17,781 | [
"MIT"
] | 6 | bad073f7489792d3c4bc860a2d56fa133ba63617 | https://github.com/PacktPublishing/Hands-On-Computer-Vision-with-PyTorch-1.x/tree/bad073f7489792d3c4bc860a2d56fa133ba63617 | import torch
import torch.nn as nn
import torch.nn.functional as f
class Model(nn.Module):
def __init__(self):
super().__init__()
self.fc1 = nn.Linear(28 * 28, 1024)
self.fc2 = nn.Linear(1024, 10)
def forward(self, x):
x = f.relu(self.fc1(x.view(-1, 28 * 28)))
x = sel... |
ThreeLayerNet_tanh | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
class ThreeLayerNet_tanh(torch.nn.Module):
def __init__(self, D_in, H_1, H_2, D_out):
super(ThreeLayerNet_tanh, self).__init__()
self.linear1 = torch.nn.Linear(D_in, H_1)
self.tanh = torch.nn.Tanh()
self.linear2 = torch.nn.Linear(H_1, H_2)
self.linear3 = torch... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | PanosAntoniadis/pattern_recognition-ntua | ThreeLayerNet_tanh | false | 17,782 | [
"MIT"
] | 6 | 6dca44de77f0ca94221980fc789446a2e10410a4 | https://github.com/PanosAntoniadis/pattern_recognition-ntua/tree/6dca44de77f0ca94221980fc789446a2e10410a4 | import torch
class Model(torch.nn.Module):
def __init__(self, D_in, H_1, H_2, D_out):
super().__init__()
self.linear1 = torch.nn.Linear(D_in, H_1)
self.tanh = torch.nn.Tanh()
self.linear2 = torch.nn.Linear(H_1, H_2)
self.linear3 = torch.nn.Linear(H_2, D_out)
def forwa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.