def __init__(self, depth=18, init_plane=64, out_plane=None, stage=4, num_class=10, small_input=True, doublechannel=None, downsample=None): """Create layers. :param num_reps: number of layers :type num_reqs: int :param items: channel and stride of every layer :type items: dict :param num_class: number of class :type num_class: int """ super(ResNet, self).__init__() self.backbone = ResNetGeneral(small_input, init_plane, depth, stage, doublechannel, downsample) self.adaptiveAvgPool2d = AdaptiveAvgPool2d(output_size=(1, 1)) self.view = View() out_plane = out_plane or self.backbone.output_channel self.head = Linear(in_features=out_plane, out_features=num_class)
def __init__(self, **descript): """Create layers.""" super().__init__() # state_dim = descript.get("state_dim") action_dim = descript.get("action_dim") self.lambda1 = Lambda(lambda x: tf.cast(x, dtype='float32') / 255.) self.conv1 = Conv2d(in_channels=4, out_channels=32, kernel_size=8, stride=4, bias=False) self.ac1 = Relu() self.conv2 = Conv2d(in_channels=32, out_channels=64, kernel_size=4, stride=2, bias=False) self.ac2 = Relu() self.conv3 = Conv2d(in_channels=64, out_channels=64, kernel_size=3, stride=1, bias=False) self.ac3 = Relu() self.view = View() self.fc1 = Linear(64, 256) self.ac4 = Relu() self.fc2 = Linear(256, action_dim)
def __init__(self, code=None, depth=18, base_channel=64, out_plane=2048, stage=4, num_class=1000, small_input=True, block='BasicBlock', pretrained_arch=None, pretrained=None): """Create layers. :param num_reps: number of layers :type num_reqs: int :param items: channel and stride of every layer :type items: dict :param num_class: number of class :type num_class: int """ super(FasterBackbone, self).__init__() self.backbone = SpResNetDet(depth=depth, block=block, code=code, pretrained=pretrained, pretrained_arch=pretrained_arch) self.adaptiveAvgPool2d = AdaptiveAvgPool2d(output_size=(1, 1)) self.view = View() out_plane = out_plane or self.backbone.out_channels self.head = Linear(in_features=out_plane, out_features=num_class)