Models¶
Logisitic Regression¶
-
class
distil.utils.models.logreg_net.
LogisticRegNet
(input_dim, num_classes)[source]¶ Bases:
torch.nn.modules.module.Module
-
forward
(x, last=False)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
Simple Neural Network¶
-
class
distil.utils.models.simpleNN_net.
ThreeLayerNet
(input_dim, num_classes, h1, h2)[source]¶ Bases:
torch.nn.modules.module.Module
-
forward
(x, last=False)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
-
class
distil.utils.models.simpleNN_net.
TwoLayerNet
(input_dim, num_classes, hidden_units)[source]¶ Bases:
torch.nn.modules.module.Module
-
forward
(x, last=False)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
MNIST_NET¶
-
class
distil.utils.models.mnist_net.
MnistNet
[source]¶ Bases:
torch.nn.modules.module.Module
-
forward
(x, last=False)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
CIFAR10Net module¶
-
class
distil.utils.models.cifar10net.
CifarNet
[source]¶ Bases:
torch.nn.modules.module.Module
-
forward
(x, last=False)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
ResNet¶
ResNet in PyTorch.
For Pre-activation ResNet, see ‘preact_resnet.py’.
Reference: [1] Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun
Deep Residual Learning for Image Recognition. arXiv:1512.03385
-
class
distil.utils.models.resnet.
BasicBlock
(in_planes, planes, stride=1)[source]¶ Bases:
torch.nn.modules.module.Module
-
expansion
= 1¶
-
forward
(x)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
-
class
distil.utils.models.resnet.
Bottleneck
(in_planes, planes, stride=1)[source]¶ Bases:
torch.nn.modules.module.Module
-
expansion
= 4¶
-
forward
(x)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
-
class
distil.utils.models.resnet.
ResNet
(block, num_blocks, num_classes=10)[source]¶ Bases:
torch.nn.modules.module.Module
-
forward
(x, last=False)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-