Full Code of grigorisg9gr/polynomial_nets for AI

master 210f0d34325d cached
108 files
17.3 MB
4.5M tokens
617 symbols
1 requests
Copy disabled (too large) Download .txt
Showing preview only (18,171K chars total). Download the full file to get everything.
Repository: grigorisg9gr/polynomial_nets
Branch: master
Commit: 210f0d34325d
Files: 108
Total size: 17.3 MB

Directory structure:
gitextract_zpv_duhy/

├── .gitignore
├── LICENSE.txt
├── classification-NO-activation-function/
│   ├── README.md
│   ├── backbones/
│   │   ├── pinet_1x1_norelu.py
│   │   ├── pinet_1x1_relu.py
│   │   ├── pinet_norelu.py
│   │   ├── pinet_relu.py
│   │   └── resnet_norelu.py
│   └── logs/
│       ├── pinet_1x1_norelu.log
│       ├── pinet_1x1_relu.log
│       ├── pinet_norelu.log
│       ├── pinet_relu.log
│       └── resnet_norelu.log
├── face_recognition/
│   ├── README.md
│   ├── __init__.py
│   ├── config.py
│   ├── data/
│   │   ├── build_eval_pack.py
│   │   ├── lfw/
│   │   │   └── pairs_label.txt
│   │   └── rec2image.py
│   ├── eval/
│   │   ├── lfw.py
│   │   └── verification.py
│   ├── flops_counter.py
│   ├── image_iter.py
│   ├── metric.py
│   ├── models/
│   │   ├── MS1Mretina-polynet50-arcface/
│   │   │   ├── log_retina_r50newton_arcface.txt
│   │   │   └── model-symbol.json
│   │   └── MS1Mretina-resnet50-arcface/
│   │       ├── log_retina_r50_arcface.txt
│   │       └── model-symbol.json
│   ├── parall_module_local_v1.py
│   ├── sample_config.py
│   ├── symbol/
│   │   ├── fdensenet.py
│   │   ├── fmnasnet.py
│   │   ├── fmobilefacenet.py
│   │   ├── fmobilenet.py
│   │   ├── fresnet.py
│   │   ├── memonger.py
│   │   ├── symbol_utils.py
│   │   └── vargfacenet.py
│   ├── train.py
│   ├── train_parall.py
│   └── triplet_image_iter.py
├── image_generation_chainer/
│   ├── __init__.py
│   ├── datasets/
│   │   └── mnist.py
│   ├── dis_models/
│   │   ├── __init__.py
│   │   ├── resblocks_dis.py
│   │   └── snresnet_32.py
│   ├── evaluations/
│   │   ├── __init__.py
│   │   ├── extensions.py
│   │   └── ndb.py
│   ├── gen_models/
│   │   └── cnn_gen_custom_prodpoly.py
│   ├── jobs/
│   │   └── pinet/
│   │       ├── fashionmnist_cnn_prodpoly_linear.yml
│   │       └── train_mn_mnist.py
│   ├── readme.rst
│   ├── source/
│   │   ├── __init__.py
│   │   ├── functions/
│   │   │   ├── __init__.py
│   │   │   ├── cond_bn_wrapper.py
│   │   │   ├── losses.py
│   │   │   └── max_sv.py
│   │   ├── inception/
│   │   │   ├── __init__.py
│   │   │   ├── download.py
│   │   │   ├── example.py
│   │   │   ├── inception_score.py
│   │   │   └── inception_score_tf.py
│   │   ├── links/
│   │   │   ├── __init__.py
│   │   │   ├── categorical_conditional_batch_normalization.py
│   │   │   ├── conditional_batch_normalization.py
│   │   │   ├── resnet_layer.py
│   │   │   ├── sn_convolution_2d.py
│   │   │   ├── sn_convolution_nd.py
│   │   │   ├── sn_dilated_convolution_2d.py
│   │   │   ├── sn_embed_id.py
│   │   │   ├── sn_linear.py
│   │   │   └── sn_symmetric_linear.py
│   │   ├── misc_train_utils.py
│   │   ├── miscs/
│   │   │   ├── __init__.py
│   │   │   ├── model_moiving_average.py
│   │   │   └── random_samples.py
│   │   └── yaml_utils.py
│   └── updaters/
│       └── gans/
│           └── updater.py
├── image_generation_pytorch/
│   ├── FID/
│   │   ├── LICENSE
│   │   ├── README.md
│   │   ├── __init__.py
│   │   ├── fid_score.py
│   │   └── inception.py
│   ├── IS/
│   │   ├── LICENSE.md
│   │   ├── README.md
│   │   └── inception_score.py
│   ├── README.rst
│   ├── data_loader.py
│   ├── logger.py
│   ├── main.py
│   ├── model.py
│   └── solver.py
├── mesh_pi_nets/
│   ├── .gitignore
│   ├── README.md
│   ├── autoencoder_dataset.py
│   ├── datasets/
│   │   ├── COMA/
│   │   │   └── templates/
│   │   │       ├── COMA_downsample/
│   │   │       │   └── downsampling_matrices.pkl
│   │   │       └── template.obj
│   │   └── DFAUST/
│   │       └── templates/
│   │           ├── COMA_downsample/
│   │           │   └── downsampling_matrices.pkl
│   │           └── template.obj
│   ├── mesh_sampling.py
│   ├── models.py
│   ├── shape_data.py
│   ├── spiral_pi_nets.py
│   ├── spiral_utils.py
│   ├── test_funcs.py
│   └── train_funcs.py
└── readme.rst

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
*~
*.pyc
.idea/*
*.egg-info/*
*tmp*.py
*tmp*
*.*.backup
**/__pycache__/
**/results/
**/results_*/
**/template_icl/
**/.ipynb_checkpoints/
**/demo/
.chainerui_commands
*tmp_grigoris

# personal testout files.
personal.py



================================================
FILE: LICENSE.txt
================================================
Attribution-NonCommercial 4.0 International License

Copyright (c) 2020, Grigorios G Chrysos, Stylianos Moschoglou, Giorgos Bouritsas, Jiankang Deng.
All rights reserved.


=================================================================================================

    CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
    LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
    ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
    INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
    REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
    PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
    THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
    HEREUNDER.

Creative Commons Attribution-NonCommercial 4.0 International Public License

By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.

    Section 1 – Definitions.
        a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
        b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
        c. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
        d. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
        e. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
        f. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
        g. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
        h. Licensor means the individual(s) or entity(ies) granting rights under this Public License.
        i. NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
        j. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
        k. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
        l. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.

    Section 2 – Scope.
        a. License grant.
            1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
                A. reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
                B. produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
            2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
            3. Term. The term of this Public License is specified in Section 6(a).
            4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
            5. Downstream recipients.
                A. Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
                B. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
            6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
        b. Other rights.
            1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
            2. Patent and trademark rights are not licensed under this Public License.
            3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.

    Section 3 – License Conditions.

    Your exercise of the Licensed Rights is expressly made subject to the following conditions.
        a. Attribution.
            1. If You Share the Licensed Material (including in modified form), You must:
                A. retain the following if it is supplied by the Licensor with the Licensed Material:
                    i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
                    ii. a copyright notice;
                    iii. a notice that refers to this Public License;
                    iv. a notice that refers to the disclaimer of warranties;
                    v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
                B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
                C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
            2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
            3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
            4. If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License.

    Section 4 – Sui Generis Database Rights.

    Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
        a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
        b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and
        c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.

    For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.

    Section 5 – Disclaimer of Warranties and Limitation of Liability.
        a. Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
        b. To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
        c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.

    Section 6 – Term and Termination.
        a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
        b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
            1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
            2. upon express reinstatement by the Licensor.

        For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
        c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
        d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.

    Section 7 – Other Terms and Conditions.
        a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
        b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.

    Section 8 – Interpretation.
        a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
        b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
        c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
        d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.

Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the "Licensor." The text of the Creative Commons public licenses is dedicated to the public domain under the CC0 Public Domain Dedication. Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark "Creative Commons" or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.

Creative Commons may be contacted at creativecommons.org.



================================================
FILE: classification-NO-activation-function/README.md
================================================
# PiNet without Activation Function

<!-- [ALGORITHM] -->

## Abstract

Typically, neural networks required activation functions to be able to approximate effectively complex distributions. ReLU-nets have been popular, e.g., ResNets. However, in the proposed polynomial nets, there is no strict requirement for activation functions as the Π-nets already include nonlinear interactions between the input elements. In fact, you could capture high-order correlations between the input elements without any activation functions, which is what we focus on in this experiment. In particular, we illustrate how Π-nets can learn classification even in the demanding ImageNet without activation functions. We hope that our code can inspire further experimentation with networks that do not require activation functions and can find alternative ways to express nonlinear relationships between the input elements. 



<div align=center>
<img src="https://github.com/grigorisg9gr/polynomial_nets/blob/master/no_relu/Top1.png" width="40%"/>
  <img src="https://github.com/grigorisg9gr/polynomial_nets/blob/master/no_relu/Top5.png" width="40%"/>
</div>

## Implemenation Details

Please follow [mmclassification](https://github.com/open-mmlab/mmclassification) to set up the training environment. Our models are trained by a single server with eight V100 GPUs.

We slightly modifiy [ResNet](https://github.com/open-mmlab/mmclassification/blob/master/mmcls/models/backbones/resnet.py) for different [experiments](https://github.com/grigorisg9gr/polynomial_nets/tree/master/no_relu/backbones).

All other training details follow the standard [configuration](https://github.com/open-mmlab/mmclassification/blob/master/configs/resnet/resnet18_8xb32_in1k.py).

## Results 

### ImageNet-1k

|       Model        |  ReLu | Conv-1x1 |Top-1 (%) | Top-5 (%) |                                  Backbone                                  |                                  Logs                                   |
| :----------------: | :-------: | :------: | :-------: | :-------: | :----------------------------------------------------------------------: | :-------------------------------------------------------------------------: |
|     ResNet-18      |   Yes  |   No   |   69.90   |   89.43   | [config](https://github.com/open-mmlab/mmclassification/blob/master/configs/resnet/resnet18_8xb32_in1k.py) | [log](https://download.openmmlab.com/mmclassification/v0/resnet/resnet18_8xb32_in1k_20210831-fbbb1da6.log.json) |
|     ResNet-18      |   No   |   No    |   18.348   |   36.718   | [backbone](https://github.com/grigorisg9gr/polynomial_nets/blob/master/no_relu/backbones/resnet_norelu.py) | [log](https://github.com/grigorisg9gr/polynomial_nets/blob/master/no_relu/logs/resnet_norelu.log) |
|     PiNet-18      |   No   |   No   |   63.666   |   84.340   | [backbone](https://github.com/grigorisg9gr/polynomial_nets/blob/master/no_relu/backbones/pinet_norelu.py) | [log](https://github.com/grigorisg9gr/polynomial_nets/blob/master/no_relu/logs/pinet_norelu.log) |
|     PiNet-18      |   No   |   Yes  |   65.306   |   85.830   | [backbone](https://github.com/grigorisg9gr/polynomial_nets/blob/master/no_relu/backbones/pinet_1x1_norelu.py) | [log](https://github.com/grigorisg9gr/polynomial_nets/blob/master/no_relu/logs/pinet_1x1_norelu.log) |
|     PiNet-18      |   Yes   |   No   |   70.350   |   89.434   | [backbone](https://github.com/grigorisg9gr/polynomial_nets/blob/master/no_relu/backbones/pinet_relu.py) | [log](https://github.com/grigorisg9gr/polynomial_nets/blob/master/no_relu/logs/pinet_relu.log) |
|     PiNet-18      |   Yes   |   Yes   |   71.644   |   90.232   | [backbone](https://github.com/grigorisg9gr/polynomial_nets/blob/master/no_relu/backbones/pinet_1x1_relu.py) | [log](https://github.com/grigorisg9gr/polynomial_nets/blob/master/no_relu/logs/pinet_1x1_relu.log) |



================================================
FILE: classification-NO-activation-function/backbones/pinet_1x1_norelu.py
================================================
# Copyright (c) OpenMMLab. All rights reserved.

import torch.nn as nn
import torch.utils.checkpoint as cp
from mmcv.cnn import (ConvModule, build_activation_layer, build_conv_layer,
                      build_norm_layer, constant_init)
from mmcv.cnn.bricks import DropPath
from mmcv.runner import BaseModule
from mmcv.utils.parrots_wrapper import _BatchNorm

from ..builder import BACKBONES
from .base_backbone import BaseBackbone

eps = 1.0e-5


class BasicBlock(BaseModule):
    """BasicBlock for ResNet.

    Args:
        in_channels (int): Input channels of this block.
        out_channels (int): Output channels of this block.
        expansion (int): The ratio of ``out_channels/mid_channels`` where
            ``mid_channels`` is the output channels of conv1. This is a
            reserved argument in BasicBlock and should always be 1. Default: 1.
        stride (int): stride of the block. Default: 1
        dilation (int): dilation of convolution. Default: 1
        downsample (nn.Module, optional): downsample operation on identity
            branch. Default: None.
        style (str): `pytorch` or `caffe`. It is unused and reserved for
            unified API with Bottleneck.
        with_cp (bool): Use checkpoint or not. Using checkpoint will save some
            memory while slowing down the training speed.
        conv_cfg (dict, optional): dictionary to construct and config conv
            layer. Default: None
        norm_cfg (dict): dictionary to construct and config norm layer.
            Default: dict(type='BN')
    """

    def __init__(self,
                 in_channels,
                 out_channels,
                 expansion=1,
                 stride=1,
                 dilation=1,
                 downsample=None,
                 style='pytorch',
                 with_cp=False,
                 conv_cfg=None,
                 norm_cfg=dict(type='BN'),
                 drop_path_rate=0.0,
                 act_cfg=dict(type='ReLU', inplace=True),
                 init_cfg=None):
        super(BasicBlock, self).__init__(init_cfg=init_cfg)
        self.in_channels = in_channels
        self.out_channels = out_channels
        self.expansion = expansion
        assert self.expansion == 1
        assert out_channels % expansion == 0
        self.mid_channels = out_channels // expansion
        self.stride = stride
        self.dilation = dilation
        self.style = style
        self.with_cp = with_cp
        self.conv_cfg = conv_cfg
        self.norm_cfg = norm_cfg

        self.norm1_name, norm1 = build_norm_layer(
            norm_cfg, self.mid_channels, postfix=1)
        self.norm2_name, norm2 = build_norm_layer(
            norm_cfg, out_channels, postfix=2)
        self.norm3_name, norm3 = build_norm_layer(
            norm_cfg, out_channels, postfix=3)

        self.conv1 = build_conv_layer(
            conv_cfg,
            in_channels,
            self.mid_channels,
            3,
            stride=stride,
            padding=dilation,
            dilation=dilation,
            bias=False)
        self.add_module(self.norm1_name, norm1)
        self.conv2 = build_conv_layer(
            conv_cfg,
            self.mid_channels,
            out_channels,
            3,
            padding=1,
            bias=False)
        self.add_module(self.norm2_name, norm2)
        self.conv3 = build_conv_layer(
            conv_cfg,
            self.mid_channels,
            out_channels,
            kernel_size=1,
            bias=False)
        self.add_module(self.norm3_name, norm3)

#         self.relu = build_activation_layer(act_cfg)
        self.downsample = downsample
#         self.drop_path = DropPath(drop_prob=drop_path_rate
#                                   ) if drop_path_rate > eps else nn.Identity()

    @property
    def norm1(self):
        return getattr(self, self.norm1_name)

    @property
    def norm2(self):
        return getattr(self, self.norm2_name)
    
    @property
    def norm3(self):
        return getattr(self, self.norm3_name)

    def forward(self, x):

        def _inner_forward(x):
            identity = x

            out = self.conv1(x)
            out = self.norm1(out)
#             out = self.relu(out)

            out = self.conv2(out)
            out = self.norm2(out)

            if self.downsample is not None:
                identity = self.downsample(x)
#             out = self.drop_path(out)
               
            second = self.conv3(out*identity)
            out = out + identity + self.norm3(second)
                



            return out

        if self.with_cp and x.requires_grad:
            out = cp.checkpoint(_inner_forward, x)
        else:
            out = _inner_forward(x)

#         out = self.relu(out)

        return out


class Bottleneck(BaseModule):
    """Bottleneck block for ResNet.

    Args:
        in_channels (int): Input channels of this block.
        out_channels (int): Output channels of this block.
        expansion (int): The ratio of ``out_channels/mid_channels`` where
            ``mid_channels`` is the input/output channels of conv2. Default: 4.
        stride (int): stride of the block. Default: 1
        dilation (int): dilation of convolution. Default: 1
        downsample (nn.Module, optional): downsample operation on identity
            branch. Default: None.
        style (str): ``"pytorch"`` or ``"caffe"``. If set to "pytorch", the
            stride-two layer is the 3x3 conv layer, otherwise the stride-two
            layer is the first 1x1 conv layer. Default: "pytorch".
        with_cp (bool): Use checkpoint or not. Using checkpoint will save some
            memory while slowing down the training speed.
        conv_cfg (dict, optional): dictionary to construct and config conv
            layer. Default: None
        norm_cfg (dict): dictionary to construct and config norm layer.
            Default: dict(type='BN')
    """

    def __init__(self,
                 in_channels,
                 out_channels,
                 expansion=4,
                 stride=1,
                 dilation=1,
                 downsample=None,
                 style='pytorch',
                 with_cp=False,
                 conv_cfg=None,
                 norm_cfg=dict(type='BN'),
                 act_cfg=dict(type='ReLU', inplace=True),
                 drop_path_rate=0.0,
                 init_cfg=None):
        super(Bottleneck, self).__init__(init_cfg=init_cfg)
        assert style in ['pytorch', 'caffe']

        self.in_channels = in_channels
        self.out_channels = out_channels
        self.expansion = expansion
        assert out_channels % expansion == 0
        self.mid_channels = out_channels // expansion
        self.stride = stride
        self.dilation = dilation
        self.style = style
        self.with_cp = with_cp
        self.conv_cfg = conv_cfg
        self.norm_cfg = norm_cfg

        if self.style == 'pytorch':
            self.conv1_stride = 1
            self.conv2_stride = stride
        else:
            self.conv1_stride = stride
            self.conv2_stride = 1

        self.norm1_name, norm1 = build_norm_layer(
            norm_cfg, self.mid_channels, postfix=1)
        self.norm2_name, norm2 = build_norm_layer(
            norm_cfg, self.mid_channels, postfix=2)
        self.norm3_name, norm3 = build_norm_layer(
            norm_cfg, out_channels, postfix=3)

        self.conv1 = build_conv_layer(
            conv_cfg,
            in_channels,
            self.mid_channels,
            kernel_size=1,
            stride=self.conv1_stride,
            bias=False)
        self.add_module(self.norm1_name, norm1)
        self.conv2 = build_conv_layer(
            conv_cfg,
            self.mid_channels,
            self.mid_channels,
            kernel_size=3,
            stride=self.conv2_stride,
            padding=dilation,
            dilation=dilation,
            bias=False)

        self.add_module(self.norm2_name, norm2)
        self.conv3 = build_conv_layer(
            conv_cfg,
            self.mid_channels,
            out_channels,
            kernel_size=1,
            bias=False)
        self.add_module(self.norm3_name, norm3)

        self.relu = build_activation_layer(act_cfg)
        self.downsample = downsample
        self.drop_path = DropPath(drop_prob=drop_path_rate
                                  ) if drop_path_rate > eps else nn.Identity()

    @property
    def norm1(self):
        return getattr(self, self.norm1_name)

    @property
    def norm2(self):
        return getattr(self, self.norm2_name)

    @property
    def norm3(self):
        return getattr(self, self.norm3_name)

    def forward(self, x):

        def _inner_forward(x):
            identity = x

            out = self.conv1(x)
            out = self.norm1(out)
            out = self.relu(out)

            out = self.conv2(out)
            out = self.norm2(out)
            out = self.relu(out)

            out = self.conv3(out)
            out = self.norm3(out)

            if self.downsample is not None:
                identity = self.downsample(x)

            out = self.drop_path(out)

            out += identity

            return out

        if self.with_cp and x.requires_grad:
            out = cp.checkpoint(_inner_forward, x)
        else:
            out = _inner_forward(x)

        out = self.relu(out)

        return out


def get_expansion(block, expansion=None):
    """Get the expansion of a residual block.

    The block expansion will be obtained by the following order:

    1. If ``expansion`` is given, just return it.
    2. If ``block`` has the attribute ``expansion``, then return
       ``block.expansion``.
    3. Return the default value according the the block type:
       1 for ``BasicBlock`` and 4 for ``Bottleneck``.

    Args:
        block (class): The block class.
        expansion (int | None): The given expansion ratio.

    Returns:
        int: The expansion of the block.
    """
    if isinstance(expansion, int):
        assert expansion > 0
    elif expansion is None:
        if hasattr(block, 'expansion'):
            expansion = block.expansion
        elif issubclass(block, BasicBlock):
            expansion = 1
        elif issubclass(block, Bottleneck):
            expansion = 4
        else:
            raise TypeError(f'expansion is not specified for {block.__name__}')
    else:
        raise TypeError('expansion must be an integer or None')

    return expansion


class ResLayer(nn.Sequential):
    """ResLayer to build ResNet style backbone.

    Args:
        block (nn.Module): Residual block used to build ResLayer.
        num_blocks (int): Number of blocks.
        in_channels (int): Input channels of this block.
        out_channels (int): Output channels of this block.
        expansion (int, optional): The expansion for BasicBlock/Bottleneck.
            If not specified, it will firstly be obtained via
            ``block.expansion``. If the block has no attribute "expansion",
            the following default values will be used: 1 for BasicBlock and
            4 for Bottleneck. Default: None.
        stride (int): stride of the first block. Default: 1.
        avg_down (bool): Use AvgPool instead of stride conv when
            downsampling in the bottleneck. Default: False
        conv_cfg (dict, optional): dictionary to construct and config conv
            layer. Default: None
        norm_cfg (dict): dictionary to construct and config norm layer.
            Default: dict(type='BN')
    """

    def __init__(self,
                 block,
                 num_blocks,
                 in_channels,
                 out_channels,
                 expansion=None,
                 stride=1,
                 avg_down=False,
                 conv_cfg=None,
                 norm_cfg=dict(type='BN'),
                 **kwargs):
        self.block = block
        self.expansion = get_expansion(block, expansion)

        downsample = None
        if stride != 1 or in_channels != out_channels:
            downsample = []
            conv_stride = stride
            if avg_down and stride != 1:
                conv_stride = 1
                downsample.append(
                    nn.AvgPool2d(
                        kernel_size=stride,
                        stride=stride,
                        ceil_mode=True,
                        count_include_pad=False))
            downsample.extend([
                build_conv_layer(
                    conv_cfg,
                    in_channels,
                    out_channels,
                    kernel_size=1,
                    stride=conv_stride,
                    bias=False),
                build_norm_layer(norm_cfg, out_channels)[1]
            ])
            downsample = nn.Sequential(*downsample)

        layers = []
        layers.append(
            block(
                in_channels=in_channels,
                out_channels=out_channels,
                expansion=self.expansion,
                stride=stride,
                downsample=downsample,
                conv_cfg=conv_cfg,
                norm_cfg=norm_cfg,
                **kwargs))
        in_channels = out_channels
        for i in range(1, num_blocks):
            layers.append(
                block(
                    in_channels=in_channels,
                    out_channels=out_channels,
                    expansion=self.expansion,
                    stride=1,
                    conv_cfg=conv_cfg,
                    norm_cfg=norm_cfg,
                    **kwargs))
        super(ResLayer, self).__init__(*layers)


@BACKBONES.register_module()
class ResNet(BaseBackbone):
    """ResNet backbone.

    Please refer to the `paper <https://arxiv.org/abs/1512.03385>`__ for
    details.

    Args:
        depth (int): Network depth, from {18, 34, 50, 101, 152}.
        in_channels (int): Number of input image channels. Default: 3.
        stem_channels (int): Output channels of the stem layer. Default: 64.
        base_channels (int): Middle channels of the first stage. Default: 64.
        num_stages (int): Stages of the network. Default: 4.
        strides (Sequence[int]): Strides of the first block of each stage.
            Default: ``(1, 2, 2, 2)``.
        dilations (Sequence[int]): Dilation of each stage.
            Default: ``(1, 1, 1, 1)``.
        out_indices (Sequence[int]): Output from which stages.
            Default: ``(3, )``.
        style (str): `pytorch` or `caffe`. If set to "pytorch", the stride-two
            layer is the 3x3 conv layer, otherwise the stride-two layer is
            the first 1x1 conv layer.
        deep_stem (bool): Replace 7x7 conv in input stem with 3 3x3 conv.
            Default: False.
        avg_down (bool): Use AvgPool instead of stride conv when
            downsampling in the bottleneck. Default: False.
        frozen_stages (int): Stages to be frozen (stop grad and set eval mode).
            -1 means not freezing any parameters. Default: -1.
        conv_cfg (dict | None): The config dict for conv layers. Default: None.
        norm_cfg (dict): The config dict for norm layers.
        norm_eval (bool): Whether to set norm layers to eval mode, namely,
            freeze running stats (mean and var). Note: Effect on Batch Norm
            and its variants only. Default: False.
        with_cp (bool): Use checkpoint or not. Using checkpoint will save some
            memory while slowing down the training speed. Default: False.
        zero_init_residual (bool): Whether to use zero init for last norm layer
            in resblocks to let them behave as identity. Default: True.

    Example:
        >>> from mmcls.models import ResNet
        >>> import torch
        >>> self = ResNet(depth=18)
        >>> self.eval()
        >>> inputs = torch.rand(1, 3, 32, 32)
        >>> level_outputs = self.forward(inputs)
        >>> for level_out in level_outputs:
        ...     print(tuple(level_out.shape))
        (1, 64, 8, 8)
        (1, 128, 4, 4)
        (1, 256, 2, 2)
        (1, 512, 1, 1)
    """

    arch_settings = {
        18: (BasicBlock, (2, 2, 2, 2)),
        34: (BasicBlock, (3, 4, 6, 3)),
        50: (Bottleneck, (3, 4, 6, 3)),
        101: (Bottleneck, (3, 4, 23, 3)),
        152: (Bottleneck, (3, 8, 36, 3))
    }

    def __init__(self,
                 depth,
                 in_channels=3,
                 stem_channels=64,
                 base_channels=64,
                 expansion=None,
                 num_stages=4,
                 strides=(1, 2, 2, 2),
                 dilations=(1, 1, 1, 1),
                 out_indices=(3, ),
                 style='pytorch',
                 deep_stem=False,
                 avg_down=False,
                 frozen_stages=-1,
                 conv_cfg=None,
                 norm_cfg=dict(type='BN', requires_grad=True),
                 norm_eval=False,
                 with_cp=False,
                 zero_init_residual=True,
                 init_cfg=[
                     dict(type='Kaiming', layer=['Conv2d']),
                     dict(
                         type='Constant',
                         val=1,
                         layer=['_BatchNorm', 'GroupNorm'])
                 ],
                 drop_path_rate=0.0):
        super(ResNet, self).__init__(init_cfg)
        if depth not in self.arch_settings:
            raise KeyError(f'invalid depth {depth} for resnet')
        self.depth = depth
        self.stem_channels = stem_channels
        self.base_channels = base_channels
        self.num_stages = num_stages
        assert num_stages >= 1 and num_stages <= 4
        self.strides = strides
        self.dilations = dilations
        assert len(strides) == len(dilations) == num_stages
        self.out_indices = out_indices
        assert max(out_indices) < num_stages
        self.style = style
        self.deep_stem = deep_stem
        self.avg_down = avg_down
        self.frozen_stages = frozen_stages
        self.conv_cfg = conv_cfg
        self.norm_cfg = norm_cfg
        self.with_cp = with_cp
        self.norm_eval = norm_eval
        self.zero_init_residual = zero_init_residual
        self.block, stage_blocks = self.arch_settings[depth]
        self.stage_blocks = stage_blocks[:num_stages]
        self.expansion = get_expansion(self.block, expansion)

        self._make_stem_layer(in_channels, stem_channels)

        self.res_layers = []
        _in_channels = stem_channels
        _out_channels = base_channels * self.expansion
        for i, num_blocks in enumerate(self.stage_blocks):
            stride = strides[i]
            dilation = dilations[i]
            res_layer = self.make_res_layer(
                block=self.block,
                num_blocks=num_blocks,
                in_channels=_in_channels,
                out_channels=_out_channels,
                expansion=self.expansion,
                stride=stride,
                dilation=dilation,
                style=self.style,
                avg_down=self.avg_down,
                with_cp=with_cp,
                conv_cfg=conv_cfg,
                norm_cfg=norm_cfg,
                drop_path_rate=drop_path_rate)
            _in_channels = _out_channels
            _out_channels *= 2
            layer_name = f'layer{i + 1}'
            self.add_module(layer_name, res_layer)
            self.res_layers.append(layer_name)

        self._freeze_stages()

        self.feat_dim = res_layer[-1].out_channels

    def make_res_layer(self, **kwargs):
        return ResLayer(**kwargs)

    @property
    def norm1(self):
        return getattr(self, self.norm1_name)

    def _make_stem_layer(self, in_channels, stem_channels):
        if self.deep_stem:
            self.stem = nn.Sequential(
                ConvModule(
                    in_channels,
                    stem_channels // 2,
                    kernel_size=3,
                    stride=2,
                    padding=1,
                    conv_cfg=self.conv_cfg,
                    norm_cfg=self.norm_cfg,
                    inplace=True),
                ConvModule(
                    stem_channels // 2,
                    stem_channels // 2,
                    kernel_size=3,
                    stride=1,
                    padding=1,
                    conv_cfg=self.conv_cfg,
                    norm_cfg=self.norm_cfg,
                    inplace=True),
                ConvModule(
                    stem_channels // 2,
                    stem_channels,
                    kernel_size=3,
                    stride=1,
                    padding=1,
                    conv_cfg=self.conv_cfg,
                    norm_cfg=self.norm_cfg,
                    inplace=True))
        else:
            self.conv1 = build_conv_layer(
                self.conv_cfg,
                in_channels,
                stem_channels,
                kernel_size=7,
                stride=2,
                padding=3,
                bias=False)
            self.norm1_name, norm1 = build_norm_layer(
                self.norm_cfg, stem_channels, postfix=1)
            self.add_module(self.norm1_name, norm1)
#             self.relu = nn.ReLU(inplace=True)
        self.maxpool = nn.MaxPool2d(kernel_size=3, stride=2, padding=1)

    def _freeze_stages(self):
        if self.frozen_stages >= 0:
            if self.deep_stem:
                self.stem.eval()
                for param in self.stem.parameters():
                    param.requires_grad = False
            else:
                self.norm1.eval()
                for m in [self.conv1, self.norm1]:
                    for param in m.parameters():
                        param.requires_grad = False

        for i in range(1, self.frozen_stages + 1):
            m = getattr(self, f'layer{i}')
            m.eval()
            for param in m.parameters():
                param.requires_grad = False

    def init_weights(self):
        super(ResNet, self).init_weights()

        if (isinstance(self.init_cfg, dict)
                and self.init_cfg['type'] == 'Pretrained'):
            # Suppress zero_init_residual if use pretrained model.
            return

        if self.zero_init_residual:
            for m in self.modules():
                if isinstance(m, Bottleneck):
                    constant_init(m.norm3, 0)
                elif isinstance(m, BasicBlock):
                    constant_init(m.norm2, 0)

    def forward(self, x):
        if self.deep_stem:
            x = self.stem(x)
        else:
            x = self.conv1(x)
            x = self.norm1(x)
#             x = self.relu(x)
        x = self.maxpool(x)
        outs = []
        for i, layer_name in enumerate(self.res_layers):
            res_layer = getattr(self, layer_name)
            x = res_layer(x)
            if i in self.out_indices:
                outs.append(x)
        return tuple(outs)

    def train(self, mode=True):
        super(ResNet, self).train(mode)
        self._freeze_stages()
        if mode and self.norm_eval:
            for m in self.modules():
                # trick: eval have effect on BatchNorm only
                if isinstance(m, _BatchNorm):
                    m.eval()


@BACKBONES.register_module()
class ResNetV1c(ResNet):
    """ResNetV1c backbone.

    This variant is described in `Bag of Tricks.
    <https://arxiv.org/pdf/1812.01187.pdf>`_.

    Compared with default ResNet(ResNetV1b), ResNetV1c replaces the 7x7 conv
    in the input stem with three 3x3 convs.
    """

    def __init__(self, **kwargs):
        super(ResNetV1c, self).__init__(
            deep_stem=True, avg_down=False, **kwargs)


@BACKBONES.register_module()
class ResNetV1d(ResNet):
    """ResNetV1d backbone.

    This variant is described in `Bag of Tricks.
    <https://arxiv.org/pdf/1812.01187.pdf>`_.

    Compared with default ResNet(ResNetV1b), ResNetV1d replaces the 7x7 conv in
    the input stem with three 3x3 convs. And in the downsampling block, a 2x2
    avg_pool with stride 2 is added before conv, whose stride is changed to 1.
    """

    def __init__(self, **kwargs):
        super(ResNetV1d, self).__init__(
            deep_stem=True, avg_down=True, **kwargs)


================================================
FILE: classification-NO-activation-function/backbones/pinet_1x1_relu.py
================================================
# Copyright (c) OpenMMLab. All rights reserved.

import torch.nn as nn
import torch.utils.checkpoint as cp
from mmcv.cnn import (ConvModule, build_activation_layer, build_conv_layer,
                      build_norm_layer, constant_init)
from mmcv.cnn.bricks import DropPath
from mmcv.runner import BaseModule
from mmcv.utils.parrots_wrapper import _BatchNorm

from ..builder import BACKBONES
from .base_backbone import BaseBackbone

eps = 1.0e-5


class BasicBlock(BaseModule):
    """BasicBlock for ResNet.

    Args:
        in_channels (int): Input channels of this block.
        out_channels (int): Output channels of this block.
        expansion (int): The ratio of ``out_channels/mid_channels`` where
            ``mid_channels`` is the output channels of conv1. This is a
            reserved argument in BasicBlock and should always be 1. Default: 1.
        stride (int): stride of the block. Default: 1
        dilation (int): dilation of convolution. Default: 1
        downsample (nn.Module, optional): downsample operation on identity
            branch. Default: None.
        style (str): `pytorch` or `caffe`. It is unused and reserved for
            unified API with Bottleneck.
        with_cp (bool): Use checkpoint or not. Using checkpoint will save some
            memory while slowing down the training speed.
        conv_cfg (dict, optional): dictionary to construct and config conv
            layer. Default: None
        norm_cfg (dict): dictionary to construct and config norm layer.
            Default: dict(type='BN')
    """

    def __init__(self,
                 in_channels,
                 out_channels,
                 expansion=1,
                 stride=1,
                 dilation=1,
                 downsample=None,
                 style='pytorch',
                 with_cp=False,
                 conv_cfg=None,
                 norm_cfg=dict(type='BN'),
                 drop_path_rate=0.0,
                 act_cfg=dict(type='ReLU', inplace=True),
                 init_cfg=None):
        super(BasicBlock, self).__init__(init_cfg=init_cfg)
        self.in_channels = in_channels
        self.out_channels = out_channels
        self.expansion = expansion
        assert self.expansion == 1
        assert out_channels % expansion == 0
        self.mid_channels = out_channels // expansion
        self.stride = stride
        self.dilation = dilation
        self.style = style
        self.with_cp = with_cp
        self.conv_cfg = conv_cfg
        self.norm_cfg = norm_cfg

        self.norm1_name, norm1 = build_norm_layer(
            norm_cfg, self.mid_channels, postfix=1)
        self.norm2_name, norm2 = build_norm_layer(
            norm_cfg, out_channels, postfix=2)
        self.norm3_name, norm3 = build_norm_layer(
            norm_cfg, out_channels, postfix=3)

        self.conv1 = build_conv_layer(
            conv_cfg,
            in_channels,
            self.mid_channels,
            3,
            stride=stride,
            padding=dilation,
            dilation=dilation,
            bias=False)
        self.add_module(self.norm1_name, norm1)
        self.conv2 = build_conv_layer(
            conv_cfg,
            self.mid_channels,
            out_channels,
            3,
            padding=1,
            bias=False)
        self.add_module(self.norm2_name, norm2)
        self.conv3 = build_conv_layer(
            conv_cfg,
            self.mid_channels,
            out_channels,
            kernel_size=1,
            bias=False)
        self.add_module(self.norm3_name, norm3)

        self.relu = build_activation_layer(act_cfg)
        self.downsample = downsample
#         self.drop_path = DropPath(drop_prob=drop_path_rate
#                                   ) if drop_path_rate > eps else nn.Identity()

    @property
    def norm1(self):
        return getattr(self, self.norm1_name)

    @property
    def norm2(self):
        return getattr(self, self.norm2_name)
    
    @property
    def norm3(self):
        return getattr(self, self.norm3_name)

    def forward(self, x):

        def _inner_forward(x):
            identity = x

            out = self.conv1(x)
            out = self.norm1(out)
            out = self.relu(out)

            out = self.conv2(out)
            out = self.norm2(out)

            if self.downsample is not None:
                identity = self.downsample(x)
#             out = self.drop_path(out)
               
            second = self.conv3(out*identity)
            out = out + identity + self.norm3(second)
                



            return out

        if self.with_cp and x.requires_grad:
            out = cp.checkpoint(_inner_forward, x)
        else:
            out = _inner_forward(x)

        out = self.relu(out)

        return out


class Bottleneck(BaseModule):
    """Bottleneck block for ResNet.

    Args:
        in_channels (int): Input channels of this block.
        out_channels (int): Output channels of this block.
        expansion (int): The ratio of ``out_channels/mid_channels`` where
            ``mid_channels`` is the input/output channels of conv2. Default: 4.
        stride (int): stride of the block. Default: 1
        dilation (int): dilation of convolution. Default: 1
        downsample (nn.Module, optional): downsample operation on identity
            branch. Default: None.
        style (str): ``"pytorch"`` or ``"caffe"``. If set to "pytorch", the
            stride-two layer is the 3x3 conv layer, otherwise the stride-two
            layer is the first 1x1 conv layer. Default: "pytorch".
        with_cp (bool): Use checkpoint or not. Using checkpoint will save some
            memory while slowing down the training speed.
        conv_cfg (dict, optional): dictionary to construct and config conv
            layer. Default: None
        norm_cfg (dict): dictionary to construct and config norm layer.
            Default: dict(type='BN')
    """

    def __init__(self,
                 in_channels,
                 out_channels,
                 expansion=4,
                 stride=1,
                 dilation=1,
                 downsample=None,
                 style='pytorch',
                 with_cp=False,
                 conv_cfg=None,
                 norm_cfg=dict(type='BN'),
                 act_cfg=dict(type='ReLU', inplace=True),
                 drop_path_rate=0.0,
                 init_cfg=None):
        super(Bottleneck, self).__init__(init_cfg=init_cfg)
        assert style in ['pytorch', 'caffe']

        self.in_channels = in_channels
        self.out_channels = out_channels
        self.expansion = expansion
        assert out_channels % expansion == 0
        self.mid_channels = out_channels // expansion
        self.stride = stride
        self.dilation = dilation
        self.style = style
        self.with_cp = with_cp
        self.conv_cfg = conv_cfg
        self.norm_cfg = norm_cfg

        if self.style == 'pytorch':
            self.conv1_stride = 1
            self.conv2_stride = stride
        else:
            self.conv1_stride = stride
            self.conv2_stride = 1

        self.norm1_name, norm1 = build_norm_layer(
            norm_cfg, self.mid_channels, postfix=1)
        self.norm2_name, norm2 = build_norm_layer(
            norm_cfg, self.mid_channels, postfix=2)
        self.norm3_name, norm3 = build_norm_layer(
            norm_cfg, out_channels, postfix=3)

        self.conv1 = build_conv_layer(
            conv_cfg,
            in_channels,
            self.mid_channels,
            kernel_size=1,
            stride=self.conv1_stride,
            bias=False)
        self.add_module(self.norm1_name, norm1)
        self.conv2 = build_conv_layer(
            conv_cfg,
            self.mid_channels,
            self.mid_channels,
            kernel_size=3,
            stride=self.conv2_stride,
            padding=dilation,
            dilation=dilation,
            bias=False)

        self.add_module(self.norm2_name, norm2)
        self.conv3 = build_conv_layer(
            conv_cfg,
            self.mid_channels,
            out_channels,
            kernel_size=1,
            bias=False)
        self.add_module(self.norm3_name, norm3)

        self.relu = build_activation_layer(act_cfg)
        self.downsample = downsample
        self.drop_path = DropPath(drop_prob=drop_path_rate
                                  ) if drop_path_rate > eps else nn.Identity()

    @property
    def norm1(self):
        return getattr(self, self.norm1_name)

    @property
    def norm2(self):
        return getattr(self, self.norm2_name)

    @property
    def norm3(self):
        return getattr(self, self.norm3_name)

    def forward(self, x):

        def _inner_forward(x):
            identity = x

            out = self.conv1(x)
            out = self.norm1(out)
            out = self.relu(out)

            out = self.conv2(out)
            out = self.norm2(out)
            out = self.relu(out)

            out = self.conv3(out)
            out = self.norm3(out)

            if self.downsample is not None:
                identity = self.downsample(x)

            out = self.drop_path(out)

            out += identity

            return out

        if self.with_cp and x.requires_grad:
            out = cp.checkpoint(_inner_forward, x)
        else:
            out = _inner_forward(x)

        out = self.relu(out)

        return out


def get_expansion(block, expansion=None):
    """Get the expansion of a residual block.

    The block expansion will be obtained by the following order:

    1. If ``expansion`` is given, just return it.
    2. If ``block`` has the attribute ``expansion``, then return
       ``block.expansion``.
    3. Return the default value according the the block type:
       1 for ``BasicBlock`` and 4 for ``Bottleneck``.

    Args:
        block (class): The block class.
        expansion (int | None): The given expansion ratio.

    Returns:
        int: The expansion of the block.
    """
    if isinstance(expansion, int):
        assert expansion > 0
    elif expansion is None:
        if hasattr(block, 'expansion'):
            expansion = block.expansion
        elif issubclass(block, BasicBlock):
            expansion = 1
        elif issubclass(block, Bottleneck):
            expansion = 4
        else:
            raise TypeError(f'expansion is not specified for {block.__name__}')
    else:
        raise TypeError('expansion must be an integer or None')

    return expansion


class ResLayer(nn.Sequential):
    """ResLayer to build ResNet style backbone.

    Args:
        block (nn.Module): Residual block used to build ResLayer.
        num_blocks (int): Number of blocks.
        in_channels (int): Input channels of this block.
        out_channels (int): Output channels of this block.
        expansion (int, optional): The expansion for BasicBlock/Bottleneck.
            If not specified, it will firstly be obtained via
            ``block.expansion``. If the block has no attribute "expansion",
            the following default values will be used: 1 for BasicBlock and
            4 for Bottleneck. Default: None.
        stride (int): stride of the first block. Default: 1.
        avg_down (bool): Use AvgPool instead of stride conv when
            downsampling in the bottleneck. Default: False
        conv_cfg (dict, optional): dictionary to construct and config conv
            layer. Default: None
        norm_cfg (dict): dictionary to construct and config norm layer.
            Default: dict(type='BN')
    """

    def __init__(self,
                 block,
                 num_blocks,
                 in_channels,
                 out_channels,
                 expansion=None,
                 stride=1,
                 avg_down=False,
                 conv_cfg=None,
                 norm_cfg=dict(type='BN'),
                 **kwargs):
        self.block = block
        self.expansion = get_expansion(block, expansion)

        downsample = None
        if stride != 1 or in_channels != out_channels:
            downsample = []
            conv_stride = stride
            if avg_down and stride != 1:
                conv_stride = 1
                downsample.append(
                    nn.AvgPool2d(
                        kernel_size=stride,
                        stride=stride,
                        ceil_mode=True,
                        count_include_pad=False))
            downsample.extend([
                build_conv_layer(
                    conv_cfg,
                    in_channels,
                    out_channels,
                    kernel_size=1,
                    stride=conv_stride,
                    bias=False),
                build_norm_layer(norm_cfg, out_channels)[1]
            ])
            downsample = nn.Sequential(*downsample)

        layers = []
        layers.append(
            block(
                in_channels=in_channels,
                out_channels=out_channels,
                expansion=self.expansion,
                stride=stride,
                downsample=downsample,
                conv_cfg=conv_cfg,
                norm_cfg=norm_cfg,
                **kwargs))
        in_channels = out_channels
        for i in range(1, num_blocks):
            layers.append(
                block(
                    in_channels=in_channels,
                    out_channels=out_channels,
                    expansion=self.expansion,
                    stride=1,
                    conv_cfg=conv_cfg,
                    norm_cfg=norm_cfg,
                    **kwargs))
        super(ResLayer, self).__init__(*layers)


@BACKBONES.register_module()
class ResNet(BaseBackbone):
    """ResNet backbone.

    Please refer to the `paper <https://arxiv.org/abs/1512.03385>`__ for
    details.

    Args:
        depth (int): Network depth, from {18, 34, 50, 101, 152}.
        in_channels (int): Number of input image channels. Default: 3.
        stem_channels (int): Output channels of the stem layer. Default: 64.
        base_channels (int): Middle channels of the first stage. Default: 64.
        num_stages (int): Stages of the network. Default: 4.
        strides (Sequence[int]): Strides of the first block of each stage.
            Default: ``(1, 2, 2, 2)``.
        dilations (Sequence[int]): Dilation of each stage.
            Default: ``(1, 1, 1, 1)``.
        out_indices (Sequence[int]): Output from which stages.
            Default: ``(3, )``.
        style (str): `pytorch` or `caffe`. If set to "pytorch", the stride-two
            layer is the 3x3 conv layer, otherwise the stride-two layer is
            the first 1x1 conv layer.
        deep_stem (bool): Replace 7x7 conv in input stem with 3 3x3 conv.
            Default: False.
        avg_down (bool): Use AvgPool instead of stride conv when
            downsampling in the bottleneck. Default: False.
        frozen_stages (int): Stages to be frozen (stop grad and set eval mode).
            -1 means not freezing any parameters. Default: -1.
        conv_cfg (dict | None): The config dict for conv layers. Default: None.
        norm_cfg (dict): The config dict for norm layers.
        norm_eval (bool): Whether to set norm layers to eval mode, namely,
            freeze running stats (mean and var). Note: Effect on Batch Norm
            and its variants only. Default: False.
        with_cp (bool): Use checkpoint or not. Using checkpoint will save some
            memory while slowing down the training speed. Default: False.
        zero_init_residual (bool): Whether to use zero init for last norm layer
            in resblocks to let them behave as identity. Default: True.

    Example:
        >>> from mmcls.models import ResNet
        >>> import torch
        >>> self = ResNet(depth=18)
        >>> self.eval()
        >>> inputs = torch.rand(1, 3, 32, 32)
        >>> level_outputs = self.forward(inputs)
        >>> for level_out in level_outputs:
        ...     print(tuple(level_out.shape))
        (1, 64, 8, 8)
        (1, 128, 4, 4)
        (1, 256, 2, 2)
        (1, 512, 1, 1)
    """

    arch_settings = {
        18: (BasicBlock, (2, 2, 2, 2)),
        34: (BasicBlock, (3, 4, 6, 3)),
        50: (Bottleneck, (3, 4, 6, 3)),
        101: (Bottleneck, (3, 4, 23, 3)),
        152: (Bottleneck, (3, 8, 36, 3))
    }

    def __init__(self,
                 depth,
                 in_channels=3,
                 stem_channels=64,
                 base_channels=64,
                 expansion=None,
                 num_stages=4,
                 strides=(1, 2, 2, 2),
                 dilations=(1, 1, 1, 1),
                 out_indices=(3, ),
                 style='pytorch',
                 deep_stem=False,
                 avg_down=False,
                 frozen_stages=-1,
                 conv_cfg=None,
                 norm_cfg=dict(type='BN', requires_grad=True),
                 norm_eval=False,
                 with_cp=False,
                 zero_init_residual=True,
                 init_cfg=[
                     dict(type='Kaiming', layer=['Conv2d']),
                     dict(
                         type='Constant',
                         val=1,
                         layer=['_BatchNorm', 'GroupNorm'])
                 ],
                 drop_path_rate=0.0):
        super(ResNet, self).__init__(init_cfg)
        if depth not in self.arch_settings:
            raise KeyError(f'invalid depth {depth} for resnet')
        self.depth = depth
        self.stem_channels = stem_channels
        self.base_channels = base_channels
        self.num_stages = num_stages
        assert num_stages >= 1 and num_stages <= 4
        self.strides = strides
        self.dilations = dilations
        assert len(strides) == len(dilations) == num_stages
        self.out_indices = out_indices
        assert max(out_indices) < num_stages
        self.style = style
        self.deep_stem = deep_stem
        self.avg_down = avg_down
        self.frozen_stages = frozen_stages
        self.conv_cfg = conv_cfg
        self.norm_cfg = norm_cfg
        self.with_cp = with_cp
        self.norm_eval = norm_eval
        self.zero_init_residual = zero_init_residual
        self.block, stage_blocks = self.arch_settings[depth]
        self.stage_blocks = stage_blocks[:num_stages]
        self.expansion = get_expansion(self.block, expansion)

        self._make_stem_layer(in_channels, stem_channels)

        self.res_layers = []
        _in_channels = stem_channels
        _out_channels = base_channels * self.expansion
        for i, num_blocks in enumerate(self.stage_blocks):
            stride = strides[i]
            dilation = dilations[i]
            res_layer = self.make_res_layer(
                block=self.block,
                num_blocks=num_blocks,
                in_channels=_in_channels,
                out_channels=_out_channels,
                expansion=self.expansion,
                stride=stride,
                dilation=dilation,
                style=self.style,
                avg_down=self.avg_down,
                with_cp=with_cp,
                conv_cfg=conv_cfg,
                norm_cfg=norm_cfg,
                drop_path_rate=drop_path_rate)
            _in_channels = _out_channels
            _out_channels *= 2
            layer_name = f'layer{i + 1}'
            self.add_module(layer_name, res_layer)
            self.res_layers.append(layer_name)

        self._freeze_stages()

        self.feat_dim = res_layer[-1].out_channels

    def make_res_layer(self, **kwargs):
        return ResLayer(**kwargs)

    @property
    def norm1(self):
        return getattr(self, self.norm1_name)

    def _make_stem_layer(self, in_channels, stem_channels):
        if self.deep_stem:
            self.stem = nn.Sequential(
                ConvModule(
                    in_channels,
                    stem_channels // 2,
                    kernel_size=3,
                    stride=2,
                    padding=1,
                    conv_cfg=self.conv_cfg,
                    norm_cfg=self.norm_cfg,
                    inplace=True),
                ConvModule(
                    stem_channels // 2,
                    stem_channels // 2,
                    kernel_size=3,
                    stride=1,
                    padding=1,
                    conv_cfg=self.conv_cfg,
                    norm_cfg=self.norm_cfg,
                    inplace=True),
                ConvModule(
                    stem_channels // 2,
                    stem_channels,
                    kernel_size=3,
                    stride=1,
                    padding=1,
                    conv_cfg=self.conv_cfg,
                    norm_cfg=self.norm_cfg,
                    inplace=True))
        else:
            self.conv1 = build_conv_layer(
                self.conv_cfg,
                in_channels,
                stem_channels,
                kernel_size=7,
                stride=2,
                padding=3,
                bias=False)
            self.norm1_name, norm1 = build_norm_layer(
                self.norm_cfg, stem_channels, postfix=1)
            self.add_module(self.norm1_name, norm1)
            self.relu = nn.ReLU(inplace=True)
        self.maxpool = nn.MaxPool2d(kernel_size=3, stride=2, padding=1)

    def _freeze_stages(self):
        if self.frozen_stages >= 0:
            if self.deep_stem:
                self.stem.eval()
                for param in self.stem.parameters():
                    param.requires_grad = False
            else:
                self.norm1.eval()
                for m in [self.conv1, self.norm1]:
                    for param in m.parameters():
                        param.requires_grad = False

        for i in range(1, self.frozen_stages + 1):
            m = getattr(self, f'layer{i}')
            m.eval()
            for param in m.parameters():
                param.requires_grad = False

    def init_weights(self):
        super(ResNet, self).init_weights()

        if (isinstance(self.init_cfg, dict)
                and self.init_cfg['type'] == 'Pretrained'):
            # Suppress zero_init_residual if use pretrained model.
            return

        if self.zero_init_residual:
            for m in self.modules():
                if isinstance(m, Bottleneck):
                    constant_init(m.norm3, 0)
                elif isinstance(m, BasicBlock):
                    constant_init(m.norm2, 0)

    def forward(self, x):
        if self.deep_stem:
            x = self.stem(x)
        else:
            x = self.conv1(x)
            x = self.norm1(x)
            x = self.relu(x)
        x = self.maxpool(x)
        outs = []
        for i, layer_name in enumerate(self.res_layers):
            res_layer = getattr(self, layer_name)
            x = res_layer(x)
            if i in self.out_indices:
                outs.append(x)
        return tuple(outs)

    def train(self, mode=True):
        super(ResNet, self).train(mode)
        self._freeze_stages()
        if mode and self.norm_eval:
            for m in self.modules():
                # trick: eval have effect on BatchNorm only
                if isinstance(m, _BatchNorm):
                    m.eval()


@BACKBONES.register_module()
class ResNetV1c(ResNet):
    """ResNetV1c backbone.

    This variant is described in `Bag of Tricks.
    <https://arxiv.org/pdf/1812.01187.pdf>`_.

    Compared with default ResNet(ResNetV1b), ResNetV1c replaces the 7x7 conv
    in the input stem with three 3x3 convs.
    """

    def __init__(self, **kwargs):
        super(ResNetV1c, self).__init__(
            deep_stem=True, avg_down=False, **kwargs)


@BACKBONES.register_module()
class ResNetV1d(ResNet):
    """ResNetV1d backbone.

    This variant is described in `Bag of Tricks.
    <https://arxiv.org/pdf/1812.01187.pdf>`_.

    Compared with default ResNet(ResNetV1b), ResNetV1d replaces the 7x7 conv in
    the input stem with three 3x3 convs. And in the downsampling block, a 2x2
    avg_pool with stride 2 is added before conv, whose stride is changed to 1.
    """

    def __init__(self, **kwargs):
        super(ResNetV1d, self).__init__(
            deep_stem=True, avg_down=True, **kwargs)


================================================
FILE: classification-NO-activation-function/backbones/pinet_norelu.py
================================================
# Copyright (c) OpenMMLab. All rights reserved.

import torch.nn as nn
import torch.utils.checkpoint as cp
from mmcv.cnn import (ConvModule, build_activation_layer, build_conv_layer,
                      build_norm_layer, constant_init)
from mmcv.cnn.bricks import DropPath
from mmcv.runner import BaseModule
from mmcv.utils.parrots_wrapper import _BatchNorm

from ..builder import BACKBONES
from .base_backbone import BaseBackbone

eps = 1.0e-5


class BasicBlock(BaseModule):
    """BasicBlock for ResNet.

    Args:
        in_channels (int): Input channels of this block.
        out_channels (int): Output channels of this block.
        expansion (int): The ratio of ``out_channels/mid_channels`` where
            ``mid_channels`` is the output channels of conv1. This is a
            reserved argument in BasicBlock and should always be 1. Default: 1.
        stride (int): stride of the block. Default: 1
        dilation (int): dilation of convolution. Default: 1
        downsample (nn.Module, optional): downsample operation on identity
            branch. Default: None.
        style (str): `pytorch` or `caffe`. It is unused and reserved for
            unified API with Bottleneck.
        with_cp (bool): Use checkpoint or not. Using checkpoint will save some
            memory while slowing down the training speed.
        conv_cfg (dict, optional): dictionary to construct and config conv
            layer. Default: None
        norm_cfg (dict): dictionary to construct and config norm layer.
            Default: dict(type='BN')
    """

    def __init__(self,
                 in_channels,
                 out_channels,
                 expansion=1,
                 stride=1,
                 dilation=1,
                 downsample=None,
                 style='pytorch',
                 with_cp=False,
                 conv_cfg=None,
                 norm_cfg=dict(type='BN'),
                 drop_path_rate=0.0,
                 act_cfg=dict(type='ReLU', inplace=True),
                 init_cfg=None):
        super(BasicBlock, self).__init__(init_cfg=init_cfg)
        self.in_channels = in_channels
        self.out_channels = out_channels
        self.expansion = expansion
        assert self.expansion == 1
        assert out_channels % expansion == 0
        self.mid_channels = out_channels // expansion
        self.stride = stride
        self.dilation = dilation
        self.style = style
        self.with_cp = with_cp
        self.conv_cfg = conv_cfg
        self.norm_cfg = norm_cfg

        self.norm1_name, norm1 = build_norm_layer(
            norm_cfg, self.mid_channels, postfix=1)
        self.norm2_name, norm2 = build_norm_layer(
            norm_cfg, out_channels, postfix=2)
        self.norm3_name, norm3 = build_norm_layer(
            norm_cfg, out_channels, postfix=3)

        self.conv1 = build_conv_layer(
            conv_cfg,
            in_channels,
            self.mid_channels,
            3,
            stride=stride,
            padding=dilation,
            dilation=dilation,
            bias=False)
        self.add_module(self.norm1_name, norm1)
        self.conv2 = build_conv_layer(
            conv_cfg,
            self.mid_channels,
            out_channels,
            3,
            padding=1,
            bias=False)
        self.add_module(self.norm2_name, norm2)
#         self.conv3 = build_conv_layer(
#             conv_cfg,
#             self.mid_channels,
#             out_channels,
#             kernel_size=1,
#             bias=False)
        self.add_module(self.norm3_name, norm3)

#         self.relu = build_activation_layer(act_cfg)
        self.downsample = downsample
#         self.drop_path = DropPath(drop_prob=drop_path_rate
#                                   ) if drop_path_rate > eps else nn.Identity()

    @property
    def norm1(self):
        return getattr(self, self.norm1_name)

    @property
    def norm2(self):
        return getattr(self, self.norm2_name)
    
    @property
    def norm3(self):
        return getattr(self, self.norm3_name)

    def forward(self, x):

        def _inner_forward(x):
            identity = x

            out = self.conv1(x)
            out = self.norm1(out)
#             out = self.relu(out)

            out = self.conv2(out)
            out = self.norm2(out)

            if self.downsample is not None:
                identity = self.downsample(x)
#             out = self.drop_path(out)
               
#             second = self.conv3(out*identity)
            second = out*identity
            out = out + identity + self.norm3(second)
                



            return out

        if self.with_cp and x.requires_grad:
            out = cp.checkpoint(_inner_forward, x)
        else:
            out = _inner_forward(x)

#         out = self.relu(out)

        return out


class Bottleneck(BaseModule):
    """Bottleneck block for ResNet.

    Args:
        in_channels (int): Input channels of this block.
        out_channels (int): Output channels of this block.
        expansion (int): The ratio of ``out_channels/mid_channels`` where
            ``mid_channels`` is the input/output channels of conv2. Default: 4.
        stride (int): stride of the block. Default: 1
        dilation (int): dilation of convolution. Default: 1
        downsample (nn.Module, optional): downsample operation on identity
            branch. Default: None.
        style (str): ``"pytorch"`` or ``"caffe"``. If set to "pytorch", the
            stride-two layer is the 3x3 conv layer, otherwise the stride-two
            layer is the first 1x1 conv layer. Default: "pytorch".
        with_cp (bool): Use checkpoint or not. Using checkpoint will save some
            memory while slowing down the training speed.
        conv_cfg (dict, optional): dictionary to construct and config conv
            layer. Default: None
        norm_cfg (dict): dictionary to construct and config norm layer.
            Default: dict(type='BN')
    """

    def __init__(self,
                 in_channels,
                 out_channels,
                 expansion=4,
                 stride=1,
                 dilation=1,
                 downsample=None,
                 style='pytorch',
                 with_cp=False,
                 conv_cfg=None,
                 norm_cfg=dict(type='BN'),
                 act_cfg=dict(type='ReLU', inplace=True),
                 drop_path_rate=0.0,
                 init_cfg=None):
        super(Bottleneck, self).__init__(init_cfg=init_cfg)
        assert style in ['pytorch', 'caffe']

        self.in_channels = in_channels
        self.out_channels = out_channels
        self.expansion = expansion
        assert out_channels % expansion == 0
        self.mid_channels = out_channels // expansion
        self.stride = stride
        self.dilation = dilation
        self.style = style
        self.with_cp = with_cp
        self.conv_cfg = conv_cfg
        self.norm_cfg = norm_cfg

        if self.style == 'pytorch':
            self.conv1_stride = 1
            self.conv2_stride = stride
        else:
            self.conv1_stride = stride
            self.conv2_stride = 1

        self.norm1_name, norm1 = build_norm_layer(
            norm_cfg, self.mid_channels, postfix=1)
        self.norm2_name, norm2 = build_norm_layer(
            norm_cfg, self.mid_channels, postfix=2)
        self.norm3_name, norm3 = build_norm_layer(
            norm_cfg, out_channels, postfix=3)

        self.conv1 = build_conv_layer(
            conv_cfg,
            in_channels,
            self.mid_channels,
            kernel_size=1,
            stride=self.conv1_stride,
            bias=False)
        self.add_module(self.norm1_name, norm1)
        self.conv2 = build_conv_layer(
            conv_cfg,
            self.mid_channels,
            self.mid_channels,
            kernel_size=3,
            stride=self.conv2_stride,
            padding=dilation,
            dilation=dilation,
            bias=False)

        self.add_module(self.norm2_name, norm2)
        self.conv3 = build_conv_layer(
            conv_cfg,
            self.mid_channels,
            out_channels,
            kernel_size=1,
            bias=False)
        self.add_module(self.norm3_name, norm3)

        self.relu = build_activation_layer(act_cfg)
        self.downsample = downsample
        self.drop_path = DropPath(drop_prob=drop_path_rate
                                  ) if drop_path_rate > eps else nn.Identity()

    @property
    def norm1(self):
        return getattr(self, self.norm1_name)

    @property
    def norm2(self):
        return getattr(self, self.norm2_name)

    @property
    def norm3(self):
        return getattr(self, self.norm3_name)

    def forward(self, x):

        def _inner_forward(x):
            identity = x

            out = self.conv1(x)
            out = self.norm1(out)
            out = self.relu(out)

            out = self.conv2(out)
            out = self.norm2(out)
            out = self.relu(out)

            out = self.conv3(out)
            out = self.norm3(out)

            if self.downsample is not None:
                identity = self.downsample(x)

            out = self.drop_path(out)

            out += identity

            return out

        if self.with_cp and x.requires_grad:
            out = cp.checkpoint(_inner_forward, x)
        else:
            out = _inner_forward(x)

        out = self.relu(out)

        return out


def get_expansion(block, expansion=None):
    """Get the expansion of a residual block.

    The block expansion will be obtained by the following order:

    1. If ``expansion`` is given, just return it.
    2. If ``block`` has the attribute ``expansion``, then return
       ``block.expansion``.
    3. Return the default value according the the block type:
       1 for ``BasicBlock`` and 4 for ``Bottleneck``.

    Args:
        block (class): The block class.
        expansion (int | None): The given expansion ratio.

    Returns:
        int: The expansion of the block.
    """
    if isinstance(expansion, int):
        assert expansion > 0
    elif expansion is None:
        if hasattr(block, 'expansion'):
            expansion = block.expansion
        elif issubclass(block, BasicBlock):
            expansion = 1
        elif issubclass(block, Bottleneck):
            expansion = 4
        else:
            raise TypeError(f'expansion is not specified for {block.__name__}')
    else:
        raise TypeError('expansion must be an integer or None')

    return expansion


class ResLayer(nn.Sequential):
    """ResLayer to build ResNet style backbone.

    Args:
        block (nn.Module): Residual block used to build ResLayer.
        num_blocks (int): Number of blocks.
        in_channels (int): Input channels of this block.
        out_channels (int): Output channels of this block.
        expansion (int, optional): The expansion for BasicBlock/Bottleneck.
            If not specified, it will firstly be obtained via
            ``block.expansion``. If the block has no attribute "expansion",
            the following default values will be used: 1 for BasicBlock and
            4 for Bottleneck. Default: None.
        stride (int): stride of the first block. Default: 1.
        avg_down (bool): Use AvgPool instead of stride conv when
            downsampling in the bottleneck. Default: False
        conv_cfg (dict, optional): dictionary to construct and config conv
            layer. Default: None
        norm_cfg (dict): dictionary to construct and config norm layer.
            Default: dict(type='BN')
    """

    def __init__(self,
                 block,
                 num_blocks,
                 in_channels,
                 out_channels,
                 expansion=None,
                 stride=1,
                 avg_down=False,
                 conv_cfg=None,
                 norm_cfg=dict(type='BN'),
                 **kwargs):
        self.block = block
        self.expansion = get_expansion(block, expansion)

        downsample = None
        if stride != 1 or in_channels != out_channels:
            downsample = []
            conv_stride = stride
            if avg_down and stride != 1:
                conv_stride = 1
                downsample.append(
                    nn.AvgPool2d(
                        kernel_size=stride,
                        stride=stride,
                        ceil_mode=True,
                        count_include_pad=False))
            downsample.extend([
                build_conv_layer(
                    conv_cfg,
                    in_channels,
                    out_channels,
                    kernel_size=1,
                    stride=conv_stride,
                    bias=False),
                build_norm_layer(norm_cfg, out_channels)[1]
            ])
            downsample = nn.Sequential(*downsample)

        layers = []
        layers.append(
            block(
                in_channels=in_channels,
                out_channels=out_channels,
                expansion=self.expansion,
                stride=stride,
                downsample=downsample,
                conv_cfg=conv_cfg,
                norm_cfg=norm_cfg,
                **kwargs))
        in_channels = out_channels
        for i in range(1, num_blocks):
            layers.append(
                block(
                    in_channels=in_channels,
                    out_channels=out_channels,
                    expansion=self.expansion,
                    stride=1,
                    conv_cfg=conv_cfg,
                    norm_cfg=norm_cfg,
                    **kwargs))
        super(ResLayer, self).__init__(*layers)


@BACKBONES.register_module()
class ResNet(BaseBackbone):
    """ResNet backbone.

    Please refer to the `paper <https://arxiv.org/abs/1512.03385>`__ for
    details.

    Args:
        depth (int): Network depth, from {18, 34, 50, 101, 152}.
        in_channels (int): Number of input image channels. Default: 3.
        stem_channels (int): Output channels of the stem layer. Default: 64.
        base_channels (int): Middle channels of the first stage. Default: 64.
        num_stages (int): Stages of the network. Default: 4.
        strides (Sequence[int]): Strides of the first block of each stage.
            Default: ``(1, 2, 2, 2)``.
        dilations (Sequence[int]): Dilation of each stage.
            Default: ``(1, 1, 1, 1)``.
        out_indices (Sequence[int]): Output from which stages.
            Default: ``(3, )``.
        style (str): `pytorch` or `caffe`. If set to "pytorch", the stride-two
            layer is the 3x3 conv layer, otherwise the stride-two layer is
            the first 1x1 conv layer.
        deep_stem (bool): Replace 7x7 conv in input stem with 3 3x3 conv.
            Default: False.
        avg_down (bool): Use AvgPool instead of stride conv when
            downsampling in the bottleneck. Default: False.
        frozen_stages (int): Stages to be frozen (stop grad and set eval mode).
            -1 means not freezing any parameters. Default: -1.
        conv_cfg (dict | None): The config dict for conv layers. Default: None.
        norm_cfg (dict): The config dict for norm layers.
        norm_eval (bool): Whether to set norm layers to eval mode, namely,
            freeze running stats (mean and var). Note: Effect on Batch Norm
            and its variants only. Default: False.
        with_cp (bool): Use checkpoint or not. Using checkpoint will save some
            memory while slowing down the training speed. Default: False.
        zero_init_residual (bool): Whether to use zero init for last norm layer
            in resblocks to let them behave as identity. Default: True.

    Example:
        >>> from mmcls.models import ResNet
        >>> import torch
        >>> self = ResNet(depth=18)
        >>> self.eval()
        >>> inputs = torch.rand(1, 3, 32, 32)
        >>> level_outputs = self.forward(inputs)
        >>> for level_out in level_outputs:
        ...     print(tuple(level_out.shape))
        (1, 64, 8, 8)
        (1, 128, 4, 4)
        (1, 256, 2, 2)
        (1, 512, 1, 1)
    """

    arch_settings = {
        18: (BasicBlock, (2, 2, 2, 2)),
        34: (BasicBlock, (3, 4, 6, 3)),
        50: (Bottleneck, (3, 4, 6, 3)),
        101: (Bottleneck, (3, 4, 23, 3)),
        152: (Bottleneck, (3, 8, 36, 3))
    }

    def __init__(self,
                 depth,
                 in_channels=3,
                 stem_channels=64,
                 base_channels=64,
                 expansion=None,
                 num_stages=4,
                 strides=(1, 2, 2, 2),
                 dilations=(1, 1, 1, 1),
                 out_indices=(3, ),
                 style='pytorch',
                 deep_stem=False,
                 avg_down=False,
                 frozen_stages=-1,
                 conv_cfg=None,
                 norm_cfg=dict(type='BN', requires_grad=True),
                 norm_eval=False,
                 with_cp=False,
                 zero_init_residual=True,
                 init_cfg=[
                     dict(type='Kaiming', layer=['Conv2d']),
                     dict(
                         type='Constant',
                         val=1,
                         layer=['_BatchNorm', 'GroupNorm'])
                 ],
                 drop_path_rate=0.0):
        super(ResNet, self).__init__(init_cfg)
        if depth not in self.arch_settings:
            raise KeyError(f'invalid depth {depth} for resnet')
        self.depth = depth
        self.stem_channels = stem_channels
        self.base_channels = base_channels
        self.num_stages = num_stages
        assert num_stages >= 1 and num_stages <= 4
        self.strides = strides
        self.dilations = dilations
        assert len(strides) == len(dilations) == num_stages
        self.out_indices = out_indices
        assert max(out_indices) < num_stages
        self.style = style
        self.deep_stem = deep_stem
        self.avg_down = avg_down
        self.frozen_stages = frozen_stages
        self.conv_cfg = conv_cfg
        self.norm_cfg = norm_cfg
        self.with_cp = with_cp
        self.norm_eval = norm_eval
        self.zero_init_residual = zero_init_residual
        self.block, stage_blocks = self.arch_settings[depth]
        self.stage_blocks = stage_blocks[:num_stages]
        self.expansion = get_expansion(self.block, expansion)

        self._make_stem_layer(in_channels, stem_channels)

        self.res_layers = []
        _in_channels = stem_channels
        _out_channels = base_channels * self.expansion
        for i, num_blocks in enumerate(self.stage_blocks):
            stride = strides[i]
            dilation = dilations[i]
            res_layer = self.make_res_layer(
                block=self.block,
                num_blocks=num_blocks,
                in_channels=_in_channels,
                out_channels=_out_channels,
                expansion=self.expansion,
                stride=stride,
                dilation=dilation,
                style=self.style,
                avg_down=self.avg_down,
                with_cp=with_cp,
                conv_cfg=conv_cfg,
                norm_cfg=norm_cfg,
                drop_path_rate=drop_path_rate)
            _in_channels = _out_channels
            _out_channels *= 2
            layer_name = f'layer{i + 1}'
            self.add_module(layer_name, res_layer)
            self.res_layers.append(layer_name)

        self._freeze_stages()

        self.feat_dim = res_layer[-1].out_channels

    def make_res_layer(self, **kwargs):
        return ResLayer(**kwargs)

    @property
    def norm1(self):
        return getattr(self, self.norm1_name)

    def _make_stem_layer(self, in_channels, stem_channels):
        if self.deep_stem:
            self.stem = nn.Sequential(
                ConvModule(
                    in_channels,
                    stem_channels // 2,
                    kernel_size=3,
                    stride=2,
                    padding=1,
                    conv_cfg=self.conv_cfg,
                    norm_cfg=self.norm_cfg,
                    inplace=True),
                ConvModule(
                    stem_channels // 2,
                    stem_channels // 2,
                    kernel_size=3,
                    stride=1,
                    padding=1,
                    conv_cfg=self.conv_cfg,
                    norm_cfg=self.norm_cfg,
                    inplace=True),
                ConvModule(
                    stem_channels // 2,
                    stem_channels,
                    kernel_size=3,
                    stride=1,
                    padding=1,
                    conv_cfg=self.conv_cfg,
                    norm_cfg=self.norm_cfg,
                    inplace=True))
        else:
            self.conv1 = build_conv_layer(
                self.conv_cfg,
                in_channels,
                stem_channels,
                kernel_size=7,
                stride=2,
                padding=3,
                bias=False)
            self.norm1_name, norm1 = build_norm_layer(
                self.norm_cfg, stem_channels, postfix=1)
            self.add_module(self.norm1_name, norm1)
#             self.relu = nn.ReLU(inplace=True)
        self.maxpool = nn.MaxPool2d(kernel_size=3, stride=2, padding=1)

    def _freeze_stages(self):
        if self.frozen_stages >= 0:
            if self.deep_stem:
                self.stem.eval()
                for param in self.stem.parameters():
                    param.requires_grad = False
            else:
                self.norm1.eval()
                for m in [self.conv1, self.norm1]:
                    for param in m.parameters():
                        param.requires_grad = False

        for i in range(1, self.frozen_stages + 1):
            m = getattr(self, f'layer{i}')
            m.eval()
            for param in m.parameters():
                param.requires_grad = False

    def init_weights(self):
        super(ResNet, self).init_weights()

        if (isinstance(self.init_cfg, dict)
                and self.init_cfg['type'] == 'Pretrained'):
            # Suppress zero_init_residual if use pretrained model.
            return

        if self.zero_init_residual:
            for m in self.modules():
                if isinstance(m, Bottleneck):
                    constant_init(m.norm3, 0)
                elif isinstance(m, BasicBlock):
                    constant_init(m.norm2, 0)

    def forward(self, x):
        if self.deep_stem:
            x = self.stem(x)
        else:
            x = self.conv1(x)
            x = self.norm1(x)
#             x = self.relu(x)
        x = self.maxpool(x)
        outs = []
        for i, layer_name in enumerate(self.res_layers):
            res_layer = getattr(self, layer_name)
            x = res_layer(x)
            if i in self.out_indices:
                outs.append(x)
        return tuple(outs)

    def train(self, mode=True):
        super(ResNet, self).train(mode)
        self._freeze_stages()
        if mode and self.norm_eval:
            for m in self.modules():
                # trick: eval have effect on BatchNorm only
                if isinstance(m, _BatchNorm):
                    m.eval()


@BACKBONES.register_module()
class ResNetV1c(ResNet):
    """ResNetV1c backbone.

    This variant is described in `Bag of Tricks.
    <https://arxiv.org/pdf/1812.01187.pdf>`_.

    Compared with default ResNet(ResNetV1b), ResNetV1c replaces the 7x7 conv
    in the input stem with three 3x3 convs.
    """

    def __init__(self, **kwargs):
        super(ResNetV1c, self).__init__(
            deep_stem=True, avg_down=False, **kwargs)


@BACKBONES.register_module()
class ResNetV1d(ResNet):
    """ResNetV1d backbone.

    This variant is described in `Bag of Tricks.
    <https://arxiv.org/pdf/1812.01187.pdf>`_.

    Compared with default ResNet(ResNetV1b), ResNetV1d replaces the 7x7 conv in
    the input stem with three 3x3 convs. And in the downsampling block, a 2x2
    avg_pool with stride 2 is added before conv, whose stride is changed to 1.
    """

    def __init__(self, **kwargs):
        super(ResNetV1d, self).__init__(
            deep_stem=True, avg_down=True, **kwargs)


================================================
FILE: classification-NO-activation-function/backbones/pinet_relu.py
================================================
# Copyright (c) OpenMMLab. All rights reserved.

import torch.nn as nn
import torch.utils.checkpoint as cp
from mmcv.cnn import (ConvModule, build_activation_layer, build_conv_layer,
                      build_norm_layer, constant_init)
from mmcv.cnn.bricks import DropPath
from mmcv.runner import BaseModule
from mmcv.utils.parrots_wrapper import _BatchNorm

from ..builder import BACKBONES
from .base_backbone import BaseBackbone

eps = 1.0e-5


class BasicBlock(BaseModule):
    """BasicBlock for ResNet.

    Args:
        in_channels (int): Input channels of this block.
        out_channels (int): Output channels of this block.
        expansion (int): The ratio of ``out_channels/mid_channels`` where
            ``mid_channels`` is the output channels of conv1. This is a
            reserved argument in BasicBlock and should always be 1. Default: 1.
        stride (int): stride of the block. Default: 1
        dilation (int): dilation of convolution. Default: 1
        downsample (nn.Module, optional): downsample operation on identity
            branch. Default: None.
        style (str): `pytorch` or `caffe`. It is unused and reserved for
            unified API with Bottleneck.
        with_cp (bool): Use checkpoint or not. Using checkpoint will save some
            memory while slowing down the training speed.
        conv_cfg (dict, optional): dictionary to construct and config conv
            layer. Default: None
        norm_cfg (dict): dictionary to construct and config norm layer.
            Default: dict(type='BN')
    """

    def __init__(self,
                 in_channels,
                 out_channels,
                 expansion=1,
                 stride=1,
                 dilation=1,
                 downsample=None,
                 style='pytorch',
                 with_cp=False,
                 conv_cfg=None,
                 norm_cfg=dict(type='BN'),
                 drop_path_rate=0.0,
                 act_cfg=dict(type='ReLU', inplace=True),
                 init_cfg=None):
        super(BasicBlock, self).__init__(init_cfg=init_cfg)
        self.in_channels = in_channels
        self.out_channels = out_channels
        self.expansion = expansion
        assert self.expansion == 1
        assert out_channels % expansion == 0
        self.mid_channels = out_channels // expansion
        self.stride = stride
        self.dilation = dilation
        self.style = style
        self.with_cp = with_cp
        self.conv_cfg = conv_cfg
        self.norm_cfg = norm_cfg

        self.norm1_name, norm1 = build_norm_layer(
            norm_cfg, self.mid_channels, postfix=1)
        self.norm2_name, norm2 = build_norm_layer(
            norm_cfg, out_channels, postfix=2)
        self.norm3_name, norm3 = build_norm_layer(
            norm_cfg, out_channels, postfix=3)

        self.conv1 = build_conv_layer(
            conv_cfg,
            in_channels,
            self.mid_channels,
            3,
            stride=stride,
            padding=dilation,
            dilation=dilation,
            bias=False)
        self.add_module(self.norm1_name, norm1)
        self.conv2 = build_conv_layer(
            conv_cfg,
            self.mid_channels,
            out_channels,
            3,
            padding=1,
            bias=False)
        self.add_module(self.norm2_name, norm2)
#         self.conv3 = build_conv_layer(
#             conv_cfg,
#             self.mid_channels,
#             out_channels,
#             kernel_size=1,
#             bias=False)
        self.add_module(self.norm3_name, norm3)

        self.relu = build_activation_layer(act_cfg)
        self.downsample = downsample
#         self.drop_path = DropPath(drop_prob=drop_path_rate
#                                   ) if drop_path_rate > eps else nn.Identity()

    @property
    def norm1(self):
        return getattr(self, self.norm1_name)

    @property
    def norm2(self):
        return getattr(self, self.norm2_name)
    
    @property
    def norm3(self):
        return getattr(self, self.norm3_name)

    def forward(self, x):

        def _inner_forward(x):
            identity = x

            out = self.conv1(x)
            out = self.norm1(out)
            out = self.relu(out)

            out = self.conv2(out)
            out = self.norm2(out)

            if self.downsample is not None:
                identity = self.downsample(x)
#             out = self.drop_path(out)
               
#             second = self.conv3(out*identity)
            second = out*identity
            out = out + identity + self.norm3(second)
                



            return out

        if self.with_cp and x.requires_grad:
            out = cp.checkpoint(_inner_forward, x)
        else:
            out = _inner_forward(x)

        out = self.relu(out)

        return out


class Bottleneck(BaseModule):
    """Bottleneck block for ResNet.

    Args:
        in_channels (int): Input channels of this block.
        out_channels (int): Output channels of this block.
        expansion (int): The ratio of ``out_channels/mid_channels`` where
            ``mid_channels`` is the input/output channels of conv2. Default: 4.
        stride (int): stride of the block. Default: 1
        dilation (int): dilation of convolution. Default: 1
        downsample (nn.Module, optional): downsample operation on identity
            branch. Default: None.
        style (str): ``"pytorch"`` or ``"caffe"``. If set to "pytorch", the
            stride-two layer is the 3x3 conv layer, otherwise the stride-two
            layer is the first 1x1 conv layer. Default: "pytorch".
        with_cp (bool): Use checkpoint or not. Using checkpoint will save some
            memory while slowing down the training speed.
        conv_cfg (dict, optional): dictionary to construct and config conv
            layer. Default: None
        norm_cfg (dict): dictionary to construct and config norm layer.
            Default: dict(type='BN')
    """

    def __init__(self,
                 in_channels,
                 out_channels,
                 expansion=4,
                 stride=1,
                 dilation=1,
                 downsample=None,
                 style='pytorch',
                 with_cp=False,
                 conv_cfg=None,
                 norm_cfg=dict(type='BN'),
                 act_cfg=dict(type='ReLU', inplace=True),
                 drop_path_rate=0.0,
                 init_cfg=None):
        super(Bottleneck, self).__init__(init_cfg=init_cfg)
        assert style in ['pytorch', 'caffe']

        self.in_channels = in_channels
        self.out_channels = out_channels
        self.expansion = expansion
        assert out_channels % expansion == 0
        self.mid_channels = out_channels // expansion
        self.stride = stride
        self.dilation = dilation
        self.style = style
        self.with_cp = with_cp
        self.conv_cfg = conv_cfg
        self.norm_cfg = norm_cfg

        if self.style == 'pytorch':
            self.conv1_stride = 1
            self.conv2_stride = stride
        else:
            self.conv1_stride = stride
            self.conv2_stride = 1

        self.norm1_name, norm1 = build_norm_layer(
            norm_cfg, self.mid_channels, postfix=1)
        self.norm2_name, norm2 = build_norm_layer(
            norm_cfg, self.mid_channels, postfix=2)
        self.norm3_name, norm3 = build_norm_layer(
            norm_cfg, out_channels, postfix=3)

        self.conv1 = build_conv_layer(
            conv_cfg,
            in_channels,
            self.mid_channels,
            kernel_size=1,
            stride=self.conv1_stride,
            bias=False)
        self.add_module(self.norm1_name, norm1)
        self.conv2 = build_conv_layer(
            conv_cfg,
            self.mid_channels,
            self.mid_channels,
            kernel_size=3,
            stride=self.conv2_stride,
            padding=dilation,
            dilation=dilation,
            bias=False)

        self.add_module(self.norm2_name, norm2)
        self.conv3 = build_conv_layer(
            conv_cfg,
            self.mid_channels,
            out_channels,
            kernel_size=1,
            bias=False)
        self.add_module(self.norm3_name, norm3)

        self.relu = build_activation_layer(act_cfg)
        self.downsample = downsample
        self.drop_path = DropPath(drop_prob=drop_path_rate
                                  ) if drop_path_rate > eps else nn.Identity()

    @property
    def norm1(self):
        return getattr(self, self.norm1_name)

    @property
    def norm2(self):
        return getattr(self, self.norm2_name)

    @property
    def norm3(self):
        return getattr(self, self.norm3_name)

    def forward(self, x):

        def _inner_forward(x):
            identity = x

            out = self.conv1(x)
            out = self.norm1(out)
            out = self.relu(out)

            out = self.conv2(out)
            out = self.norm2(out)
            out = self.relu(out)

            out = self.conv3(out)
            out = self.norm3(out)

            if self.downsample is not None:
                identity = self.downsample(x)

            out = self.drop_path(out)

            out += identity

            return out

        if self.with_cp and x.requires_grad:
            out = cp.checkpoint(_inner_forward, x)
        else:
            out = _inner_forward(x)

        out = self.relu(out)

        return out


def get_expansion(block, expansion=None):
    """Get the expansion of a residual block.

    The block expansion will be obtained by the following order:

    1. If ``expansion`` is given, just return it.
    2. If ``block`` has the attribute ``expansion``, then return
       ``block.expansion``.
    3. Return the default value according the the block type:
       1 for ``BasicBlock`` and 4 for ``Bottleneck``.

    Args:
        block (class): The block class.
        expansion (int | None): The given expansion ratio.

    Returns:
        int: The expansion of the block.
    """
    if isinstance(expansion, int):
        assert expansion > 0
    elif expansion is None:
        if hasattr(block, 'expansion'):
            expansion = block.expansion
        elif issubclass(block, BasicBlock):
            expansion = 1
        elif issubclass(block, Bottleneck):
            expansion = 4
        else:
            raise TypeError(f'expansion is not specified for {block.__name__}')
    else:
        raise TypeError('expansion must be an integer or None')

    return expansion


class ResLayer(nn.Sequential):
    """ResLayer to build ResNet style backbone.

    Args:
        block (nn.Module): Residual block used to build ResLayer.
        num_blocks (int): Number of blocks.
        in_channels (int): Input channels of this block.
        out_channels (int): Output channels of this block.
        expansion (int, optional): The expansion for BasicBlock/Bottleneck.
            If not specified, it will firstly be obtained via
            ``block.expansion``. If the block has no attribute "expansion",
            the following default values will be used: 1 for BasicBlock and
            4 for Bottleneck. Default: None.
        stride (int): stride of the first block. Default: 1.
        avg_down (bool): Use AvgPool instead of stride conv when
            downsampling in the bottleneck. Default: False
        conv_cfg (dict, optional): dictionary to construct and config conv
            layer. Default: None
        norm_cfg (dict): dictionary to construct and config norm layer.
            Default: dict(type='BN')
    """

    def __init__(self,
                 block,
                 num_blocks,
                 in_channels,
                 out_channels,
                 expansion=None,
                 stride=1,
                 avg_down=False,
                 conv_cfg=None,
                 norm_cfg=dict(type='BN'),
                 **kwargs):
        self.block = block
        self.expansion = get_expansion(block, expansion)

        downsample = None
        if stride != 1 or in_channels != out_channels:
            downsample = []
            conv_stride = stride
            if avg_down and stride != 1:
                conv_stride = 1
                downsample.append(
                    nn.AvgPool2d(
                        kernel_size=stride,
                        stride=stride,
                        ceil_mode=True,
                        count_include_pad=False))
            downsample.extend([
                build_conv_layer(
                    conv_cfg,
                    in_channels,
                    out_channels,
                    kernel_size=1,
                    stride=conv_stride,
                    bias=False),
                build_norm_layer(norm_cfg, out_channels)[1]
            ])
            downsample = nn.Sequential(*downsample)

        layers = []
        layers.append(
            block(
                in_channels=in_channels,
                out_channels=out_channels,
                expansion=self.expansion,
                stride=stride,
                downsample=downsample,
                conv_cfg=conv_cfg,
                norm_cfg=norm_cfg,
                **kwargs))
        in_channels = out_channels
        for i in range(1, num_blocks):
            layers.append(
                block(
                    in_channels=in_channels,
                    out_channels=out_channels,
                    expansion=self.expansion,
                    stride=1,
                    conv_cfg=conv_cfg,
                    norm_cfg=norm_cfg,
                    **kwargs))
        super(ResLayer, self).__init__(*layers)


@BACKBONES.register_module()
class ResNet(BaseBackbone):
    """ResNet backbone.

    Please refer to the `paper <https://arxiv.org/abs/1512.03385>`__ for
    details.

    Args:
        depth (int): Network depth, from {18, 34, 50, 101, 152}.
        in_channels (int): Number of input image channels. Default: 3.
        stem_channels (int): Output channels of the stem layer. Default: 64.
        base_channels (int): Middle channels of the first stage. Default: 64.
        num_stages (int): Stages of the network. Default: 4.
        strides (Sequence[int]): Strides of the first block of each stage.
            Default: ``(1, 2, 2, 2)``.
        dilations (Sequence[int]): Dilation of each stage.
            Default: ``(1, 1, 1, 1)``.
        out_indices (Sequence[int]): Output from which stages.
            Default: ``(3, )``.
        style (str): `pytorch` or `caffe`. If set to "pytorch", the stride-two
            layer is the 3x3 conv layer, otherwise the stride-two layer is
            the first 1x1 conv layer.
        deep_stem (bool): Replace 7x7 conv in input stem with 3 3x3 conv.
            Default: False.
        avg_down (bool): Use AvgPool instead of stride conv when
            downsampling in the bottleneck. Default: False.
        frozen_stages (int): Stages to be frozen (stop grad and set eval mode).
            -1 means not freezing any parameters. Default: -1.
        conv_cfg (dict | None): The config dict for conv layers. Default: None.
        norm_cfg (dict): The config dict for norm layers.
        norm_eval (bool): Whether to set norm layers to eval mode, namely,
            freeze running stats (mean and var). Note: Effect on Batch Norm
            and its variants only. Default: False.
        with_cp (bool): Use checkpoint or not. Using checkpoint will save some
            memory while slowing down the training speed. Default: False.
        zero_init_residual (bool): Whether to use zero init for last norm layer
            in resblocks to let them behave as identity. Default: True.

    Example:
        >>> from mmcls.models import ResNet
        >>> import torch
        >>> self = ResNet(depth=18)
        >>> self.eval()
        >>> inputs = torch.rand(1, 3, 32, 32)
        >>> level_outputs = self.forward(inputs)
        >>> for level_out in level_outputs:
        ...     print(tuple(level_out.shape))
        (1, 64, 8, 8)
        (1, 128, 4, 4)
        (1, 256, 2, 2)
        (1, 512, 1, 1)
    """

    arch_settings = {
        18: (BasicBlock, (2, 2, 2, 2)),
        34: (BasicBlock, (3, 4, 6, 3)),
        50: (Bottleneck, (3, 4, 6, 3)),
        101: (Bottleneck, (3, 4, 23, 3)),
        152: (Bottleneck, (3, 8, 36, 3))
    }

    def __init__(self,
                 depth,
                 in_channels=3,
                 stem_channels=64,
                 base_channels=64,
                 expansion=None,
                 num_stages=4,
                 strides=(1, 2, 2, 2),
                 dilations=(1, 1, 1, 1),
                 out_indices=(3, ),
                 style='pytorch',
                 deep_stem=False,
                 avg_down=False,
                 frozen_stages=-1,
                 conv_cfg=None,
                 norm_cfg=dict(type='BN', requires_grad=True),
                 norm_eval=False,
                 with_cp=False,
                 zero_init_residual=True,
                 init_cfg=[
                     dict(type='Kaiming', layer=['Conv2d']),
                     dict(
                         type='Constant',
                         val=1,
                         layer=['_BatchNorm', 'GroupNorm'])
                 ],
                 drop_path_rate=0.0):
        super(ResNet, self).__init__(init_cfg)
        if depth not in self.arch_settings:
            raise KeyError(f'invalid depth {depth} for resnet')
        self.depth = depth
        self.stem_channels = stem_channels
        self.base_channels = base_channels
        self.num_stages = num_stages
        assert num_stages >= 1 and num_stages <= 4
        self.strides = strides
        self.dilations = dilations
        assert len(strides) == len(dilations) == num_stages
        self.out_indices = out_indices
        assert max(out_indices) < num_stages
        self.style = style
        self.deep_stem = deep_stem
        self.avg_down = avg_down
        self.frozen_stages = frozen_stages
        self.conv_cfg = conv_cfg
        self.norm_cfg = norm_cfg
        self.with_cp = with_cp
        self.norm_eval = norm_eval
        self.zero_init_residual = zero_init_residual
        self.block, stage_blocks = self.arch_settings[depth]
        self.stage_blocks = stage_blocks[:num_stages]
        self.expansion = get_expansion(self.block, expansion)

        self._make_stem_layer(in_channels, stem_channels)

        self.res_layers = []
        _in_channels = stem_channels
        _out_channels = base_channels * self.expansion
        for i, num_blocks in enumerate(self.stage_blocks):
            stride = strides[i]
            dilation = dilations[i]
            res_layer = self.make_res_layer(
                block=self.block,
                num_blocks=num_blocks,
                in_channels=_in_channels,
                out_channels=_out_channels,
                expansion=self.expansion,
                stride=stride,
                dilation=dilation,
                style=self.style,
                avg_down=self.avg_down,
                with_cp=with_cp,
                conv_cfg=conv_cfg,
                norm_cfg=norm_cfg,
                drop_path_rate=drop_path_rate)
            _in_channels = _out_channels
            _out_channels *= 2
            layer_name = f'layer{i + 1}'
            self.add_module(layer_name, res_layer)
            self.res_layers.append(layer_name)

        self._freeze_stages()

        self.feat_dim = res_layer[-1].out_channels

    def make_res_layer(self, **kwargs):
        return ResLayer(**kwargs)

    @property
    def norm1(self):
        return getattr(self, self.norm1_name)

    def _make_stem_layer(self, in_channels, stem_channels):
        if self.deep_stem:
            self.stem = nn.Sequential(
                ConvModule(
                    in_channels,
                    stem_channels // 2,
                    kernel_size=3,
                    stride=2,
                    padding=1,
                    conv_cfg=self.conv_cfg,
                    norm_cfg=self.norm_cfg,
                    inplace=True),
                ConvModule(
                    stem_channels // 2,
                    stem_channels // 2,
                    kernel_size=3,
                    stride=1,
                    padding=1,
                    conv_cfg=self.conv_cfg,
                    norm_cfg=self.norm_cfg,
                    inplace=True),
                ConvModule(
                    stem_channels // 2,
                    stem_channels,
                    kernel_size=3,
                    stride=1,
                    padding=1,
                    conv_cfg=self.conv_cfg,
                    norm_cfg=self.norm_cfg,
                    inplace=True))
        else:
            self.conv1 = build_conv_layer(
                self.conv_cfg,
                in_channels,
                stem_channels,
                kernel_size=7,
                stride=2,
                padding=3,
                bias=False)
            self.norm1_name, norm1 = build_norm_layer(
                self.norm_cfg, stem_channels, postfix=1)
            self.add_module(self.norm1_name, norm1)
            self.relu = nn.ReLU(inplace=True)
        self.maxpool = nn.MaxPool2d(kernel_size=3, stride=2, padding=1)

    def _freeze_stages(self):
        if self.frozen_stages >= 0:
            if self.deep_stem:
                self.stem.eval()
                for param in self.stem.parameters():
                    param.requires_grad = False
            else:
                self.norm1.eval()
                for m in [self.conv1, self.norm1]:
                    for param in m.parameters():
                        param.requires_grad = False

        for i in range(1, self.frozen_stages + 1):
            m = getattr(self, f'layer{i}')
            m.eval()
            for param in m.parameters():
                param.requires_grad = False

    def init_weights(self):
        super(ResNet, self).init_weights()

        if (isinstance(self.init_cfg, dict)
                and self.init_cfg['type'] == 'Pretrained'):
            # Suppress zero_init_residual if use pretrained model.
            return

        if self.zero_init_residual:
            for m in self.modules():
                if isinstance(m, Bottleneck):
                    constant_init(m.norm3, 0)
                elif isinstance(m, BasicBlock):
                    constant_init(m.norm2, 0)

    def forward(self, x):
        if self.deep_stem:
            x = self.stem(x)
        else:
            x = self.conv1(x)
            x = self.norm1(x)
            x = self.relu(x)
        x = self.maxpool(x)
        outs = []
        for i, layer_name in enumerate(self.res_layers):
            res_layer = getattr(self, layer_name)
            x = res_layer(x)
            if i in self.out_indices:
                outs.append(x)
        return tuple(outs)

    def train(self, mode=True):
        super(ResNet, self).train(mode)
        self._freeze_stages()
        if mode and self.norm_eval:
            for m in self.modules():
                # trick: eval have effect on BatchNorm only
                if isinstance(m, _BatchNorm):
                    m.eval()


@BACKBONES.register_module()
class ResNetV1c(ResNet):
    """ResNetV1c backbone.

    This variant is described in `Bag of Tricks.
    <https://arxiv.org/pdf/1812.01187.pdf>`_.

    Compared with default ResNet(ResNetV1b), ResNetV1c replaces the 7x7 conv
    in the input stem with three 3x3 convs.
    """

    def __init__(self, **kwargs):
        super(ResNetV1c, self).__init__(
            deep_stem=True, avg_down=False, **kwargs)


@BACKBONES.register_module()
class ResNetV1d(ResNet):
    """ResNetV1d backbone.

    This variant is described in `Bag of Tricks.
    <https://arxiv.org/pdf/1812.01187.pdf>`_.

    Compared with default ResNet(ResNetV1b), ResNetV1d replaces the 7x7 conv in
    the input stem with three 3x3 convs. And in the downsampling block, a 2x2
    avg_pool with stride 2 is added before conv, whose stride is changed to 1.
    """

    def __init__(self, **kwargs):
        super(ResNetV1d, self).__init__(
            deep_stem=True, avg_down=True, **kwargs)


================================================
FILE: classification-NO-activation-function/backbones/resnet_norelu.py
================================================
# Copyright (c) OpenMMLab. All rights reserved.

import torch.nn as nn
import torch.utils.checkpoint as cp
from mmcv.cnn import (ConvModule, build_activation_layer, build_conv_layer,
                      build_norm_layer, constant_init)
from mmcv.cnn.bricks import DropPath
from mmcv.runner import BaseModule
from mmcv.utils.parrots_wrapper import _BatchNorm

from ..builder import BACKBONES
from .base_backbone import BaseBackbone

eps = 1.0e-5


class BasicBlock(BaseModule):
    """BasicBlock for ResNet.

    Args:
        in_channels (int): Input channels of this block.
        out_channels (int): Output channels of this block.
        expansion (int): The ratio of ``out_channels/mid_channels`` where
            ``mid_channels`` is the output channels of conv1. This is a
            reserved argument in BasicBlock and should always be 1. Default: 1.
        stride (int): stride of the block. Default: 1
        dilation (int): dilation of convolution. Default: 1
        downsample (nn.Module, optional): downsample operation on identity
            branch. Default: None.
        style (str): `pytorch` or `caffe`. It is unused and reserved for
            unified API with Bottleneck.
        with_cp (bool): Use checkpoint or not. Using checkpoint will save some
            memory while slowing down the training speed.
        conv_cfg (dict, optional): dictionary to construct and config conv
            layer. Default: None
        norm_cfg (dict): dictionary to construct and config norm layer.
            Default: dict(type='BN')
    """

    def __init__(self,
                 in_channels,
                 out_channels,
                 expansion=1,
                 stride=1,
                 dilation=1,
                 downsample=None,
                 style='pytorch',
                 with_cp=False,
                 conv_cfg=None,
                 norm_cfg=dict(type='BN'),
                 drop_path_rate=0.0,
                 act_cfg=dict(type='ReLU', inplace=True),
                 init_cfg=None):
        super(BasicBlock, self).__init__(init_cfg=init_cfg)
        self.in_channels = in_channels
        self.out_channels = out_channels
        self.expansion = expansion
        assert self.expansion == 1
        assert out_channels % expansion == 0
        self.mid_channels = out_channels // expansion
        self.stride = stride
        self.dilation = dilation
        self.style = style
        self.with_cp = with_cp
        self.conv_cfg = conv_cfg
        self.norm_cfg = norm_cfg

        self.norm1_name, norm1 = build_norm_layer(
            norm_cfg, self.mid_channels, postfix=1)
        self.norm2_name, norm2 = build_norm_layer(
            norm_cfg, out_channels, postfix=2)
        self.norm3_name, norm3 = build_norm_layer(
            norm_cfg, out_channels, postfix=3)

        self.conv1 = build_conv_layer(
            conv_cfg,
            in_channels,
            self.mid_channels,
            3,
            stride=stride,
            padding=dilation,
            dilation=dilation,
            bias=False)
        self.add_module(self.norm1_name, norm1)
        self.conv2 = build_conv_layer(
            conv_cfg,
            self.mid_channels,
            out_channels,
            3,
            padding=1,
            bias=False)
        self.add_module(self.norm2_name, norm2)
#         self.conv3 = build_conv_layer(
#             conv_cfg,
#             self.mid_channels,
#             out_channels,
#             kernel_size=1,
#             bias=False)
#         self.add_module(self.norm3_name, norm3)

#         self.relu = build_activation_layer(act_cfg)
        self.downsample = downsample
#         self.drop_path = DropPath(drop_prob=drop_path_rate
#                                   ) if drop_path_rate > eps else nn.Identity()

    @property
    def norm1(self):
        return getattr(self, self.norm1_name)

    @property
    def norm2(self):
        return getattr(self, self.norm2_name)
    
#     @property
#     def norm3(self):
#         return getattr(self, self.norm3_name)

    def forward(self, x):

        def _inner_forward(x):
            identity = x

            out = self.conv1(x)
            out = self.norm1(out)
#             out = self.relu(out)

            out = self.conv2(out)
            out = self.norm2(out)

            if self.downsample is not None:
                identity = self.downsample(x)
#             out = self.drop_path(out)
               
#             second = self.conv3(out*identity)
#             second = out*identity
#             out = out + identity + self.norm3(second)

            out = out + identity

            return out

        if self.with_cp and x.requires_grad:
            out = cp.checkpoint(_inner_forward, x)
        else:
            out = _inner_forward(x)

#         out = self.relu(out)

        return out


class Bottleneck(BaseModule):
    """Bottleneck block for ResNet.

    Args:
        in_channels (int): Input channels of this block.
        out_channels (int): Output channels of this block.
        expansion (int): The ratio of ``out_channels/mid_channels`` where
            ``mid_channels`` is the input/output channels of conv2. Default: 4.
        stride (int): stride of the block. Default: 1
        dilation (int): dilation of convolution. Default: 1
        downsample (nn.Module, optional): downsample operation on identity
            branch. Default: None.
        style (str): ``"pytorch"`` or ``"caffe"``. If set to "pytorch", the
            stride-two layer is the 3x3 conv layer, otherwise the stride-two
            layer is the first 1x1 conv layer. Default: "pytorch".
        with_cp (bool): Use checkpoint or not. Using checkpoint will save some
            memory while slowing down the training speed.
        conv_cfg (dict, optional): dictionary to construct and config conv
            layer. Default: None
        norm_cfg (dict): dictionary to construct and config norm layer.
            Default: dict(type='BN')
    """

    def __init__(self,
                 in_channels,
                 out_channels,
                 expansion=4,
                 stride=1,
                 dilation=1,
                 downsample=None,
                 style='pytorch',
                 with_cp=False,
                 conv_cfg=None,
                 norm_cfg=dict(type='BN'),
                 act_cfg=dict(type='ReLU', inplace=True),
                 drop_path_rate=0.0,
                 init_cfg=None):
        super(Bottleneck, self).__init__(init_cfg=init_cfg)
        assert style in ['pytorch', 'caffe']

        self.in_channels = in_channels
        self.out_channels = out_channels
        self.expansion = expansion
        assert out_channels % expansion == 0
        self.mid_channels = out_channels // expansion
        self.stride = stride
        self.dilation = dilation
        self.style = style
        self.with_cp = with_cp
        self.conv_cfg = conv_cfg
        self.norm_cfg = norm_cfg

        if self.style == 'pytorch':
            self.conv1_stride = 1
            self.conv2_stride = stride
        else:
            self.conv1_stride = stride
            self.conv2_stride = 1

        self.norm1_name, norm1 = build_norm_layer(
            norm_cfg, self.mid_channels, postfix=1)
        self.norm2_name, norm2 = build_norm_layer(
            norm_cfg, self.mid_channels, postfix=2)
        self.norm3_name, norm3 = build_norm_layer(
            norm_cfg, out_channels, postfix=3)

        self.conv1 = build_conv_layer(
            conv_cfg,
            in_channels,
            self.mid_channels,
            kernel_size=1,
            stride=self.conv1_stride,
            bias=False)
        self.add_module(self.norm1_name, norm1)
        self.conv2 = build_conv_layer(
            conv_cfg,
            self.mid_channels,
            self.mid_channels,
            kernel_size=3,
            stride=self.conv2_stride,
            padding=dilation,
            dilation=dilation,
            bias=False)

        self.add_module(self.norm2_name, norm2)
        self.conv3 = build_conv_layer(
            conv_cfg,
            self.mid_channels,
            out_channels,
            kernel_size=1,
            bias=False)
        self.add_module(self.norm3_name, norm3)

        self.relu = build_activation_layer(act_cfg)
        self.downsample = downsample
        self.drop_path = DropPath(drop_prob=drop_path_rate
                                  ) if drop_path_rate > eps else nn.Identity()

    @property
    def norm1(self):
        return getattr(self, self.norm1_name)

    @property
    def norm2(self):
        return getattr(self, self.norm2_name)

    @property
    def norm3(self):
        return getattr(self, self.norm3_name)

    def forward(self, x):

        def _inner_forward(x):
            identity = x

            out = self.conv1(x)
            out = self.norm1(out)
            out = self.relu(out)

            out = self.conv2(out)
            out = self.norm2(out)
            out = self.relu(out)

            out = self.conv3(out)
            out = self.norm3(out)

            if self.downsample is not None:
                identity = self.downsample(x)

            out = self.drop_path(out)

            out += identity

            return out

        if self.with_cp and x.requires_grad:
            out = cp.checkpoint(_inner_forward, x)
        else:
            out = _inner_forward(x)

        out = self.relu(out)

        return out


def get_expansion(block, expansion=None):
    """Get the expansion of a residual block.

    The block expansion will be obtained by the following order:

    1. If ``expansion`` is given, just return it.
    2. If ``block`` has the attribute ``expansion``, then return
       ``block.expansion``.
    3. Return the default value according the the block type:
       1 for ``BasicBlock`` and 4 for ``Bottleneck``.

    Args:
        block (class): The block class.
        expansion (int | None): The given expansion ratio.

    Returns:
        int: The expansion of the block.
    """
    if isinstance(expansion, int):
        assert expansion > 0
    elif expansion is None:
        if hasattr(block, 'expansion'):
            expansion = block.expansion
        elif issubclass(block, BasicBlock):
            expansion = 1
        elif issubclass(block, Bottleneck):
            expansion = 4
        else:
            raise TypeError(f'expansion is not specified for {block.__name__}')
    else:
        raise TypeError('expansion must be an integer or None')

    return expansion


class ResLayer(nn.Sequential):
    """ResLayer to build ResNet style backbone.

    Args:
        block (nn.Module): Residual block used to build ResLayer.
        num_blocks (int): Number of blocks.
        in_channels (int): Input channels of this block.
        out_channels (int): Output channels of this block.
        expansion (int, optional): The expansion for BasicBlock/Bottleneck.
            If not specified, it will firstly be obtained via
            ``block.expansion``. If the block has no attribute "expansion",
            the following default values will be used: 1 for BasicBlock and
            4 for Bottleneck. Default: None.
        stride (int): stride of the first block. Default: 1.
        avg_down (bool): Use AvgPool instead of stride conv when
            downsampling in the bottleneck. Default: False
        conv_cfg (dict, optional): dictionary to construct and config conv
            layer. Default: None
        norm_cfg (dict): dictionary to construct and config norm layer.
            Default: dict(type='BN')
    """

    def __init__(self,
                 block,
                 num_blocks,
                 in_channels,
                 out_channels,
                 expansion=None,
                 stride=1,
                 avg_down=False,
                 conv_cfg=None,
                 norm_cfg=dict(type='BN'),
                 **kwargs):
        self.block = block
        self.expansion = get_expansion(block, expansion)

        downsample = None
        if stride != 1 or in_channels != out_channels:
            downsample = []
            conv_stride = stride
            if avg_down and stride != 1:
                conv_stride = 1
                downsample.append(
                    nn.AvgPool2d(
                        kernel_size=stride,
                        stride=stride,
                        ceil_mode=True,
                        count_include_pad=False))
            downsample.extend([
                build_conv_layer(
                    conv_cfg,
                    in_channels,
                    out_channels,
                    kernel_size=1,
                    stride=conv_stride,
                    bias=False),
                build_norm_layer(norm_cfg, out_channels)[1]
            ])
            downsample = nn.Sequential(*downsample)

        layers = []
        layers.append(
            block(
                in_channels=in_channels,
                out_channels=out_channels,
                expansion=self.expansion,
                stride=stride,
                downsample=downsample,
                conv_cfg=conv_cfg,
                norm_cfg=norm_cfg,
                **kwargs))
        in_channels = out_channels
        for i in range(1, num_blocks):
            layers.append(
                block(
                    in_channels=in_channels,
                    out_channels=out_channels,
                    expansion=self.expansion,
                    stride=1,
                    conv_cfg=conv_cfg,
                    norm_cfg=norm_cfg,
                    **kwargs))
        super(ResLayer, self).__init__(*layers)


@BACKBONES.register_module()
class ResNet(BaseBackbone):
    """ResNet backbone.

    Please refer to the `paper <https://arxiv.org/abs/1512.03385>`__ for
    details.

    Args:
        depth (int): Network depth, from {18, 34, 50, 101, 152}.
        in_channels (int): Number of input image channels. Default: 3.
        stem_channels (int): Output channels of the stem layer. Default: 64.
        base_channels (int): Middle channels of the first stage. Default: 64.
        num_stages (int): Stages of the network. Default: 4.
        strides (Sequence[int]): Strides of the first block of each stage.
            Default: ``(1, 2, 2, 2)``.
        dilations (Sequence[int]): Dilation of each stage.
            Default: ``(1, 1, 1, 1)``.
        out_indices (Sequence[int]): Output from which stages.
            Default: ``(3, )``.
        style (str): `pytorch` or `caffe`. If set to "pytorch", the stride-two
            layer is the 3x3 conv layer, otherwise the stride-two layer is
            the first 1x1 conv layer.
        deep_stem (bool): Replace 7x7 conv in input stem with 3 3x3 conv.
            Default: False.
        avg_down (bool): Use AvgPool instead of stride conv when
            downsampling in the bottleneck. Default: False.
        frozen_stages (int): Stages to be frozen (stop grad and set eval mode).
            -1 means not freezing any parameters. Default: -1.
        conv_cfg (dict | None): The config dict for conv layers. Default: None.
        norm_cfg (dict): The config dict for norm layers.
        norm_eval (bool): Whether to set norm layers to eval mode, namely,
            freeze running stats (mean and var). Note: Effect on Batch Norm
            and its variants only. Default: False.
        with_cp (bool): Use checkpoint or not. Using checkpoint will save some
            memory while slowing down the training speed. Default: False.
        zero_init_residual (bool): Whether to use zero init for last norm layer
            in resblocks to let them behave as identity. Default: True.

    Example:
        >>> from mmcls.models import ResNet
        >>> import torch
        >>> self = ResNet(depth=18)
        >>> self.eval()
        >>> inputs = torch.rand(1, 3, 32, 32)
        >>> level_outputs = self.forward(inputs)
        >>> for level_out in level_outputs:
        ...     print(tuple(level_out.shape))
        (1, 64, 8, 8)
        (1, 128, 4, 4)
        (1, 256, 2, 2)
        (1, 512, 1, 1)
    """

    arch_settings = {
        18: (BasicBlock, (2, 2, 2, 2)),
        34: (BasicBlock, (3, 4, 6, 3)),
        50: (Bottleneck, (3, 4, 6, 3)),
        101: (Bottleneck, (3, 4, 23, 3)),
        152: (Bottleneck, (3, 8, 36, 3))
    }

    def __init__(self,
                 depth,
                 in_channels=3,
                 stem_channels=64,
                 base_channels=64,
                 expansion=None,
                 num_stages=4,
                 strides=(1, 2, 2, 2),
                 dilations=(1, 1, 1, 1),
                 out_indices=(3, ),
                 style='pytorch',
                 deep_stem=False,
                 avg_down=False,
                 frozen_stages=-1,
                 conv_cfg=None,
                 norm_cfg=dict(type='BN', requires_grad=True),
                 norm_eval=False,
                 with_cp=False,
                 zero_init_residual=True,
                 init_cfg=[
                     dict(type='Kaiming', layer=['Conv2d']),
                     dict(
                         type='Constant',
                         val=1,
                         layer=['_BatchNorm', 'GroupNorm'])
                 ],
                 drop_path_rate=0.0):
        super(ResNet, self).__init__(init_cfg)
        if depth not in self.arch_settings:
            raise KeyError(f'invalid depth {depth} for resnet')
        self.depth = depth
        self.stem_channels = stem_channels
        self.base_channels = base_channels
        self.num_stages = num_stages
        assert num_stages >= 1 and num_stages <= 4
        self.strides = strides
        self.dilations = dilations
        assert len(strides) == len(dilations) == num_stages
        self.out_indices = out_indices
        assert max(out_indices) < num_stages
        self.style = style
        self.deep_stem = deep_stem
        self.avg_down = avg_down
        self.frozen_stages = frozen_stages
        self.conv_cfg = conv_cfg
        self.norm_cfg = norm_cfg
        self.with_cp = with_cp
        self.norm_eval = norm_eval
        self.zero_init_residual = zero_init_residual
        self.block, stage_blocks = self.arch_settings[depth]
        self.stage_blocks = stage_blocks[:num_stages]
        self.expansion = get_expansion(self.block, expansion)

        self._make_stem_layer(in_channels, stem_channels)

        self.res_layers = []
        _in_channels = stem_channels
        _out_channels = base_channels * self.expansion
        for i, num_blocks in enumerate(self.stage_blocks):
            stride = strides[i]
            dilation = dilations[i]
            res_layer = self.make_res_layer(
                block=self.block,
                num_blocks=num_blocks,
                in_channels=_in_channels,
                out_channels=_out_channels,
                expansion=self.expansion,
                stride=stride,
                dilation=dilation,
                style=self.style,
                avg_down=self.avg_down,
                with_cp=with_cp,
                conv_cfg=conv_cfg,
                norm_cfg=norm_cfg,
                drop_path_rate=drop_path_rate)
            _in_channels = _out_channels
            _out_channels *= 2
            layer_name = f'layer{i + 1}'
            self.add_module(layer_name, res_layer)
            self.res_layers.append(layer_name)

        self._freeze_stages()

        self.feat_dim = res_layer[-1].out_channels

    def make_res_layer(self, **kwargs):
        return ResLayer(**kwargs)

    @property
    def norm1(self):
        return getattr(self, self.norm1_name)

    def _make_stem_layer(self, in_channels, stem_channels):
        if self.deep_stem:
            self.stem = nn.Sequential(
                ConvModule(
                    in_channels,
                    stem_channels // 2,
                    kernel_size=3,
                    stride=2,
                    padding=1,
                    conv_cfg=self.conv_cfg,
                    norm_cfg=self.norm_cfg,
                    inplace=True),
                ConvModule(
                    stem_channels // 2,
                    stem_channels // 2,
                    kernel_size=3,
                    stride=1,
                    padding=1,
                    conv_cfg=self.conv_cfg,
                    norm_cfg=self.norm_cfg,
                    inplace=True),
                ConvModule(
                    stem_channels // 2,
                    stem_channels,
                    kernel_size=3,
                    stride=1,
                    padding=1,
                    conv_cfg=self.conv_cfg,
                    norm_cfg=self.norm_cfg,
                    inplace=True))
        else:
            self.conv1 = build_conv_layer(
                self.conv_cfg,
                in_channels,
                stem_channels,
                kernel_size=7,
                stride=2,
                padding=3,
                bias=False)
            self.norm1_name, norm1 = build_norm_layer(
                self.norm_cfg, stem_channels, postfix=1)
            self.add_module(self.norm1_name, norm1)
#             self.relu = nn.ReLU(inplace=True)
        self.maxpool = nn.MaxPool2d(kernel_size=3, stride=2, padding=1)

    def _freeze_stages(self):
        if self.frozen_stages >= 0:
            if self.deep_stem:
                self.stem.eval()
                for param in self.stem.parameters():
                    param.requires_grad = False
            else:
                self.norm1.eval()
                for m in [self.conv1, self.norm1]:
                    for param in m.parameters():
                        param.requires_grad = False

        for i in range(1, self.frozen_stages + 1):
            m = getattr(self, f'layer{i}')
            m.eval()
            for param in m.parameters():
                param.requires_grad = False

    def init_weights(self):
        super(ResNet, self).init_weights()

        if (isinstance(self.init_cfg, dict)
                and self.init_cfg['type'] == 'Pretrained'):
            # Suppress zero_init_residual if use pretrained model.
            return

        if self.zero_init_residual:
            for m in self.modules():
                if isinstance(m, Bottleneck):
                    constant_init(m.norm3, 0)
                elif isinstance(m, BasicBlock):
                    constant_init(m.norm2, 0)

    def forward(self, x):
        if self.deep_stem:
            x = self.stem(x)
        else:
            x = self.conv1(x)
            x = self.norm1(x)
#             x = self.relu(x)
        x = self.maxpool(x)
        outs = []
        for i, layer_name in enumerate(self.res_layers):
            res_layer = getattr(self, layer_name)
            x = res_layer(x)
            if i in self.out_indices:
                outs.append(x)
        return tuple(outs)

    def train(self, mode=True):
        super(ResNet, self).train(mode)
        self._freeze_stages()
        if mode and self.norm_eval:
            for m in self.modules():
                # trick: eval have effect on BatchNorm only
                if isinstance(m, _BatchNorm):
                    m.eval()


@BACKBONES.register_module()
class ResNetV1c(ResNet):
    """ResNetV1c backbone.

    This variant is described in `Bag of Tricks.
    <https://arxiv.org/pdf/1812.01187.pdf>`_.

    Compared with default ResNet(ResNetV1b), ResNetV1c replaces the 7x7 conv
    in the input stem with three 3x3 convs.
    """

    def __init__(self, **kwargs):
        super(ResNetV1c, self).__init__(
            deep_stem=True, avg_down=False, **kwargs)


@BACKBONES.register_module()
class ResNetV1d(ResNet):
    """ResNetV1d backbone.

    This variant is described in `Bag of Tricks.
    <https://arxiv.org/pdf/1812.01187.pdf>`_.

    Compared with default ResNet(ResNetV1b), ResNetV1d replaces the 7x7 conv in
    the input stem with three 3x3 convs. And in the downsampling block, a 2x2
    avg_pool with stride 2 is added before conv, whose stride is changed to 1.
    """

    def __init__(self, **kwargs):
        super(ResNetV1d, self).__init__(
            deep_stem=True, avg_down=True, **kwargs)


================================================
FILE: classification-NO-activation-function/logs/pinet_1x1_norelu.log
================================================
2023-01-01 16:31:14,068 - mmcls - INFO - Environment info:
------------------------------------------------------------
sys.platform: linux
Python: 3.6.12 |Anaconda, Inc.| (default, Sep  8 2020, 23:10:56) [GCC 7.3.0]
CUDA available: True
GPU 0,1,2,3,4,5,6,7: Tesla V100-PCIE-32GB
CUDA_HOME: /usr/local/cuda
NVCC: Cuda compilation tools, release 10.2, V10.2.8
GCC: gcc (Ubuntu 7.5.0-6ubuntu2) 7.5.0
PyTorch: 1.9.0+cu102
PyTorch compiling details: PyTorch built with:
  - GCC 7.3
  - C++ Version: 201402
  - Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191122 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v2.1.2 (Git Hash 98be7e8afa711dc9b66c8ff3504129cb82013cdb)
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - NNPACK is enabled
  - CPU capability usage: AVX2
  - CUDA Runtime 10.2
  - NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_70,code=sm_70
  - CuDNN 7.6.5
  - Magma 2.5.2
  - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=10.2, CUDNN_VERSION=7.6.5, CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.9.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, 

TorchVision: 0.10.0+cu102
OpenCV: 4.5.5
MMCV: 1.5.1
MMCV Compiler: GCC 7.5
MMCV CUDA Compiler: 10.2
MMClassification: 0.24.0+91b85bb
------------------------------------------------------------

2023-01-01 16:31:14,068 - mmcls - INFO - Distributed training: True
2023-01-01 16:31:14,230 - mmcls - INFO - Config:
model = dict(
    type='ImageClassifier',
    backbone=dict(
        type='ResNet',
        depth=18,
        num_stages=4,
        out_indices=(3, ),
        style='pytorch'),
    neck=dict(type='GlobalAveragePooling'),
    head=dict(
        type='LinearClsHead',
        num_classes=1000,
        in_channels=512,
        loss=dict(type='CrossEntropyLoss', loss_weight=1.0),
        topk=(1, 5)))
dataset_type = 'ImageNet'
img_norm_cfg = dict(
    mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
    dict(type='LoadImageFromFile'),
    dict(type='RandomResizedCrop', size=224),
    dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'),
    dict(
        type='Normalize',
        mean=[123.675, 116.28, 103.53],
        std=[58.395, 57.12, 57.375],
        to_rgb=True),
    dict(type='ImageToTensor', keys=['img']),
    dict(type='ToTensor', keys=['gt_label']),
    dict(type='Collect', keys=['img', 'gt_label'])
]
test_pipeline = [
    dict(type='LoadImageFromFile'),
    dict(type='Resize', size=(256, -1)),
    dict(type='CenterCrop', crop_size=224),
    dict(
        type='Normalize',
        mean=[123.675, 116.28, 103.53],
        std=[58.395, 57.12, 57.375],
        to_rgb=True),
    dict(type='ImageToTensor', keys=['img']),
    dict(type='Collect', keys=['img'])
]
data = dict(
    samples_per_gpu=32,
    workers_per_gpu=2,
    train=dict(
        type='ImageNet',
        data_prefix='data/imagenet/train',
        pipeline=[
            dict(type='LoadImageFromFile'),
            dict(type='RandomResizedCrop', size=224),
            dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'),
            dict(
                type='Normalize',
                mean=[123.675, 116.28, 103.53],
                std=[58.395, 57.12, 57.375],
                to_rgb=True),
            dict(type='ImageToTensor', keys=['img']),
            dict(type='ToTensor', keys=['gt_label']),
            dict(type='Collect', keys=['img', 'gt_label'])
        ]),
    val=dict(
        type='ImageNet',
        data_prefix='data/imagenet/val',
        ann_file='data/imagenet/meta/val.txt',
        pipeline=[
            dict(type='LoadImageFromFile'),
            dict(type='Resize', size=(256, -1)),
            dict(type='CenterCrop', crop_size=224),
            dict(
                type='Normalize',
                mean=[123.675, 116.28, 103.53],
                std=[58.395, 57.12, 57.375],
                to_rgb=True),
            dict(type='ImageToTensor', keys=['img']),
            dict(type='Collect', keys=['img'])
        ]),
    test=dict(
        type='ImageNet',
        data_prefix='data/imagenet/val',
        ann_file='data/imagenet/meta/val.txt',
        pipeline=[
            dict(type='LoadImageFromFile'),
            dict(type='Resize', size=(256, -1)),
            dict(type='CenterCrop', crop_size=224),
            dict(
                type='Normalize',
                mean=[123.675, 116.28, 103.53],
                std=[58.395, 57.12, 57.375],
                to_rgb=True),
            dict(type='ImageToTensor', keys=['img']),
            dict(type='Collect', keys=['img'])
        ]))
evaluation = dict(interval=1, metric='accuracy')
optimizer = dict(type='SGD', lr=0.1, momentum=0.9, weight_decay=0.0001)
optimizer_config = dict(grad_clip=None)
lr_config = dict(policy='step', step=[30, 60, 90])
runner = dict(type='EpochBasedRunner', max_epochs=100)
checkpoint_config = dict(interval=50)
log_config = dict(interval=100, hooks=[dict(type='TextLoggerHook')])
dist_params = dict(backend='nccl')
log_level = 'INFO'
load_from = None
resume_from = None
workflow = [('train', 1)]
work_dir = './work_dirs/resnet18_8xb32_in1k_pi'
gpu_ids = range(0, 8)

2023-01-01 16:31:19,484 - mmcls - INFO - Set random seed to 1232336006, deterministic: False
2023-01-01 16:31:19,669 - mmcls - INFO - initialize ResNet with init_cfg [{'type': 'Kaiming', 'layer': ['Conv2d']}, {'type': 'Constant', 'val': 1, 'layer': ['_BatchNorm', 'GroupNorm']}]
2023-01-01 16:31:19,760 - mmcls - INFO - initialize LinearClsHead with init_cfg {'type': 'Normal', 'layer': 'Linear', 'std': 0.01}
Name of parameter - Initialization information

backbone.conv1.weight - torch.Size([64, 3, 7, 7]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.bn1.weight - torch.Size([64]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.bn1.bias - torch.Size([64]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer1.0.conv1.weight - torch.Size([64, 64, 3, 3]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer1.0.bn1.weight - torch.Size([64]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer1.0.bn1.bias - torch.Size([64]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer1.0.conv2.weight - torch.Size([64, 64, 3, 3]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer1.0.bn2.weight - torch.Size([64]): 
Initialized by user-defined `init_weights` in ResNet  

backbone.layer1.0.bn2.bias - torch.Size([64]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer1.0.conv3.weight - torch.Size([64, 64, 1, 1]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer1.0.bn3.weight - torch.Size([64]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer1.0.bn3.bias - torch.Size([64]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer1.1.conv1.weight - torch.Size([64, 64, 3, 3]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer1.1.bn1.weight - torch.Size([64]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer1.1.bn1.bias - torch.Size([64]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer1.1.conv2.weight - torch.Size([64, 64, 3, 3]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer1.1.bn2.weight - torch.Size([64]): 
Initialized by user-defined `init_weights` in ResNet  

backbone.layer1.1.bn2.bias - torch.Size([64]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer1.1.conv3.weight - torch.Size([64, 64, 1, 1]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer1.1.bn3.weight - torch.Size([64]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer1.1.bn3.bias - torch.Size([64]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer2.0.conv1.weight - torch.Size([128, 64, 3, 3]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer2.0.bn1.weight - torch.Size([128]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer2.0.bn1.bias - torch.Size([128]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer2.0.conv2.weight - torch.Size([128, 128, 3, 3]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer2.0.bn2.weight - torch.Size([128]): 
Initialized by user-defined `init_weights` in ResNet  

backbone.layer2.0.bn2.bias - torch.Size([128]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer2.0.conv3.weight - torch.Size([128, 128, 1, 1]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer2.0.bn3.weight - torch.Size([128]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer2.0.bn3.bias - torch.Size([128]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer2.0.downsample.0.weight - torch.Size([128, 64, 1, 1]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer2.0.downsample.1.weight - torch.Size([128]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer2.0.downsample.1.bias - torch.Size([128]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer2.1.conv1.weight - torch.Size([128, 128, 3, 3]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer2.1.bn1.weight - torch.Size([128]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer2.1.bn1.bias - torch.Size([128]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer2.1.conv2.weight - torch.Size([128, 128, 3, 3]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer2.1.bn2.weight - torch.Size([128]): 
Initialized by user-defined `init_weights` in ResNet  

backbone.layer2.1.bn2.bias - torch.Size([128]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer2.1.conv3.weight - torch.Size([128, 128, 1, 1]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer2.1.bn3.weight - torch.Size([128]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer2.1.bn3.bias - torch.Size([128]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer3.0.conv1.weight - torch.Size([256, 128, 3, 3]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer3.0.bn1.weight - torch.Size([256]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer3.0.bn1.bias - torch.Size([256]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer3.0.conv2.weight - torch.Size([256, 256, 3, 3]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer3.0.bn2.weight - torch.Size([256]): 
Initialized by user-defined `init_weights` in ResNet  

backbone.layer3.0.bn2.bias - torch.Size([256]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer3.0.conv3.weight - torch.Size([256, 256, 1, 1]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer3.0.bn3.weight - torch.Size([256]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer3.0.bn3.bias - torch.Size([256]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer3.0.downsample.0.weight - torch.Size([256, 128, 1, 1]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer3.0.downsample.1.weight - torch.Size([256]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer3.0.downsample.1.bias - torch.Size([256]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer3.1.conv1.weight - torch.Size([256, 256, 3, 3]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer3.1.bn1.weight - torch.Size([256]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer3.1.bn1.bias - torch.Size([256]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer3.1.conv2.weight - torch.Size([256, 256, 3, 3]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer3.1.bn2.weight - torch.Size([256]): 
Initialized by user-defined `init_weights` in ResNet  

backbone.layer3.1.bn2.bias - torch.Size([256]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer3.1.conv3.weight - torch.Size([256, 256, 1, 1]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer3.1.bn3.weight - torch.Size([256]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer3.1.bn3.bias - torch.Size([256]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer4.0.conv1.weight - torch.Size([512, 256, 3, 3]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer4.0.bn1.weight - torch.Size([512]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer4.0.bn1.bias - torch.Size([512]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer4.0.conv2.weight - torch.Size([512, 512, 3, 3]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer4.0.bn2.weight - torch.Size([512]): 
Initialized by user-defined `init_weights` in ResNet  

backbone.layer4.0.bn2.bias - torch.Size([512]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer4.0.conv3.weight - torch.Size([512, 512, 1, 1]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer4.0.bn3.weight - torch.Size([512]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer4.0.bn3.bias - torch.Size([512]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer4.0.downsample.0.weight - torch.Size([512, 256, 1, 1]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer4.0.downsample.1.weight - torch.Size([512]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer4.0.downsample.1.bias - torch.Size([512]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer4.1.conv1.weight - torch.Size([512, 512, 3, 3]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer4.1.bn1.weight - torch.Size([512]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer4.1.bn1.bias - torch.Size([512]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer4.1.conv2.weight - torch.Size([512, 512, 3, 3]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer4.1.bn2.weight - torch.Size([512]): 
Initialized by user-defined `init_weights` in ResNet  

backbone.layer4.1.bn2.bias - torch.Size([512]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer4.1.conv3.weight - torch.Size([512, 512, 1, 1]): 
KaimingInit: a=0, mode=fan_out, nonlinearity=relu, distribution =normal, bias=0 

backbone.layer4.1.bn3.weight - torch.Size([512]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

backbone.layer4.1.bn3.bias - torch.Size([512]): 
The value is the same before and after calling `init_weights` of ImageClassifier  

head.fc.weight - torch.Size([1000, 512]): 
NormalInit: mean=0, std=0.01, bias=0 

head.fc.bias - torch.Size([1000]): 
NormalInit: mean=0, std=0.01, bias=0 
2023-01-01 16:31:48,444 - mmcls - INFO - Start running, host: jiankangdeng@lhrai102-lx, work_dir: /home/jiankangdeng/projects/classification/mmclassification_V0.24.0/work_dirs/resnet18_8xb32_in1k_pi
2023-01-01 16:31:48,444 - mmcls - INFO - Hooks will be executed in the following order:
before_run:
(VERY_HIGH   ) StepLrUpdaterHook                  
(NORMAL      ) CheckpointHook                     
(LOW         ) DistEvalHook                       
(VERY_LOW    ) TextLoggerHook                     
 -------------------- 
before_train_epoch:
(VERY_HIGH   ) StepLrUpdaterHook                  
(NORMAL      ) DistSamplerSeedHook                
(LOW         ) IterTimerHook                      
(LOW         ) DistEvalHook                       
(VERY_LOW    ) TextLoggerHook                     
 -------------------- 
before_train_iter:
(VERY_HIGH   ) StepLrUpdaterHook                  
(LOW         ) IterTimerHook                      
(LOW         ) DistEvalHook                       
 -------------------- 
after_train_iter:
(ABOVE_NORMAL) DistOptimizerHook                  
(NORMAL      ) CheckpointHook                     
(LOW         ) IterTimerHook                      
(LOW         ) DistEvalHook                       
(VERY_LOW    ) TextLoggerHook                     
 -------------------- 
after_train_epoch:
(NORMAL      ) CheckpointHook                     
(LOW         ) DistEvalHook                       
(VERY_LOW    ) TextLoggerHook                     
 -------------------- 
before_val_epoch:
(NORMAL      ) DistSamplerSeedHook                
(LOW         ) IterTimerHook                      
(VERY_LOW    ) TextLoggerHook                     
 -------------------- 
before_val_iter:
(LOW         ) IterTimerHook                      
 -------------------- 
after_val_iter:
(LOW         ) IterTimerHook                      
 -------------------- 
after_val_epoch:
(VERY_LOW    ) TextLoggerHook                     
 -------------------- 
after_run:
(VERY_LOW    ) TextLoggerHook                     
 -------------------- 
2023-01-01 16:31:48,445 - mmcls - INFO - workflow: [('train', 1)], max: 100 epochs
2023-01-01 16:31:48,445 - mmcls - INFO - Checkpoints will be saved to /home/jiankangdeng/projects/classification/mmclassification_V0.24.0/work_dirs/resnet18_8xb32_in1k_pi by HardDiskBackend.
2023-01-01 16:32:01,103 - mmcls - INFO - Epoch [1][100/5005]	lr: 1.000e-01, eta: 17:33:36, time: 0.126, data_time: 0.027, memory: 1224, loss: 6.7943
2023-01-01 16:32:09,823 - mmcls - INFO - Epoch [1][200/5005]	lr: 1.000e-01, eta: 14:50:16, time: 0.087, data_time: 0.007, memory: 1224, loss: 6.5618
2023-01-01 16:32:18,667 - mmcls - INFO - Epoch [1][300/5005]	lr: 1.000e-01, eta: 13:58:48, time: 0.088, data_time: 0.001, memory: 1224, loss: 6.3981
2023-01-01 16:32:28,033 - mmcls - INFO - Epoch [1][400/5005]	lr: 1.000e-01, eta: 13:44:20, time: 0.094, data_time: 0.001, memory: 1224, loss: 6.2250
2023-01-01 16:32:36,751 - mmcls - INFO - Epoch [1][500/5005]	lr: 1.000e-01, eta: 13:24:30, time: 0.087, data_time: 0.005, memory: 1224, loss: 6.0684
2023-01-01 16:32:45,889 - mmcls - INFO - Epoch [1][600/5005]	lr: 1.000e-01, eta: 13:17:21, time: 0.092, data_time: 0.003, memory: 1224, loss: 5.9139
2023-01-01 16:32:54,902 - mmcls - INFO - Epoch [1][700/5005]	lr: 1.000e-01, eta: 13:10:29, time: 0.090, data_time: 0.022, memory: 1224, loss: 5.7723
2023-01-01 16:33:04,093 - mmcls - INFO - Epoch [1][800/5005]	lr: 1.000e-01, eta: 13:07:15, time: 0.092, data_time: 0.004, memory: 1224, loss: 5.6559
2023-01-01 16:33:13,416 - mmcls - INFO - Epoch [1][900/5005]	lr: 1.000e-01, eta: 13:05:53, time: 0.093, data_time: 0.001, memory: 1224, loss: 5.5643
2023-01-01 16:33:22,401 - mmcls - INFO - Epoch [1][1000/5005]	lr: 1.000e-01, eta: 13:01:53, time: 0.090, data_time: 0.002, memory: 1224, loss: 5.4418
2023-01-01 16:33:31,309 - mmcls - INFO - Epoch [1][1100/5005]	lr: 1.000e-01, eta: 12:58:07, time: 0.089, data_time: 0.017, memory: 1224, loss: 5.3744
2023-01-01 16:33:40,254 - mmcls - INFO - Epoch [1][1200/5005]	lr: 1.000e-01, eta: 12:55:08, time: 0.089, data_time: 0.001, memory: 1224, loss: 5.2766
2023-01-01 16:33:49,209 - mmcls - INFO - Epoch [1][1300/5005]	lr: 1.000e-01, eta: 12:52:39, time: 0.090, data_time: 0.003, memory: 1224, loss: 5.2192
2023-01-01 16:33:58,435 - mmcls - INFO - Epoch [1][1400/5005]	lr: 1.000e-01, eta: 12:52:08, time: 0.092, data_time: 0.021, memory: 1224, loss: 5.1091
2023-01-01 16:34:07,654 - mmcls - INFO - Epoch [1][1500/5005]	lr: 1.000e-01, eta: 12:51:40, time: 0.092, data_time: 0.002, memory: 1224, loss: 5.0672
2023-01-01 16:34:16,444 - mmcls - INFO - Epoch [1][1600/5005]	lr: 1.000e-01, eta: 12:48:54, time: 0.088, data_time: 0.011, memory: 1224, loss: 4.9784
2023-01-01 16:34:25,494 - mmcls - INFO - Epoch [1][1700/5005]	lr: 1.000e-01, eta: 12:47:49, time: 0.091, data_time: 0.014, memory: 1224, loss: 4.9488
2023-01-01 16:34:34,582 - mmcls - INFO - Epoch [1][1800/5005]	lr: 1.000e-01, eta: 12:46:58, time: 0.091, data_time: 0.001, memory: 1224, loss: 4.8974
2023-01-01 16:34:43,683 - mmcls - INFO - Epoch [1][1900/5005]	lr: 1.000e-01, eta: 12:46:14, time: 0.091, data_time: 0.011, memory: 1224, loss: 4.8291
2023-01-01 16:34:52,944 - mmcls - INFO - Epoch [1][2000/5005]	lr: 1.000e-01, eta: 12:46:14, time: 0.093, data_time: 0.010, memory: 1224, loss: 4.7950
2023-01-01 16:35:01,799 - mmcls - INFO - Epoch [1][2100/5005]	lr: 1.000e-01, eta: 12:44:38, time: 0.089, data_time: 0.002, memory: 1224, loss: 4.7290
2023-01-01 16:35:10,855 - mmcls - INFO - Epoch [1][2200/5005]	lr: 1.000e-01, eta: 12:43:55, time: 0.091, data_time: 0.005, memory: 1224, loss: 4.6624
2023-01-01 16:35:19,750 - mmcls - INFO - Epoch [1][2300/5005]	lr: 1.000e-01, eta: 12:42:40, time: 0.089, data_time: 0.009, memory: 1224, loss: 4.6366
2023-01-01 16:35:29,019 - mmcls - INFO - Epoch [1][2400/5005]	lr: 1.000e-01, eta: 12:42:49, time: 0.093, data_time: 0.001, memory: 1224, loss: 4.5740
2023-01-01 16:35:37,864 - mmcls - INFO - Epoch [1][2500/5005]	lr: 1.000e-01, eta: 12:41:30, time: 0.088, data_time: 0.001, memory: 1224, loss: 4.5621
2023-01-01 16:35:46,875 - mmcls - INFO - Epoch [1][2600/5005]	lr: 1.000e-01, eta: 12:40:50, time: 0.090, data_time: 0.004, memory: 1224, loss: 4.5201
2023-01-01 16:35:55,653 - mmcls - INFO - Epoch [1][2700/5005]	lr: 1.000e-01, eta: 12:39:29, time: 0.088, data_time: 0.002, memory: 1224, loss: 4.4704
2023-01-01 16:36:04,364 - mmcls - INFO - Epoch [1][2800/5005]	lr: 1.000e-01, eta: 12:38:00, time: 0.087, data_time: 0.007, memory: 1224, loss: 4.4646
2023-01-01 16:36:13,390 - mmcls - INFO - Epoch [1][2900/5005]	lr: 1.000e-01, eta: 12:37:32, time: 0.090, data_time: 0.027, memory: 1224, loss: 4.4182
2023-01-01 16:36:22,304 - mmcls - INFO - Epoch [1][3000/5005]	lr: 1.000e-01, eta: 12:36:45, time: 0.089, data_time: 0.007, memory: 1224, loss: 4.3918
2023-01-01 16:36:31,063 - mmcls - INFO - Epoch [1][3100/5005]	lr: 1.000e-01, eta: 12:35:37, time: 0.088, data_time: 0.001, memory: 1224, loss: 4.3417
2023-01-01 16:36:40,190 - mmcls - INFO - Epoch [1][3200/5005]	lr: 1.000e-01, eta: 12:35:30, time: 0.091, data_time: 0.001, memory: 1224, loss: 4.3231
2023-01-01 16:36:49,028 - mmcls - INFO - Epoch [1][3300/5005]	lr: 1.000e-01, eta: 12:34:39, time: 0.088, data_time: 0.005, memory: 1224, loss: 4.3135
2023-01-01 16:36:58,094 - mmcls - INFO - Epoch [1][3400/5005]	lr: 1.000e-01, eta: 12:34:23, time: 0.091, data_time: 0.004, memory: 1224, loss: 4.2897
2023-01-01 16:37:07,001 - mmcls - INFO - Epoch [1][3500/5005]	lr: 1.000e-01, eta: 12:33:48, time: 0.089, data_time: 0.005, memory: 1224, loss: 4.2420
2023-01-01 16:37:15,801 - mmcls - INFO - Epoch [1][3600/5005]	lr: 1.000e-01, eta: 12:32:56, time: 0.088, data_time: 0.007, memory: 1224, loss: 4.2271
2023-01-01 16:37:24,964 - mmcls - INFO - Epoch [1][3700/5005]	lr: 1.000e-01, eta: 12:32:56, time: 0.092, data_time: 0.002, memory: 1224, loss: 4.2202
2023-01-01 16:37:34,440 - mmcls - INFO - Epoch [1][3800/5005]	lr: 1.000e-01, eta: 12:33:37, time: 0.095, data_time: 0.011, memory: 1224, loss: 4.1578
2023-01-01 16:37:43,412 - mmcls - INFO - Epoch [1][3900/5005]	lr: 1.000e-01, eta: 12:33:12, time: 0.090, data_time: 0.003, memory: 1224, loss: 4.1460
2023-01-01 16:37:51,984 - mmcls - INFO - Epoch [1][4000/5005]	lr: 1.000e-01, eta: 12:31:56, time: 0.086, data_time: 0.018, memory: 1224, loss: 4.1256
2023-01-01 16:38:01,139 - mmcls - INFO - Epoch [1][4100/5005]	lr: 1.000e-01, eta: 12:31:55, time: 0.092, data_time: 0.002, memory: 1224, loss: 4.1535
2023-01-01 16:38:10,030 - mmcls - INFO - Epoch [1][4200/5005]	lr: 1.000e-01, eta: 12:31:23, time: 0.089, data_time: 0.001, memory: 1224, loss: 4.1206
2023-01-01 16:38:19,057 - mmcls - INFO - Epoch [1][4300/5005]	lr: 1.000e-01, eta: 12:31:07, time: 0.090, data_time: 0.001, memory: 1224, loss: 4.0641
2023-01-01 16:38:28,015 - mmcls - INFO - Epoch [1][4400/5005]	lr: 1.000e-01, eta: 12:30:43, time: 0.090, data_time: 0.018, memory: 1224, loss: 4.0750
2023-01-01 16:38:37,135 - mmcls - INFO - Epoch [1][4500/5005]	lr: 1.000e-01, eta: 12:30:39, time: 0.091, data_time: 0.003, memory: 1224, loss: 4.0476
2023-01-01 16:38:46,191 - mmcls - INFO - Epoch [1][4600/5005]	lr: 1.000e-01, eta: 12:30:28, time: 0.091, data_time: 0.006, memory: 1224, loss: 4.0405
2023-01-01 16:38:55,786 - mmcls - INFO - Epoch [1][4700/5005]	lr: 1.000e-01, eta: 12:31:13, time: 0.096, data_time: 0.002, memory: 1224, loss: 4.0158
2023-01-01 16:39:04,790 - mmcls - INFO - Epoch [1][4800/5005]	lr: 1.000e-01, eta: 12:30:55, time: 0.090, data_time: 0.001, memory: 1224, loss: 3.9927
2023-01-01 16:39:13,801 - mmcls - INFO - Epoch [1][4900/5005]	lr: 1.000e-01, eta: 12:30:37, time: 0.090, data_time: 0.001, memory: 1224, loss: 3.9823
2023-01-01 16:39:22,580 - mmcls - INFO - Epoch [1][5000/5005]	lr: 1.000e-01, eta: 12:29:57, time: 0.088, data_time: 0.001, memory: 1224, loss: 3.9691
2023-01-01 16:39:46,049 - mmcls - INFO - Epoch(val) [1][196]	accuracy_top-1: 27.0620, accuracy_top-5: 51.3400
2023-01-01 16:39:57,154 - mmcls - INFO - Epoch [2][100/5005]	lr: 1.000e-01, eta: 12:32:19, time: 0.111, data_time: 0.050, memory: 1224, loss: 3.8937
2023-01-01 16:40:05,913 - mmcls - INFO - Epoch [2][200/5005]	lr: 1.000e-01, eta: 12:31:35, time: 0.087, data_time: 0.008, memory: 1224, loss: 3.9343
2023-01-01 16:40:14,549 - mmcls - INFO - Epoch [2][300/5005]	lr: 1.000e-01, eta: 12:30:42, time: 0.086, data_time: 0.016, memory: 1224, loss: 3.8934
2023-01-01 16:40:23,809 - mmcls - INFO - Epoch [2][400/5005]	lr: 1.000e-01, eta: 12:30:48, time: 0.093, data_time: 0.011, memory: 1224, loss: 3.8838
2023-01-01 16:40:32,474 - mmcls - INFO - Epoch [2][500/5005]	lr: 1.000e-01, eta: 12:30:00, time: 0.087, data_time: 0.007, memory: 1224, loss: 3.8964
2023-01-01 16:40:41,451 - mmcls - INFO - Epoch [2][600/5005]	lr: 1.000e-01, eta: 12:29:40, time: 0.090, data_time: 0.014, memory: 1224, loss: 3.8346
2023-01-01 16:40:50,179 - mmcls - INFO - Epoch [2][700/5005]	lr: 1.000e-01, eta: 12:29:00, time: 0.087, data_time: 0.017, memory: 1224, loss: 3.8494
2023-01-01 16:40:59,384 - mmcls - INFO - Epoch [2][800/5005]	lr: 1.000e-01, eta: 12:29:01, time: 0.092, data_time: 0.012, memory: 1224, loss: 3.8240
2023-01-01 16:41:08,143 - mmcls - INFO - Epoch [2][900/5005]	lr: 1.000e-01, eta: 12:28:25, time: 0.088, data_time: 0.003, memory: 1224, loss: 3.8599
2023-01-01 16:41:17,200 - mmcls - INFO - Epoch [2][1000/5005]	lr: 1.000e-01, eta: 12:28:14, time: 0.091, data_time: 0.003, memory: 1224, loss: 3.8085
2023-01-01 16:41:26,152 - mmcls - INFO - Epoch [2][1100/5005]	lr: 1.000e-01, eta: 12:27:54, time: 0.090, data_time: 0.016, memory: 1224, loss: 3.8072
2023-01-01 16:41:35,104 - mmcls - INFO - Epoch [2][1200/5005]	lr: 1.000e-01, eta: 12:27:36, time: 0.090, data_time: 0.001, memory: 1224, loss: 3.8290
2023-01-01 16:41:43,992 - mmcls - INFO - Epoch [2][1300/5005]	lr: 1.000e-01, eta: 12:27:11, time: 0.089, data_time: 0.004, memory: 1224, loss: 3.8225
2023-01-01 16:41:52,912 - mmcls - INFO - Epoch [2][1400/5005]	lr: 1.000e-01, eta: 12:26:51, time: 0.089, data_time: 0.013, memory: 1224, loss: 3.7633
2023-01-01 16:42:01,992 - mmcls - INFO - Epoch [2][1500/5005]	lr: 1.000e-01, eta: 12:26:42, time: 0.091, data_time: 0.012, memory: 1224, loss: 3.7492
2023-01-01 16:42:10,788 - mmcls - INFO - Epoch [2][1600/5005]	lr: 1.000e-01, eta: 12:26:13, time: 0.088, data_time: 0.001, memory: 1224, loss: 3.7819
2023-01-01 16:42:19,577 - mmcls - INFO - Epoch [2][1700/5005]	lr: 1.000e-01, eta: 12:25:44, time: 0.088, data_time: 0.030, memory: 1224, loss: 3.7568
2023-01-01 16:42:28,423 - mmcls - INFO - Epoch [2][1800/5005]	lr: 1.000e-01, eta: 12:25:18, time: 0.088, data_time: 0.001, memory: 1224, loss: 3.7011
2023-01-01 16:42:37,539 - mmcls - INFO - Epoch [2][1900/5005]	lr: 1.000e-01, eta: 12:25:14, time: 0.091, data_time: 0.001, memory: 1224, loss: 3.6875
2023-01-01 16:42:46,593 - mmcls - INFO - Epoch [2][2000/5005]	lr: 1.000e-01, eta: 12:25:04, time: 0.091, data_time: 0.001, memory: 1224, loss: 3.7433
2023-01-01 16:42:55,891 - mmcls - INFO - Epoch [2][2100/5005]	lr: 1.000e-01, eta: 12:25:11, time: 0.093, data_time: 0.013, memory: 1224, loss: 3.6791
2023-01-01 16:43:04,825 - mmcls - INFO - Epoch [2][2200/5005]	lr: 1.000e-01, eta: 12:24:53, time: 0.089, data_time: 0.007, memory: 1224, loss: 3.7298
2023-01-01 16:43:13,790 - mmcls - INFO - Epoch [2][2300/5005]	lr: 1.000e-01, eta: 12:24:39, time: 0.090, data_time: 0.011, memory: 1224, loss: 3.7094
2023-01-01 16:43:22,506 - mmcls - INFO - Epoch [2][2400/5005]	lr: 1.000e-01, eta: 12:24:06, time: 0.087, data_time: 0.001, memory: 1224, loss: 3.6950
2023-01-01 16:43:31,663 - mmcls - INFO - Epoch [2][2500/5005]	lr: 1.000e-01, eta: 12:24:04, time: 0.092, data_time: 0.002, memory: 1224, loss: 3.6878
2023-01-01 16:43:40,408 - mmcls - INFO - Epoch [2][2600/5005]	lr: 1.000e-01, eta: 12:23:35, time: 0.087, data_time: 0.009, memory: 1224, loss: 3.6642
2023-01-01 16:43:49,467 - mmcls - INFO - Epoch [2][2700/5005]	lr: 1.000e-01, eta: 12:23:27, time: 0.091, data_time: 0.018, memory: 1224, loss: 3.6835
2023-01-01 16:43:58,312 - mmcls - INFO - Epoch [2][2800/5005]	lr: 1.000e-01, eta: 12:23:03, time: 0.088, data_time: 0.001, memory: 1224, loss: 3.6533
2023-01-01 16:44:06,958 - mmcls - INFO - Epoch [2][2900/5005]	lr: 1.000e-01, eta: 12:22:30, time: 0.087, data_time: 0.031, memory: 1224, loss: 3.6510
2023-01-01 16:44:15,826 - mmcls - INFO - Epoch [2][3000/5005]	lr: 1.000e-01, eta: 12:22:10, time: 0.089, data_time: 0.012, memory: 1224, loss: 3.6303
2023-01-01 16:44:24,759 - mmcls - INFO - Epoch [2][3100/5005]	lr: 1.000e-01, eta: 12:21:54, time: 0.089, data_time: 0.001, memory: 1224, loss: 3.6254
2023-01-01 16:44:33,787 - mmcls - INFO - Epoch [2][3200/5005]	lr: 1.000e-01, eta: 12:21:44, time: 0.090, data_time: 0.016, memory: 1224, loss: 3.6258
2023-01-01 16:44:42,652 - mmcls - INFO - Epoch [2][3300/5005]	lr: 1.000e-01, eta: 12:21:25, time: 0.089, data_time: 0.006, memory: 1224, loss: 3.6113
2023-01-01 16:44:51,325 - mmcls - INFO - Epoch [2][3400/5005]	lr: 1.000e-01, eta: 12:20:54, time: 0.087, data_time: 0.006, memory: 1224, loss: 3.5648
2023-01-01 16:45:00,053 - mmcls - INFO - Epoch [2][3500/5005]	lr: 1.000e-01, eta: 12:20:28, time: 0.087, data_time: 0.020, memory: 1224, loss: 3.5955
2023-01-01 16:45:08,746 - mmcls - INFO - Epoch [2][3600/5005]	lr: 1.000e-01, eta: 12:19:59, time: 0.087, data_time: 0.007, memory: 1224, loss: 3.5998
2023-01-01 16:45:17,468 - mmcls - INFO - Epoch [2][3700/5005]	lr: 1.000e-01, eta: 12:19:33, time: 0.087, data_time: 0.001, memory: 1224, loss: 3.5449
2023-01-01 16:45:26,400 - mmcls - INFO - Epoch [2][3800/5005]	lr: 1.000e-01, eta: 12:19:19, time: 0.089, data_time: 0.020, memory: 1224, loss: 3.5836
2023-01-01 16:45:35,128 - mmcls - INFO - Epoch [2][3900/5005]	lr: 1.000e-01, eta: 12:18:54, time: 0.087, data_time: 0.011, memory: 1224, loss: 3.5650
2023-01-01 16:45:44,410 - mmcls - INFO - Epoch [2][4000/5005]	lr: 1.000e-01, eta: 12:18:59, time: 0.093, data_time: 0.008, memory: 1224, loss: 3.5710
2023-01-01 16:45:53,276 - mmcls - INFO - Epoch [2][4100/5005]	lr: 1.000e-01, eta: 12:18:41, time: 0.089, data_time: 0.001, memory: 1224, loss: 3.5962
2023-01-01 16:46:02,000 - mmcls - INFO - Epoch [2][4200/5005]	lr: 1.000e-01, eta: 12:18:16, time: 0.087, data_time: 0.013, memory: 1224, loss: 3.5322
2023-01-01 16:46:11,414 - mmcls - INFO - Epoch [2][4300/5005]	lr: 1.000e-01, eta: 12:18:28, time: 0.094, data_time: 0.005, memory: 1224, loss: 3.5285
2023-01-01 16:46:20,631 - mmcls - INFO - Epoch [2][4400/5005]	lr: 1.000e-01, eta: 12:18:30, time: 0.092, data_time: 0.001, memory: 1224, loss: 3.5371
2023-01-01 16:46:29,368 - mmcls - INFO - Epoch [2][4500/5005]	lr: 1.000e-01, eta: 12:18:06, time: 0.087, data_time: 0.001, memory: 1224, loss: 3.5495
2023-01-01 16:46:38,562 - mmcls - INFO - Epoch [2][4600/5005]	lr: 1.000e-01, eta: 12:18:06, time: 0.092, data_time: 0.004, memory: 1224, loss: 3.5300
2023-01-01 16:46:47,644 - mmcls - INFO - Epoch [2][4700/5005]	lr: 1.000e-01, eta: 12:18:00, time: 0.091, data_time: 0.003, memory: 1224, loss: 3.5532
2023-01-01 16:46:56,597 - mmcls - INFO - Epoch [2][4800/5005]	lr: 1.000e-01, eta: 12:17:47, time: 0.090, data_time: 0.000, memory: 1224, loss: 3.5306
2023-01-01 16:47:05,637 - mmcls - INFO - Epoch [2][4900/5005]	lr: 1.000e-01, eta: 12:17:39, time: 0.090, data_time: 0.009, memory: 1224, loss: 3.5050
2023-01-01 16:47:14,053 - mmcls - INFO - Epoch [2][5000/5005]	lr: 1.000e-01, eta: 12:17:00, time: 0.084, data_time: 0.011, memory: 1224, loss: 3.5432
2023-01-01 16:47:37,395 - mmcls - INFO - Epoch(val) [2][196]	accuracy_top-1: 31.7280, accuracy_top-5: 56.4860
2023-01-01 16:47:48,377 - mmcls - INFO - Epoch [3][100/5005]	lr: 1.000e-01, eta: 12:18:04, time: 0.110, data_time: 0.034, memory: 1224, loss: 3.4193
2023-01-01 16:47:57,234 - mmcls - INFO - Epoch [3][200/5005]	lr: 1.000e-01, eta: 12:17:46, time: 0.088, data_time: 0.006, memory: 1224, loss: 3.4269
2023-01-01 16:48:06,014 - mmcls - INFO - Epoch [3][300/5005]	lr: 1.000e-01, eta: 12:17:25, time: 0.088, data_time: 0.005, memory: 1224, loss: 3.4609
2023-01-01 16:48:14,886 - mmcls - INFO - Epoch [3][400/5005]	lr: 1.000e-01, eta: 12:17:08, time: 0.089, data_time: 0.001, memory: 1224, loss: 3.4043
2023-01-01 16:48:23,899 - mmcls - INFO - Epoch [3][500/5005]	lr: 1.000e-01, eta: 12:16:59, time: 0.090, data_time: 0.001, memory: 1224, loss: 3.4147
2023-01-01 16:48:32,630 - mmcls - INFO - Epoch [3][600/5005]	lr: 1.000e-01, eta: 12:16:36, time: 0.087, data_time: 0.019, memory: 1224, loss: 3.4490
2023-01-01 16:48:41,614 - mmcls - INFO - Epoch [3][700/5005]	lr: 1.000e-01, eta: 12:16:25, time: 0.090, data_time: 0.002, memory: 1224, loss: 3.4249
2023-01-01 16:48:50,202 - mmcls - INFO - Epoch [3][800/5005]	lr: 1.000e-01, eta: 12:15:57, time: 0.086, data_time: 0.001, memory: 1224, loss: 3.4669
2023-01-01 16:48:59,377 - mmcls - INFO - Epoch [3][900/5005]	lr: 1.000e-01, eta: 12:15:55, time: 0.092, data_time: 0.004, memory: 1224, loss: 3.4597
2023-01-01 16:49:08,176 - mmcls - INFO - Epoch [3][1000/5005]	lr: 1.000e-01, eta: 12:15:36, time: 0.088, data_time: 0.012, memory: 1224, loss: 3.4512
2023-01-01 16:49:17,045 - mmcls - INFO - Epoch [3][1100/5005]	lr: 1.000e-01, eta: 12:15:21, time: 0.089, data_time: 0.006, memory: 1224, loss: 3.4199
2023-01-01 16:49:26,353 - mmcls - INFO - Epoch [3][1200/5005]	lr: 1.000e-01, eta: 12:15:24, time: 0.093, data_time: 0.002, memory: 1224, loss: 3.4413
2023-01-01 16:49:35,401 - mmcls - INFO - Epoch [3][1300/5005]	lr: 1.000e-01, eta: 12:15:17, time: 0.090, data_time: 0.006, memory: 1224, loss: 3.4349
2023-01-01 16:49:44,438 - mmcls - INFO - Epoch [3][1400/5005]	lr: 1.000e-01, eta: 12:15:08, time: 0.090, data_time: 0.005, memory: 1224, loss: 3.4003
2023-01-01 16:49:53,498 - mmcls - INFO - Epoch [3][1500/5005]	lr: 1.000e-01, eta: 12:15:01, time: 0.091, data_time: 0.005, memory: 1224, loss: 3.3839
2023-01-01 16:50:02,469 - mmcls - INFO - Epoch [3][1600/5005]	lr: 1.000e-01, eta: 12:14:50, time: 0.090, data_time: 0.001, memory: 1224, loss: 3.3908
2023-01-01 16:50:11,371 - mmcls - INFO - Epoch [3][1700/5005]	lr: 1.000e-01, eta: 12:14:36, time: 0.089, data_time: 0.010, memory: 1224, loss: 3.3845
2023-01-01 16:50:20,246 - mmcls - INFO - Epoch [3][1800/5005]	lr: 1.000e-01, eta: 12:14:21, time: 0.089, data_time: 0.011, memory: 1224, loss: 3.3920
2023-01-01 16:50:29,299 - mmcls - INFO - Epoch [3][1900/5005]	lr: 1.000e-01, eta: 12:14:13, time: 0.091, data_time: 0.001, memory: 1224, loss: 3.4334
2023-01-01 16:50:38,340 - mmcls - INFO - Epoch [3][2000/5005]	lr: 1.000e-01, eta: 12:14:05, time: 0.090, data_time: 0.016, memory: 1224, loss: 3.3754
2023-01-01 16:50:47,308 - mmcls - INFO - Epoch [3][2100/5005]	lr: 1.000e-01, eta: 12:13:54, time: 0.090, data_time: 0.007, memory: 1224, loss: 3.4104
2023-01-01 16:50:56,408 - mmcls - INFO - Epoch [3][2200/5005]	lr: 1.000e-01, eta: 12:13:49, time: 0.091, data_time: 0.001, memory: 1224, loss: 3.3738
2023-01-01 16:51:05,321 - mmcls - INFO - Epoch [3][2300/5005]	lr: 1.000e-01, eta: 12:13:35, time: 0.089, data_time: 0.004, memory: 1224, loss: 3.3685
2023-01-01 16:51:14,103 - mmcls - INFO - Epoch [3][2400/5005]	lr: 1.000e-01, eta: 12:13:17, time: 0.088, data_time: 0.002, memory: 1224, loss: 3.4038
2023-01-01 16:51:23,118 - mmcls - INFO - Epoch [3][2500/5005]	lr: 1.000e-01, eta: 12:13:08, time: 0.090, data_time: 0.015, memory: 1224, loss: 3.3754
2023-01-01 16:51:31,995 - mmcls - INFO - Epoch [3][2600/5005]	lr: 1.000e-01, eta: 12:12:54, time: 0.089, data_time: 0.003, memory: 1224, loss: 3.3689
2023-01-01 16:51:40,741 - mmcls - INFO - Epoch [3][2700/5005]	lr: 1.000e-01, eta: 12:12:34, time: 0.087, data_time: 0.001, memory: 1224, loss: 3.4128
2023-01-01 16:51:49,586 - mmcls - INFO - Epoch [3][2800/5005]	lr: 1.000e-01, eta: 12:12:19, time: 0.088, data_time: 0.016, memory: 1224, loss: 3.3487
2023-01-01 16:51:58,464 - mmcls - INFO - Epoch [3][2900/5005]	lr: 1.000e-01, eta: 12:12:05, time: 0.089, data_time: 0.007, memory: 1224, loss: 3.3723
2023-01-01 16:52:07,411 - mmcls - INFO - Epoch [3][3000/5005]	lr: 1.000e-01, eta: 12:11:54, time: 0.089, data_time: 0.002, memory: 1224, loss: 3.3516
2023-01-01 16:52:16,375 - mmcls - INFO - Epoch [3][3100/5005]	lr: 1.000e-01, eta: 12:11:43, time: 0.090, data_time: 0.004, memory: 1224, loss: 3.3452
2023-01-01 16:52:25,536 - mmcls - INFO - Epoch [3][3200/5005]	lr: 1.000e-01, eta: 12:11:40, time: 0.092, data_time: 0.001, memory: 1224, loss: 3.3139
2023-01-01 16:52:34,444 - mmcls - INFO - Epoch [3][3300/5005]	lr: 1.000e-01, eta: 12:11:27, time: 0.089, data_time: 0.002, memory: 1224, loss: 3.3368
2023-01-01 16:52:43,118 - mmcls - INFO - Epoch [3][3400/5005]	lr: 1.000e-01, eta: 12:11:06, time: 0.087, data_time: 0.001, memory: 1224, loss: 3.3583
2023-01-01 16:52:52,318 - mmcls - INFO - Epoch [3][3500/5005]	lr: 1.000e-01, eta: 12:11:04, time: 0.092, data_time: 0.002, memory: 1224, loss: 3.3653
2023-01-01 16:53:01,027 - mmcls - INFO - Epoch [3][3600/5005]	lr: 1.000e-01, eta: 12:10:44, time: 0.087, data_time: 0.028, memory: 1224, loss: 3.3778
2023-01-01 16:53:09,843 - mmcls - INFO - Epoch [3][3700/5005]	lr: 1.000e-01, eta: 12:10:28, time: 0.088, data_time: 0.004, memory: 1224, loss: 3.3397
2023-01-01 16:53:18,790 - mmcls - INFO - Epoch [3][3800/5005]	lr: 1.000e-01, eta: 12:10:17, time: 0.089, data_time: 0.001, memory: 1224, loss: 3.3653
2023-01-01 16:53:27,744 - mmcls - INFO - Epoch [3][3900/5005]	lr: 1.000e-01, eta: 12:10:06, time: 0.089, data_time: 0.002, memory: 1224, loss: 3.3169
2023-01-01 16:53:36,890 - mmcls - INFO - Epoch [3][4000/5005]	lr: 1.000e-01, eta: 12:10:03, time: 0.092, data_time: 0.002, memory: 1224, loss: 3.3401
2023-01-01 16:53:45,638 - mmcls - INFO - Epoch [3][4100/5005]	lr: 1.000e-01, eta: 12:09:44, time: 0.087, data_time: 0.001, memory: 1224, loss: 3.3496
2023-01-01 16:53:54,609 - mmcls - INFO - Epoch [3][4200/5005]	lr: 1.000e-01, eta: 12:09:34, time: 0.090, data_time: 0.020, memory: 1224, loss: 3.3620
2023-01-01 16:54:03,668 - mmcls - INFO - Epoch [3][4300/5005]	lr: 1.000e-01, eta: 12:09:27, time: 0.091, data_time: 0.005, memory: 1224, loss: 3.3194
2023-01-01 16:54:12,414 - mmcls - INFO - Epoch [3][4400/5005]	lr: 1.000e-01, eta: 12:09:10, time: 0.087, data_time: 0.001, memory: 1224, loss: 3.3358
2023-01-01 16:54:21,176 - mmcls - INFO - Epoch [3][4500/5005]	lr: 1.000e-01, eta: 12:08:53, time: 0.088, data_time: 0.003, memory: 1224, loss: 3.2975
2023-01-01 16:54:30,110 - mmcls - INFO - Epoch [3][4600/5005]	lr: 1.000e-01, eta: 12:08:42, time: 0.089, data_time: 0.003, memory: 1224, loss: 3.2991
2023-01-01 16:54:39,161 - mmcls - INFO - Epoch [3][4700/5005]	lr: 1.000e-01, eta: 12:08:34, time: 0.091, data_time: 0.000, memory: 1224, loss: 3.2711
2023-01-01 16:54:48,080 - mmcls - INFO - Epoch [3][4800/5005]	lr: 1.000e-01, eta: 12:08:23, time: 0.089, data_time: 0.002, memory: 1224, loss: 3.3074
2023-01-01 16:54:57,040 - mmcls - INFO - Epoch [3][4900/5005]	lr: 1.000e-01, eta: 12:08:12, time: 0.090, data_time: 0.004, memory: 1224, loss: 3.2890
2023-01-01 16:55:06,312 - mmcls - INFO - Epoch [3][5000/5005]	lr: 1.000e-01, eta: 12:08:12, time: 0.093, data_time: 0.004, memory: 1224, loss: 3.2838
2023-01-01 16:55:29,302 - mmcls - INFO - Epoch(val) [3][196]	accuracy_top-1: 38.3360, accuracy_top-5: 63.6980
2023-01-01 16:55:40,471 - mmcls - INFO - Epoch [4][100/5005]	lr: 1.000e-01, eta: 12:08:57, time: 0.111, data_time: 0.037, memory: 1224, loss: 3.2448
2023-01-01 16:55:49,509 - mmcls - INFO - Epoch [4][200/5005]	lr: 1.000e-01, eta: 12:08:49, time: 0.090, data_time: 0.014, memory: 1224, loss: 3.2449
2023-01-01 16:55:58,415 - mmcls - INFO - Epoch [4][300/5005]	lr: 1.000e-01, eta: 12:08:36, time: 0.089, data_time: 0.010, memory: 1224, loss: 3.2429
2023-01-01 16:56:07,064 - mmcls - INFO - Epoch [4][400/5005]	lr: 1.000e-01, eta: 12:08:16, time: 0.087, data_time: 0.005, memory: 1224, loss: 3.2606
2023-01-01 16:56:15,815 - mmcls - INFO - Epoch [4][500/5005]	lr: 1.000e-01, eta: 12:07:59, time: 0.088, data_time: 0.004, memory: 1224, loss: 3.2500
2023-01-01 16:56:24,856 - mmcls - INFO - Epoch [4][600/5005]	lr: 1.000e-01, eta: 12:07:51, time: 0.090, data_time: 0.002, memory: 1224, loss: 3.2272
2023-01-01 16:56:33,422 - mmcls - INFO - Epoch [4][700/5005]	lr: 1.000e-01, eta: 12:07:28, time: 0.086, data_time: 0.001, memory: 1224, loss: 3.2703
2023-01-01 16:56:42,108 - mmcls - INFO - Epoch [4][800/5005]	lr: 1.000e-01, eta: 12:07:10, time: 0.087, data_time: 0.024, memory: 1224, loss: 3.2516
2023-01-01 16:56:50,911 - mmcls - INFO - Epoch [4][900/5005]	lr: 1.000e-01, eta: 12:06:54, time: 0.088, data_time: 0.015, memory: 1224, loss: 3.2497
2023-01-01 16:56:59,572 - mmcls - INFO - Epoch [4][1000/5005]	lr: 1.000e-01, eta: 12:06:35, time: 0.087, data_time: 0.006, memory: 1224, loss: 3.2725
2023-01-01 16:57:08,858 - mmcls - INFO - Epoch [4][1100/5005]	lr: 1.000e-01, eta: 12:06:35, time: 0.093, data_time: 0.009, memory: 1224, loss: 3.2645
2023-01-01 16:57:17,925 - mmcls - INFO - Epoch [4][1200/5005]	lr: 1.000e-01, eta: 12:06:28, time: 0.091, data_time: 0.014, memory: 1224, loss: 3.2775
2023-01-01 16:57:26,580 - mmcls - INFO - Epoch [4][1300/5005]	lr: 1.000e-01, eta: 12:06:08, time: 0.087, data_time: 0.008, memory: 1224, loss: 3.2889
2023-01-01 16:57:35,312 - mmcls - INFO - Epoch [4][1400/5005]	lr: 1.000e-01, eta: 12:05:52, time: 0.087, data_time: 0.006, memory: 1224, loss: 3.2443
2023-01-01 16:57:43,975 - mmcls - INFO - Epoch [4][1500/5005]	lr: 1.000e-01, eta: 12:05:33, time: 0.087, data_time: 0.004, memory: 1224, loss: 3.2706
2023-01-01 16:57:52,704 - mmcls - INFO - Epoch [4][1600/5005]	lr: 1.000e-01, eta: 12:05:16, time: 0.087, data_time: 0.005, memory: 1224, loss: 3.2458
2023-01-01 16:58:01,759 - mmcls - INFO - Epoch [4][1700/5005]	lr: 1.000e-01, eta: 12:05:09, time: 0.091, data_time: 0.002, memory: 1224, loss: 3.2260
2023-01-01 16:58:10,565 - mmcls - INFO - Epoch [4][1800/5005]	lr: 1.000e-01, eta: 12:04:54, time: 0.088, data_time: 0.001, memory: 1224, loss: 3.2172
2023-01-01 16:58:19,623 - mmcls - INFO - Epoch [4][1900/5005]	lr: 1.000e-01, eta: 12:04:47, time: 0.091, data_time: 0.005, memory: 1224, loss: 3.2001
2023-01-01 16:58:28,675 - mmcls - INFO - Epoch [4][2000/5005]	lr: 1.000e-01, eta: 12:04:40, time: 0.090, data_time: 0.027, memory: 1224, loss: 3.2273
2023-01-01 16:58:37,648 - mmcls - INFO - Epoch [4][2100/5005]	lr: 1.000e-01, eta: 12:04:30, time: 0.090, data_time: 0.019, memory: 1224, loss: 3.2260
2023-01-01 16:58:46,381 - mmcls - INFO - Epoch [4][2200/5005]	lr: 1.000e-01, eta: 12:04:14, time: 0.087, data_time: 0.023, memory: 1224, loss: 3.2671
2023-01-01 16:58:55,019 - mmcls - INFO - Epoch [4][2300/5005]	lr: 1.000e-01, eta: 12:03:55, time: 0.086, data_time: 0.001, memory: 1224, loss: 3.2523
2023-01-01 16:59:03,956 - mmcls - INFO - Epoch [4][2400/5005]	lr: 1.000e-01, eta: 12:03:45, time: 0.089, data_time: 0.008, memory: 1224, loss: 3.2252
2023-01-01 16:59:12,779 - mmcls - INFO - Epoch [4][2500/5005]	lr: 1.000e-01, eta: 12:03:31, time: 0.088, data_time: 0.021, memory: 1224, loss: 3.2529
2023-01-01 16:59:21,630 - mmcls - INFO - Epoch [4][2600/5005]	lr: 1.000e-01, eta: 12:03:18, time: 0.089, data_time: 0.013, memory: 1224, loss: 3.2290
2023-01-01 16:59:30,743 - mmcls - INFO - Epoch [4][2700/5005]	lr: 1.000e-01, eta: 12:03:13, time: 0.091, data_time: 0.001, memory: 1224, loss: 3.1988
2023-01-01 16:59:39,411 - mmcls - INFO - Epoch [4][2800/5005]	lr: 1.000e-01, eta: 12:02:55, time: 0.087, data_time: 0.031, memory: 1224, loss: 3.2140
2023-01-01 16:59:48,480 - mmcls - INFO - Epoch [4][2900/5005]	lr: 1.000e-01, eta: 12:02:49, time: 0.091, data_time: 0.002, memory: 1224, loss: 3.2289
2023-01-01 16:59:57,289 - mmcls - INFO - Epoch [4][3000/5005]	lr: 1.000e-01, eta: 12:02:34, time: 0.088, data_time: 0.005, memory: 1224, loss: 3.2148
2023-01-01 17:00:06,018 - mmcls - INFO - Epoch [4][3100/5005]	lr: 1.000e-01, eta: 12:02:19, time: 0.087, data_time: 0.002, memory: 1224, loss: 3.2195
2023-01-01 17:00:14,946 - mmcls - INFO - Epoch [4][3200/5005]	lr: 1.000e-01, eta: 12:02:08, time: 0.089, data_time: 0.002, memory: 1224, loss: 3.2138
2023-01-01 17:00:23,652 - mmcls - INFO - Epoch [4][3300/5005]	lr: 1.000e-01, eta: 12:01:52, time: 0.087, data_time: 0.004, memory: 1224, loss: 3.1915
2023-01-01 17:00:32,409 - mmcls - INFO - Epoch [4][3400/5005]	lr: 1.000e-01, eta: 12:01:37, time: 0.088, data_time: 0.031, memory: 1224, loss: 3.2242
2023-01-01 17:00:41,202 - mmcls - INFO - Epoch [4][3500/5005]	lr: 1.000e-01, eta: 12:01:23, time: 0.088, data_time: 0.001, memory: 1224, loss: 3.2080
2023-01-01 17:00:50,144 - mmcls - INFO - Epoch [4][3600/5005]	lr: 1.000e-01, eta: 12:01:13, time: 0.089, data_time: 0.016, memory: 1224, loss: 3.2262
2023-01-01 17:00:58,647 - mmcls - INFO - Epoch [4][3700/5005]	lr: 1.000e-01, eta: 12:00:52, time: 0.085, data_time: 0.003, memory: 1224, loss: 3.2175
2023-01-01 17:01:07,467 - mmcls - INFO - Epoch [4][3800/5005]	lr: 1.000e-01, eta: 12:00:39, time: 0.088, data_time: 0.001, memory: 1224, loss: 3.2542
2023-01-01 17:01:17,001 - mmcls - INFO - Epoch [4][3900/5005]	lr: 1.000e-01, eta: 12:00:44, time: 0.095, data_time: 0.004, memory: 1224, loss: 3.2338
2023-01-01 17:01:25,652 - mmcls - INFO - Epoch [4][4000/5005]	lr: 1.000e-01, eta: 12:00:27, time: 0.087, data_time: 0.012, memory: 1224, loss: 3.2197
2023-01-01 17:01:34,642 - mmcls - INFO - Epoch [4][4100/5005]	lr: 1.000e-01, eta: 12:00:18, time: 0.090, data_time: 0.013, memory: 1224, loss: 3.1930
2023-01-01 17:01:43,728 - mmcls - INFO - Epoch [4][4200/5005]	lr: 1.000e-01, eta: 12:00:12, time: 0.091, data_time: 0.020, memory: 1224, loss: 3.1806
2023-01-01 17:01:52,480 - mmcls - INFO - Epoch [4][4300/5005]	lr: 1.000e-01, eta: 11:59:57, time: 0.087, data_time: 0.018, memory: 1224, loss: 3.1539
2023-01-01 17:02:01,249 - mmcls - INFO - Epoch [4][4400/5005]	lr: 1.000e-01, eta: 11:59:43, time: 0.088, data_time: 0.011, memory: 1224, loss: 3.2174
2023-01-01 17:02:10,267 - mmcls - INFO - Epoch [4][4500/5005]	lr: 1.000e-01, eta: 11:59:35, time: 0.090, data_time: 0.019, memory: 1224, loss: 3.1706
2023-01-01 17:02:18,883 - mmcls - INFO - Epoch [4][4600/5005]	lr: 1.000e-01, eta: 11:59:17, time: 0.086, data_time: 0.012, memory: 1224, loss: 3.1525
2023-01-01 17:02:27,768 - mmcls - INFO - Epoch [4][4700/5005]	lr: 1.000e-01, eta: 11:59:06, time: 0.089, data_time: 0.016, memory: 1224, loss: 3.1732
2023-01-01 17:02:36,603 - mmcls - INFO - Epoch [4][4800/5005]	lr: 1.000e-01, eta: 11:58:54, time: 0.088, data_time: 0.024, memory: 1224, loss: 3.2078
2023-01-01 17:02:45,610 - mmcls - INFO - Epoch [4][4900/5005]	lr: 1.000e-01, eta: 11:58:45, time: 0.090, data_time: 0.041, memory: 1224, loss: 3.1928
2023-01-01 17:02:54,404 - mmcls - INFO - Epoch [4][5000/5005]	lr: 1.000e-01, eta: 11:58:32, time: 0.088, data_time: 0.005, memory: 1224, loss: 3.2033
2023-01-01 17:03:17,363 - mmcls - INFO - Epoch(val) [4][196]	accuracy_top-1: 35.3300, accuracy_top-5: 60.1260
2023-01-01 17:03:28,690 - mmcls - INFO - Epoch [5][100/5005]	lr: 1.000e-01, eta: 11:59:07, time: 0.113, data_time: 0.047, memory: 1224, loss: 3.1171
2023-01-01 17:03:37,473 - mmcls - INFO - Epoch [5][200/5005]	lr: 1.000e-01, eta: 11:58:54, time: 0.088, data_time: 0.010, memory: 1224, loss: 3.1460
2023-01-01 17:03:46,147 - mmcls - INFO - Epoch [5][300/5005]	lr: 1.000e-01, eta: 11:58:37, time: 0.087, data_time: 0.004, memory: 1224, loss: 3.1248
2023-01-01 17:03:54,884 - mmcls - INFO - Epoch [5][400/5005]	lr: 1.000e-01, eta: 11:58:23, time: 0.087, data_time: 0.002, memory: 1224, loss: 3.1608
2023-01-01 17:04:03,514 - mmcls - INFO - Epoch [5][500/5005]	lr: 1.000e-01, eta: 11:58:06, time: 0.086, data_time: 0.016, memory: 1224, loss: 3.1328
2023-01-01 17:04:12,491 - mmcls - INFO - Epoch [5][600/5005]	lr: 1.000e-01, eta: 11:57:56, time: 0.090, data_time: 0.016, memory: 1224, loss: 3.1315
2023-01-01 17:04:21,387 - mmcls - INFO - Epoch [5][700/5005]	lr: 1.000e-01, eta: 11:57:46, time: 0.089, data_time: 0.010, memory: 1224, loss: 3.1464
2023-01-01 17:04:30,263 - mmcls - INFO - Epoch [5][800/5005]	lr: 1.000e-01, eta: 11:57:34, time: 0.089, data_time: 0.012, memory: 1224, loss: 3.1444
2023-01-01 17:04:39,087 - mmcls - INFO - Epoch [5][900/5005]	lr: 1.000e-01, eta: 11:57:22, time: 0.088, data_time: 0.029, memory: 1224, loss: 3.1346
2023-01-01 17:04:47,872 - mmcls - INFO - Epoch [5][1000/5005]	lr: 1.000e-01, eta: 11:57:09, time: 0.088, data_time: 0.001, memory: 1224, loss: 3.1337
2023-01-01 17:04:56,467 - mmcls - INFO - Epoch [5][1100/5005]	lr: 1.000e-01, eta: 11:56:51, time: 0.086, data_time: 0.001, memory: 1224, loss: 3.1561
2023-01-01 17:05:05,261 - mmcls - INFO - Epoch [5][1200/5005]	lr: 1.000e-01, eta: 11:56:38, time: 0.088, data_time: 0.010, memory: 1224, loss: 3.1225
2023-01-01 17:05:14,148 - mmcls - INFO - Epoch [5][1300/5005]	lr: 1.000e-01, eta: 11:56:27, time: 0.089, data_time: 0.004, memory: 1224, loss: 3.1672
2023-01-01 17:05:23,196 - mmcls - INFO - Epoch [5][1400/5005]	lr: 1.000e-01, eta: 11:56:20, time: 0.091, data_time: 0.010, memory: 1224, loss: 3.1250
2023-01-01 17:05:32,290 - mmcls - INFO - Epoch [5][1500/5005]	lr: 1.000e-01, eta: 11:56:14, time: 0.091, data_time: 0.007, memory: 1224, loss: 3.1445
2023-01-01 17:05:41,368 - mmcls - INFO - Epoch [5][1600/5005]	lr: 1.000e-01, eta: 11:56:07, time: 0.091, data_time: 0.003, memory: 1224, loss: 3.1482
2023-01-01 17:05:50,117 - mmcls - INFO - Epoch [5][1700/5005]	lr: 1.000e-01, eta: 11:55:53, time: 0.088, data_time: 0.006, memory: 1224, loss: 3.1415
2023-01-01 17:05:58,894 - mmcls - INFO - Epoch [5][1800/5005]	lr: 1.000e-01, eta: 11:55:40, time: 0.088, data_time: 0.002, memory: 1224, loss: 3.1379
2023-01-01 17:06:07,634 - mmcls - INFO - Epoch [5][1900/5005]	lr: 1.000e-01, eta: 11:55:26, time: 0.087, data_time: 0.006, memory: 1224, loss: 3.1370
2023-01-01 17:06:16,601 - mmcls - INFO - Epoch [5][2000/5005]	lr: 1.000e-01, eta: 11:55:17, time: 0.090, data_time: 0.033, memory: 1224, loss: 3.1271
2023-01-01 17:06:25,524 - mmcls - INFO - Epoch [5][2100/5005]	lr: 1.000e-01, eta: 11:55:07, time: 0.089, data_time: 0.026, memory: 1224, loss: 3.1369
2023-01-01 17:06:34,398 - mmcls - INFO - Epoch [5][2200/5005]	lr: 1.000e-01, eta: 11:54:56, time: 0.089, data_time: 0.020, memory: 1224, loss: 3.1513
2023-01-01 17:06:43,241 - mmcls - INFO - Epoch [5][2300/5005]	lr: 1.000e-01, eta: 11:54:44, time: 0.088, data_time: 0.020, memory: 1224, loss: 3.1288
2023-01-01 17:06:51,879 - mmcls - INFO - Epoch [5][2400/5005]	lr: 1.000e-01, eta: 11:54:28, time: 0.086, data_time: 0.001, memory: 1224, loss: 3.1363
2023-01-01 17:07:01,502 - mmcls - INFO - Epoch [5][2500/5005]	lr: 1.000e-01, eta: 11:54:33, time: 0.096, data_time: 0.019, memory: 1224, loss: 3.1602
2023-01-01 17:07:10,308 - mmcls - INFO - Epoch [5][2600/5005]	lr: 1.000e-01, eta: 11:54:21, time: 0.088, data_time: 0.011, memory: 1224, loss: 3.1627
2023-01-01 17:07:19,102 - mmcls - INFO - Epoch [5][2700/5005]	lr: 1.000e-01, eta: 11:54:08, time: 0.088, data_time: 0.017, memory: 1224, loss: 3.1463
2023-01-01 17:07:27,648 - mmcls - INFO - Epoch [5][2800/5005]	lr: 1.000e-01, eta: 11:53:50, time: 0.085, data_time: 0.004, memory: 1224, loss: 3.1158
2023-01-01 17:07:36,461 - mmcls - INFO - Epoch [5][2900/5005]	lr: 1.000e-01, eta: 11:53:38, time: 0.088, data_time: 0.001, memory: 1224, loss: 3.1317
2023-01-01 17:07:45,190 - mmcls - INFO - Epoch [5][3000/5005]	lr: 1.000e-01, eta: 11:53:24, time: 0.087, data_time: 0.023, memory: 1224, loss: 3.1155
2023-01-01 17:07:54,062 - mmcls - INFO - Epoch [5][3100/5005]	lr: 1.000e-01, eta: 11:53:13, time: 0.089, data_time: 0.001, memory: 1224, loss: 3.1218
2023-01-01 17:08:03,170 - mmcls - INFO - Epoch [5][3200/5005]	lr: 1.000e-01, eta: 11:53:07, time: 0.091, data_time: 0.013, memory: 1224, loss: 3.1428
2023-01-01 17:08:12,023 - mmcls - INFO - Epoch [5][3300/5005]	lr: 1.000e-01, eta: 11:52:56, time: 0.088, data_time: 0.001, memory: 1224, loss: 3.1194
2023-01-01 17:08:21,074 - mmcls - INFO - Epoch [5][3400/5005]	lr: 1.000e-01, eta: 11:52:48, time: 0.090, data_time: 0.001, memory: 1224, loss: 3.0907
2023-01-01 17:08:30,087 - mmcls - INFO - Epoch [5][3500/5005]	lr: 1.000e-01, eta: 11:52:40, time: 0.090, data_time: 0.014, memory: 1224, loss: 3.0890
2023-01-01 17:08:39,004 - mmcls - INFO - Epoch [5][3600/5005]	lr: 1.000e-01, eta: 11:52:31, time: 0.089, data_time: 0.022, memory: 1224, loss: 3.1272
2023-01-01 17:08:47,559 - mmcls - INFO - Epoch [5][3700/5005]	lr: 1.000e-01, eta: 11:52:13, time: 0.086, data_time: 0.018, memory: 1224, loss: 3.1515
2023-01-01 17:08:56,407 - mmcls - INFO - Epoch [5][3800/5005]	lr: 1.000e-01, eta: 11:52:02, time: 0.088, data_time: 0.004, memory: 1224, loss: 3.1188
2023-01-01 17:09:05,343 - mmcls - INFO - Epoch [5][3900/5005]	lr: 1.000e-01, eta: 11:51:53, time: 0.089, data_time: 0.008, memory: 
Download .txt
gitextract_zpv_duhy/

├── .gitignore
├── LICENSE.txt
├── classification-NO-activation-function/
│   ├── README.md
│   ├── backbones/
│   │   ├── pinet_1x1_norelu.py
│   │   ├── pinet_1x1_relu.py
│   │   ├── pinet_norelu.py
│   │   ├── pinet_relu.py
│   │   └── resnet_norelu.py
│   └── logs/
│       ├── pinet_1x1_norelu.log
│       ├── pinet_1x1_relu.log
│       ├── pinet_norelu.log
│       ├── pinet_relu.log
│       └── resnet_norelu.log
├── face_recognition/
│   ├── README.md
│   ├── __init__.py
│   ├── config.py
│   ├── data/
│   │   ├── build_eval_pack.py
│   │   ├── lfw/
│   │   │   └── pairs_label.txt
│   │   └── rec2image.py
│   ├── eval/
│   │   ├── lfw.py
│   │   └── verification.py
│   ├── flops_counter.py
│   ├── image_iter.py
│   ├── metric.py
│   ├── models/
│   │   ├── MS1Mretina-polynet50-arcface/
│   │   │   ├── log_retina_r50newton_arcface.txt
│   │   │   └── model-symbol.json
│   │   └── MS1Mretina-resnet50-arcface/
│   │       ├── log_retina_r50_arcface.txt
│   │       └── model-symbol.json
│   ├── parall_module_local_v1.py
│   ├── sample_config.py
│   ├── symbol/
│   │   ├── fdensenet.py
│   │   ├── fmnasnet.py
│   │   ├── fmobilefacenet.py
│   │   ├── fmobilenet.py
│   │   ├── fresnet.py
│   │   ├── memonger.py
│   │   ├── symbol_utils.py
│   │   └── vargfacenet.py
│   ├── train.py
│   ├── train_parall.py
│   └── triplet_image_iter.py
├── image_generation_chainer/
│   ├── __init__.py
│   ├── datasets/
│   │   └── mnist.py
│   ├── dis_models/
│   │   ├── __init__.py
│   │   ├── resblocks_dis.py
│   │   └── snresnet_32.py
│   ├── evaluations/
│   │   ├── __init__.py
│   │   ├── extensions.py
│   │   └── ndb.py
│   ├── gen_models/
│   │   └── cnn_gen_custom_prodpoly.py
│   ├── jobs/
│   │   └── pinet/
│   │       ├── fashionmnist_cnn_prodpoly_linear.yml
│   │       └── train_mn_mnist.py
│   ├── readme.rst
│   ├── source/
│   │   ├── __init__.py
│   │   ├── functions/
│   │   │   ├── __init__.py
│   │   │   ├── cond_bn_wrapper.py
│   │   │   ├── losses.py
│   │   │   └── max_sv.py
│   │   ├── inception/
│   │   │   ├── __init__.py
│   │   │   ├── download.py
│   │   │   ├── example.py
│   │   │   ├── inception_score.py
│   │   │   └── inception_score_tf.py
│   │   ├── links/
│   │   │   ├── __init__.py
│   │   │   ├── categorical_conditional_batch_normalization.py
│   │   │   ├── conditional_batch_normalization.py
│   │   │   ├── resnet_layer.py
│   │   │   ├── sn_convolution_2d.py
│   │   │   ├── sn_convolution_nd.py
│   │   │   ├── sn_dilated_convolution_2d.py
│   │   │   ├── sn_embed_id.py
│   │   │   ├── sn_linear.py
│   │   │   └── sn_symmetric_linear.py
│   │   ├── misc_train_utils.py
│   │   ├── miscs/
│   │   │   ├── __init__.py
│   │   │   ├── model_moiving_average.py
│   │   │   └── random_samples.py
│   │   └── yaml_utils.py
│   └── updaters/
│       └── gans/
│           └── updater.py
├── image_generation_pytorch/
│   ├── FID/
│   │   ├── LICENSE
│   │   ├── README.md
│   │   ├── __init__.py
│   │   ├── fid_score.py
│   │   └── inception.py
│   ├── IS/
│   │   ├── LICENSE.md
│   │   ├── README.md
│   │   └── inception_score.py
│   ├── README.rst
│   ├── data_loader.py
│   ├── logger.py
│   ├── main.py
│   ├── model.py
│   └── solver.py
├── mesh_pi_nets/
│   ├── .gitignore
│   ├── README.md
│   ├── autoencoder_dataset.py
│   ├── datasets/
│   │   ├── COMA/
│   │   │   └── templates/
│   │   │       ├── COMA_downsample/
│   │   │       │   └── downsampling_matrices.pkl
│   │   │       └── template.obj
│   │   └── DFAUST/
│   │       └── templates/
│   │           ├── COMA_downsample/
│   │           │   └── downsampling_matrices.pkl
│   │           └── template.obj
│   ├── mesh_sampling.py
│   ├── models.py
│   ├── shape_data.py
│   ├── spiral_pi_nets.py
│   ├── spiral_utils.py
│   ├── test_funcs.py
│   └── train_funcs.py
└── readme.rst
Download .txt
SYMBOL INDEX (617 symbols across 70 files)

FILE: classification-NO-activation-function/backbones/pinet_1x1_norelu.py
  class BasicBlock (line 17) | class BasicBlock(BaseModule):
    method __init__ (line 40) | def __init__(self,
    method norm1 (line 107) | def norm1(self):
    method norm2 (line 111) | def norm2(self):
    method norm3 (line 115) | def norm3(self):
    method forward (line 118) | def forward(self, x):
  class Bottleneck (line 152) | class Bottleneck(BaseModule):
    method __init__ (line 175) | def __init__(self,
    method norm1 (line 251) | def norm1(self):
    method norm2 (line 255) | def norm2(self):
    method norm3 (line 259) | def norm3(self):
    method forward (line 262) | def forward(self, x):
  function get_expansion (line 297) | def get_expansion(block, expansion=None):
  class ResLayer (line 332) | class ResLayer(nn.Sequential):
    method __init__ (line 354) | def __init__(self,
  class ResNet (line 418) | class ResNet(BaseBackbone):
    method __init__ (line 478) | def __init__(self,
    method make_res_layer (line 563) | def make_res_layer(self, **kwargs):
    method norm1 (line 567) | def norm1(self):
    method _make_stem_layer (line 570) | def _make_stem_layer(self, in_channels, stem_channels):
    method _freeze_stages (line 615) | def _freeze_stages(self):
    method init_weights (line 633) | def init_weights(self):
    method forward (line 648) | def forward(self, x):
    method train (line 664) | def train(self, mode=True):
  class ResNetV1c (line 675) | class ResNetV1c(ResNet):
    method __init__ (line 685) | def __init__(self, **kwargs):
  class ResNetV1d (line 691) | class ResNetV1d(ResNet):
    method __init__ (line 702) | def __init__(self, **kwargs):

FILE: classification-NO-activation-function/backbones/pinet_1x1_relu.py
  class BasicBlock (line 17) | class BasicBlock(BaseModule):
    method __init__ (line 40) | def __init__(self,
    method norm1 (line 107) | def norm1(self):
    method norm2 (line 111) | def norm2(self):
    method norm3 (line 115) | def norm3(self):
    method forward (line 118) | def forward(self, x):
  class Bottleneck (line 152) | class Bottleneck(BaseModule):
    method __init__ (line 175) | def __init__(self,
    method norm1 (line 251) | def norm1(self):
    method norm2 (line 255) | def norm2(self):
    method norm3 (line 259) | def norm3(self):
    method forward (line 262) | def forward(self, x):
  function get_expansion (line 297) | def get_expansion(block, expansion=None):
  class ResLayer (line 332) | class ResLayer(nn.Sequential):
    method __init__ (line 354) | def __init__(self,
  class ResNet (line 418) | class ResNet(BaseBackbone):
    method __init__ (line 478) | def __init__(self,
    method make_res_layer (line 563) | def make_res_layer(self, **kwargs):
    method norm1 (line 567) | def norm1(self):
    method _make_stem_layer (line 570) | def _make_stem_layer(self, in_channels, stem_channels):
    method _freeze_stages (line 615) | def _freeze_stages(self):
    method init_weights (line 633) | def init_weights(self):
    method forward (line 648) | def forward(self, x):
    method train (line 664) | def train(self, mode=True):
  class ResNetV1c (line 675) | class ResNetV1c(ResNet):
    method __init__ (line 685) | def __init__(self, **kwargs):
  class ResNetV1d (line 691) | class ResNetV1d(ResNet):
    method __init__ (line 702) | def __init__(self, **kwargs):

FILE: classification-NO-activation-function/backbones/pinet_norelu.py
  class BasicBlock (line 17) | class BasicBlock(BaseModule):
    method __init__ (line 40) | def __init__(self,
    method norm1 (line 107) | def norm1(self):
    method norm2 (line 111) | def norm2(self):
    method norm3 (line 115) | def norm3(self):
    method forward (line 118) | def forward(self, x):
  class Bottleneck (line 153) | class Bottleneck(BaseModule):
    method __init__ (line 176) | def __init__(self,
    method norm1 (line 252) | def norm1(self):
    method norm2 (line 256) | def norm2(self):
    method norm3 (line 260) | def norm3(self):
    method forward (line 263) | def forward(self, x):
  function get_expansion (line 298) | def get_expansion(block, expansion=None):
  class ResLayer (line 333) | class ResLayer(nn.Sequential):
    method __init__ (line 355) | def __init__(self,
  class ResNet (line 419) | class ResNet(BaseBackbone):
    method __init__ (line 479) | def __init__(self,
    method make_res_layer (line 564) | def make_res_layer(self, **kwargs):
    method norm1 (line 568) | def norm1(self):
    method _make_stem_layer (line 571) | def _make_stem_layer(self, in_channels, stem_channels):
    method _freeze_stages (line 616) | def _freeze_stages(self):
    method init_weights (line 634) | def init_weights(self):
    method forward (line 649) | def forward(self, x):
    method train (line 665) | def train(self, mode=True):
  class ResNetV1c (line 676) | class ResNetV1c(ResNet):
    method __init__ (line 686) | def __init__(self, **kwargs):
  class ResNetV1d (line 692) | class ResNetV1d(ResNet):
    method __init__ (line 703) | def __init__(self, **kwargs):

FILE: classification-NO-activation-function/backbones/pinet_relu.py
  class BasicBlock (line 17) | class BasicBlock(BaseModule):
    method __init__ (line 40) | def __init__(self,
    method norm1 (line 107) | def norm1(self):
    method norm2 (line 111) | def norm2(self):
    method norm3 (line 115) | def norm3(self):
    method forward (line 118) | def forward(self, x):
  class Bottleneck (line 153) | class Bottleneck(BaseModule):
    method __init__ (line 176) | def __init__(self,
    method norm1 (line 252) | def norm1(self):
    method norm2 (line 256) | def norm2(self):
    method norm3 (line 260) | def norm3(self):
    method forward (line 263) | def forward(self, x):
  function get_expansion (line 298) | def get_expansion(block, expansion=None):
  class ResLayer (line 333) | class ResLayer(nn.Sequential):
    method __init__ (line 355) | def __init__(self,
  class ResNet (line 419) | class ResNet(BaseBackbone):
    method __init__ (line 479) | def __init__(self,
    method make_res_layer (line 564) | def make_res_layer(self, **kwargs):
    method norm1 (line 568) | def norm1(self):
    method _make_stem_layer (line 571) | def _make_stem_layer(self, in_channels, stem_channels):
    method _freeze_stages (line 616) | def _freeze_stages(self):
    method init_weights (line 634) | def init_weights(self):
    method forward (line 649) | def forward(self, x):
    method train (line 665) | def train(self, mode=True):
  class ResNetV1c (line 676) | class ResNetV1c(ResNet):
    method __init__ (line 686) | def __init__(self, **kwargs):
  class ResNetV1d (line 692) | class ResNetV1d(ResNet):
    method __init__ (line 703) | def __init__(self, **kwargs):

FILE: classification-NO-activation-function/backbones/resnet_norelu.py
  class BasicBlock (line 17) | class BasicBlock(BaseModule):
    method __init__ (line 40) | def __init__(self,
    method norm1 (line 107) | def norm1(self):
    method norm2 (line 111) | def norm2(self):
    method forward (line 118) | def forward(self, x):
  class Bottleneck (line 152) | class Bottleneck(BaseModule):
    method __init__ (line 175) | def __init__(self,
    method norm1 (line 251) | def norm1(self):
    method norm2 (line 255) | def norm2(self):
    method norm3 (line 259) | def norm3(self):
    method forward (line 262) | def forward(self, x):
  function get_expansion (line 297) | def get_expansion(block, expansion=None):
  class ResLayer (line 332) | class ResLayer(nn.Sequential):
    method __init__ (line 354) | def __init__(self,
  class ResNet (line 418) | class ResNet(BaseBackbone):
    method __init__ (line 478) | def __init__(self,
    method make_res_layer (line 563) | def make_res_layer(self, **kwargs):
    method norm1 (line 567) | def norm1(self):
    method _make_stem_layer (line 570) | def _make_stem_layer(self, in_channels, stem_channels):
    method _freeze_stages (line 615) | def _freeze_stages(self):
    method init_weights (line 633) | def init_weights(self):
    method forward (line 648) | def forward(self, x):
    method train (line 664) | def train(self, mode=True):
  class ResNetV1c (line 675) | class ResNetV1c(ResNet):
    method __init__ (line 685) | def __init__(self, **kwargs):
  class ResNetV1d (line 691) | class ResNetV1d(ResNet):
    method __init__ (line 702) | def __init__(self, **kwargs):

FILE: face_recognition/config.py
  function generate_config (line 205) | def generate_config(_network, _dataset, _loss):

FILE: face_recognition/data/build_eval_pack.py
  function to_rgb (line 17) | def to_rgb(img):
  function IOU (line 24) | def IOU(Reframe,GTframe):
  function get_norm_crop (line 68) | def get_norm_crop(image_path):

FILE: face_recognition/data/rec2image.py
  function main (line 16) | def main(args):

FILE: face_recognition/eval/lfw.py
  function calculate_roc (line 42) | def calculate_roc(thresholds, embeddings1, embeddings2, actual_issame, n...
  function calculate_accuracy (line 91) | def calculate_accuracy(threshold, dist, actual_issame):
  function calculate_val (line 105) | def calculate_val(thresholds, embeddings1, embeddings2, actual_issame, f...
  function calculate_val_far (line 139) | def calculate_val_far(threshold, dist, actual_issame):
  function evaluate (line 149) | def evaluate(embeddings, actual_issame, nrof_folds=10, pca = 0):
  function get_paths (line 161) | def get_paths(lfw_dir, pairs, file_ext):
  function read_pairs (line 185) | def read_pairs(pairs_filename):
  function load_dataset (line 194) | def load_dataset(lfw_dir, image_size):
  function test (line 218) | def test(lfw_set, mx_model, batch_size):

FILE: face_recognition/eval/verification.py
  class LFold (line 47) | class LFold:
    method __init__ (line 48) | def __init__(self, n_splits = 2, shuffle = False):
    method split (line 53) | def split(self, indices):
  function calculate_roc (line 60) | def calculate_roc(thresholds, embeddings1, embeddings2, actual_issame, n...
  function calculate_accuracy (line 110) | def calculate_accuracy(threshold, dist, actual_issame):
  function calculate_val (line 124) | def calculate_val(thresholds, embeddings1, embeddings2, actual_issame, f...
  function calculate_val_far (line 158) | def calculate_val_far(threshold, dist, actual_issame):
  function evaluate (line 170) | def evaluate(embeddings, actual_issame, nrof_folds=10, pca = 0):
  function load_bin (line 182) | def load_bin(path, image_size):
  function test (line 208) | def test(data_set, mx_model, batch_size, nfolds=10, data_extra = None, l...
  function test_badcase (line 288) | def test_badcase(data_set, mx_model, batch_size, name='', data_extra = N...
  function dumpR (line 464) | def dumpR(data_set, mx_model, batch_size, name='', data_extra = None, la...

FILE: face_recognition/flops_counter.py
  function is_no_bias (line 18) | def is_no_bias(attr):
  function count_fc_flops (line 24) | def count_fc_flops(input_filter, output_filter, attr):
  function count_conv_flops (line 32) | def count_conv_flops(input_shape, output_shape, attr):
  function count_flops (line 48) | def count_flops(sym, **data_shapes):
  function flops_str (line 86) | def flops_str(FLOPs):

FILE: face_recognition/image_iter.py
  class FaceImageIter (line 24) | class FaceImageIter(io.DataIter):
    method __init__ (line 26) | def __init__(self, batch_size, data_shape,
    method reset (line 92) | def reset(self):
    method num_samples (line 101) | def num_samples(self):
    method next_sample (line 104) | def next_sample(self):
    method brightness_aug (line 130) | def brightness_aug(self, src, x):
    method contrast_aug (line 135) | def contrast_aug(self, src, x):
    method saturation_aug (line 144) | def saturation_aug(self, src, x):
    method color_aug (line 154) | def color_aug(self, img, x):
    method mirror_aug (line 164) | def mirror_aug(self, img):
    method compress_aug (line 171) | def compress_aug(self, img):
    method next (line 183) | def next(self):
    method check_data_shape (line 253) | def check_data_shape(self, data_shape):
    method check_valid_image (line 260) | def check_valid_image(self, data):
    method imdecode (line 265) | def imdecode(self, s):
    method read_image (line 271) | def read_image(self, fname):
    method augmentation_transform (line 282) | def augmentation_transform(self, data):
    method postprocess_data (line 288) | def postprocess_data(self, datum):
  class FaceImageIterList (line 292) | class FaceImageIterList(io.DataIter):
    method __init__ (line 293) | def __init__(self, iter_list):
    method reset (line 300) | def reset(self):
    method next (line 303) | def next(self):

FILE: face_recognition/metric.py
  class AccMetric (line 4) | class AccMetric(mx.metric.EvalMetric):
    method __init__ (line 5) | def __init__(self):
    method update (line 13) | def update(self, labels, preds):
  class LossValueMetric (line 29) | class LossValueMetric(mx.metric.EvalMetric):
    method __init__ (line 30) | def __init__(self):
    method update (line 37) | def update(self, labels, preds):

FILE: face_recognition/parall_module_local_v1.py
  class ParallModule (line 23) | class ParallModule(BaseModule):
    method __init__ (line 24) | def __init__(self, symbol, data_names, label_names,
    method _reset_bind (line 71) | def _reset_bind(self):
    method data_names (line 76) | def data_names(self):
    method output_names (line 80) | def output_names(self):
    method data_shapes (line 84) | def data_shapes(self):
    method label_shapes (line 89) | def label_shapes(self):
    method output_shapes (line 94) | def output_shapes(self):
    method get_export_params (line 98) | def get_export_params(self):
    method get_params (line 105) | def get_params(self):
    method set_params (line 118) | def set_params(self, arg_params, aux_params, allow_missing=False, forc...
    method init_params (line 139) | def init_params(self, initializer=Uniform(0.01), arg_params=None, aux_...
    method bind (line 157) | def bind(self, data_shapes, label_shapes=None, for_training=True,
    method init_optimizer (line 186) | def init_optimizer(self, kvstore='local', optimizer='sgd',
    method kv_push (line 200) | def kv_push(self, key, value):
    method forward (line 209) | def forward(self, data_batch, is_train=None):
    method get_ndarray (line 231) | def get_ndarray(self, context, name, shape):
    method get_ndarray2 (line 241) | def get_ndarray2(self, context, name, arr):
    method backward (line 252) | def backward(self, out_grads=None):
    method update (line 321) | def update(self):
    method get_outputs (line 329) | def get_outputs(self, merge_multi_context=True):
    method get_input_grads (line 334) | def get_input_grads(self, merge_multi_context=True):
    method update_metric (line 338) | def update_metric(self, eval_metric, labels):
    method install_monitor (line 345) | def install_monitor(self, mon):
    method forward_backward (line 350) | def forward_backward(self, data_batch):
    method fit (line 355) | def fit(self, train_data, eval_data=None, eval_metric='acc',

FILE: face_recognition/sample_config.py
  function generate_config (line 203) | def generate_config(_network, _dataset, _loss):

FILE: face_recognition/symbol/fdensenet.py
  function Act (line 33) | def Act():
  function _make_dense_block (line 39) | def _make_dense_block(num_layers, bn_size, growth_rate, dropout, stage_i...
  function _make_dense_layer (line 46) | def _make_dense_layer(growth_rate, bn_size, dropout):
  function _make_transition (line 65) | def _make_transition(num_output_features):
  class DenseNet (line 75) | class DenseNet(nn.HybridBlock):
    method __init__ (line 95) | def __init__(self, num_init_features, growth_rate, block_config,
    method hybrid_forward (line 121) | def hybrid_forward(self, F, x):
  function get_symbol (line 135) | def get_symbol():

FILE: face_recognition/symbol/fmnasnet.py
  function Act (line 12) | def Act():
  function ConvBlock (line 18) | def ConvBlock(channels, kernel_size, strides, **kwargs):
  function Conv1x1 (line 29) | def Conv1x1(channels, is_linear=False, **kwargs):
  function DWise (line 41) | def DWise(channels, strides, kernel_size=3, **kwargs):
  class SepCONV (line 52) | class SepCONV(nn.HybridBlock):
    method __init__ (line 53) | def __init__(self, inp, output, kernel_size, depth_multiplier=1, with_...
    method hybrid_forward (line 80) | def hybrid_forward(self, F ,x):
  class ExpandedConv (line 88) | class ExpandedConv(nn.HybridBlock):
    method __init__ (line 89) | def __init__(self, inp, oup, t, strides, kernel=3, same_shape=True, **...
    method hybrid_forward (line 101) | def hybrid_forward(self, F, x):
  function ExpandedConvSequence (line 107) | def ExpandedConvSequence(t, k, inp, oup, repeats, first_strides, **kwargs):
  class MNasNet (line 117) | class MNasNet(nn.HybridBlock):
    method __init__ (line 118) | def __init__(self, m=1.0, **kwargs):
    method hybrid_forward (line 149) | def hybrid_forward(self, F, x):
    method num_output_channel (line 154) | def num_output_channel(self):
  function get_symbol (line 157) | def get_symbol():

FILE: face_recognition/symbol/fmobilefacenet.py
  function Act (line 10) | def Act(data, act_type, name):
  function Conv (line 18) | def Conv(data, num_filter=1, kernel=(1, 1), stride=(1, 1), pad=(0, 0), n...
  function Linear (line 24) | def Linear(data, num_filter=1, kernel=(1, 1), stride=(1, 1), pad=(0, 0),...
  function ConvOnly (line 29) | def ConvOnly(data, num_filter=1, kernel=(1, 1), stride=(1, 1), pad=(0, 0...
  function DResidual (line 34) | def DResidual(data, num_out=1, kernel=(3, 3), stride=(2, 2), pad=(1, 1),...
  function Residual (line 40) | def Residual(data, num_block=1, num_out=1, kernel=(3, 3), stride=(1, 1),...
  function get_symbol (line 49) | def get_symbol():

FILE: face_recognition/symbol/fmobilenet.py
  function Act (line 25) | def Act(data, act_type, name):
  function Conv (line 33) | def Conv(data, num_filter=1, kernel=(1, 1), stride=(1, 1), pad=(0, 0), n...
  function ConvOnly (line 39) | def ConvOnly(data, num_filter=1, kernel=(1, 1), stride=(1, 1), pad=(0, 0...
  function get_symbol (line 43) | def get_symbol():

FILE: face_recognition/symbol/fresnet.py
  function Conv (line 39) | def Conv(**kwargs):
  function Act (line 48) | def Act(data, act_type, name):
  function residual_unit_v1 (line 55) | def residual_unit_v1(data, num_filter, stride, dim_match, name, bottle_n...
  function residual_unit_v1_L (line 144) | def residual_unit_v1_L(data, num_filter, stride, dim_match, name, bottle...
  function residual_unit_v2 (line 233) | def residual_unit_v2(data, num_filter, stride, dim_match, name, bottle_n...
  function residual_unit_v3 (line 318) | def residual_unit_v3(data, num_filter, stride, dim_match, name, bottle_n...
  function residual_unit_v3_x (line 416) | def residual_unit_v3_x(data, num_filter, stride, dim_match, name, bottle...
  function residual_unit (line 480) | def residual_unit(data, num_filter, stride, dim_match, name, bottle_neck...
  function resnet (line 496) | def resnet(units, num_stages, filter_list, num_classes, bottle_neck):
  function get_symbol (line 584) | def get_symbol():

FILE: face_recognition/symbol/memonger.py
  function prod (line 4) | def prod(shape):
  function is_param (line 13) | def is_param(name):
  function make_mirror_plan (line 29) | def make_mirror_plan(sym, threshold, plan_info=None, **kwargs):
  function get_cost (line 109) | def get_cost(sym, type_dict=None, **kwargs):
  function search_plan (line 122) | def search_plan(sym, ntrial=6, type_dict=None, **kwargs):

FILE: face_recognition/symbol/symbol_utils.py
  function Conv (line 7) | def Conv(**kwargs):
  function Act (line 15) | def Act(data, act_type, name):
  function Linear (line 24) | def Linear(data, num_filter=1, kernel=(1, 1), stride=(1, 1), pad=(0, 0),...
  function get_fc1 (line 29) | def get_fc1(last_conv, num_classes, fc_type, input_channel=512):
  function residual_unit_v3 (line 114) | def residual_unit_v3(data, num_filter, stride, dim_match, name, **kwargs):
  function residual_unit_v1l (line 157) | def residual_unit_v1l(data, num_filter, stride, dim_match, name, bottle_...
  function get_head (line 246) | def get_head(data, version_input, num_filter):

FILE: face_recognition/symbol/vargfacenet.py
  function Act (line 39) | def Act(data, act_type, name):
  function get_setting_params (line 47) | def get_setting_params(**kwargs):
  function se_block (line 74) | def se_block(data, num_filter, setting_params, name):
  function separable_conv2d (line 103) | def separable_conv2d(data,
  function vargnet_block (line 173) | def vargnet_block(data,
  function vargnet_branch_merge_block (line 248) | def vargnet_branch_merge_block(data,
  function add_vargnet_conv_block (line 330) | def add_vargnet_conv_block(data,
  function add_head_block (line 374) | def add_head_block(data,
  function add_emb_block (line 433) | def add_emb_block(data,
  function get_symbol (line 504) | def get_symbol():

FILE: face_recognition/train.py
  function parse_args (line 40) | def parse_args():
  function get_symbol (line 64) | def get_symbol(args):
  function train_net (line 149) | def train_net(args):
  function main (line 372) | def main():

FILE: face_recognition/train_parall.py
  function parse_args (line 45) | def parse_args():
  function get_symbol_embedding (line 71) | def get_symbol_embedding():
  function get_symbol_arcface (line 80) | def get_symbol_arcface(args):
  function train_net (line 123) | def train_net(args):
  function main (line 347) | def main():

FILE: face_recognition/triplet_image_iter.py
  class FaceImageIter (line 29) | class FaceImageIter(io.DataIter):
    method __init__ (line 31) | def __init__(self, batch_size, data_shape,
    method pairwise_dists (line 112) | def pairwise_dists(self, embeddings):
    method pick_triplets (line 133) | def pick_triplets(self, embeddings, nrof_images_per_class):
    method triplet_reset (line 173) | def triplet_reset(self):
    method time_reset (line 191) | def time_reset(self):
    method time_elapsed (line 194) | def time_elapsed(self):
    method select_triplets (line 200) | def select_triplets(self):
    method hard_mining_reset (line 294) | def hard_mining_reset(self):
    method reset (line 384) | def reset(self):
    method num_samples (line 422) | def num_samples(self):
    method next_sample (line 425) | def next_sample(self):
    method brightness_aug (line 438) | def brightness_aug(self, src, x):
    method contrast_aug (line 443) | def contrast_aug(self, src, x):
    method saturation_aug (line 452) | def saturation_aug(self, src, x):
    method color_aug (line 462) | def color_aug(self, img, x):
    method mirror_aug (line 471) | def mirror_aug(self, img):
    method next (line 479) | def next(self):
    method check_data_shape (line 549) | def check_data_shape(self, data_shape):
    method check_valid_image (line 556) | def check_valid_image(self, data):
    method imdecode (line 561) | def imdecode(self, s):
    method read_image (line 567) | def read_image(self, fname):
    method augmentation_transform (line 578) | def augmentation_transform(self, data):
    method postprocess_data (line 584) | def postprocess_data(self, datum):
  class FaceImageIterList (line 588) | class FaceImageIterList(io.DataIter):
    method __init__ (line 589) | def __init__(self, iter_list):
    method reset (line 596) | def reset(self):
    method next (line 599) | def next(self):

FILE: image_generation_chainer/datasets/mnist.py
  class MnistDb (line 6) | class MnistDb(chainer.dataset.DatasetMixin):
    method __init__ (line 7) | def __init__(self, path, ims_suff='train_ims.npy', labels_suff=None, i...
    method __len__ (line 40) | def __len__(self):
    method get_example (line 43) | def get_example(self, i):

FILE: image_generation_chainer/dis_models/resblocks_dis.py
  function _downsample (line 8) | def _downsample(x):
  class Block (line 13) | class Block(chainer.Chain):
    method __init__ (line 14) | def __init__(self, in_channels, out_channels, hidden_channels=None, ks...
    method residual (line 38) | def residual(self, x):
    method shortcut (line 48) | def shortcut(self, x):
    method __call__ (line 58) | def __call__(self, x):
  class OptimizedBlock (line 68) | class OptimizedBlock(chainer.Chain):
    method __init__ (line 69) | def __init__(self, in_channels, out_channels, ksize=3, pad=1,
    method residual (line 87) | def residual(self, x):
    method shortcut (line 96) | def shortcut(self, x):
    method __call__ (line 100) | def __call__(self, x):

FILE: image_generation_chainer/dis_models/snresnet_32.py
  class SNResNetProjectionDiscriminator (line 8) | class SNResNetProjectionDiscriminator(chainer.Chain):
    method __init__ (line 9) | def __init__(self, ch=128, n_classes=0, activation=F.relu, sn=False, c...
    method __call__ (line 22) | def __call__(self, x, y=None, return_feature=False):

FILE: image_generation_chainer/evaluations/extensions.py
  function gen_images (line 36) | def gen_images(gen, n=50000, batchsize=100, seed=None, z=None):
  function gen_images_with_condition (line 56) | def gen_images_with_condition(gen, c=0, n=500, batchsize=100, z=None):
  function sample_generate_light (line 77) | def sample_generate_light(gen, dst, rows=5, cols=5, batchsize=5, seed=0):
  function sample_generate (line 98) | def sample_generate(gen, dst, rows=10, cols=10, batchsize=10, seed=0):
  function sample_generate_conditional (line 122) | def sample_generate_conditional(gen, dst, rows=10, n_classes=1000, seed=...
  function divergence_gen (line 154) | def divergence_gen(gen, gt_db, batch=1000, metric='kl', normalize=False,
  function divergence_trainer (line 207) | def divergence_trainer(gen, db, metric='kl', export_best=True, **kwargs):
  function load_inception_model (line 235) | def load_inception_model(path=None, gpu=0):
  function calc_inception (line 244) | def calc_inception(gen, batchsize=10, dst=None, path=None, n_ims=50000, ...
  function get_mean_cov (line 269) | def get_mean_cov(model, ims, batch_size=100, verbose=False):
  function monitor_largest_singular_values (line 297) | def monitor_largest_singular_values(dis, dst):
  function FID (line 329) | def FID(m0, c0, m1, c1):
  function calc_FID (line 336) | def calc_FID(gen, batchsize=100, stat_file="%s/cifar-10-fid.npz" % os.pa...
  function get_batch (line 366) | def get_batch(iterator, xp):
  function validation_loss_and_acc (line 386) | def validation_loss_and_acc(cls, iterator, n=50000, dis=None):

FILE: image_generation_chainer/evaluations/ndb.py
  class NDB (line 8) | class NDB:
    method __init__ (line 9) | def __init__(self, training_data=None, number_of_bins=100, significanc...
    method construct_bins (line 53) | def construct_bins(self, training_samples, bins_file):
    method evaluate (line 95) | def evaluate(self, query_samples, model_label=None):
    method print_results (line 129) | def print_results(self):
    method plot_results (line 135) | def plot_results(self, models_to_plot=None):
    method __calculate_bin_proportions (line 174) | def __calculate_bin_proportions(self, samples):
    method __read_from_bins_file (line 197) | def __read_from_bins_file(self, bins_file):
    method __write_to_bins_file (line 210) | def __write_to_bins_file(self, bins_file):
    method two_proportions_z_test (line 222) | def two_proportions_z_test(p1, n1, p2, n2, significance_level, z_thres...
    method jensen_shannon_divergence (line 235) | def jensen_shannon_divergence(p, q):
    method kl_divergence (line 243) | def kl_divergence(p, q):

FILE: image_generation_chainer/gen_models/cnn_gen_custom_prodpoly.py
  function return_norm (line 18) | def return_norm(norm):
  function _upsample (line 29) | def _upsample(x):
  class ProdPolyConvGenerator (line 34) | class ProdPolyConvGenerator(chainer.Chain):
    method __init__ (line 35) | def __init__(self, layer_d, use_bn=False, sn=False, out_ch=2, mult_lat...
    method return_injected (line 252) | def return_injected(self, h, z, n_layer, mult_until_exec=None):
    method prod_poly_FC (line 278) | def prod_poly_FC(self, z, mult_until_exec, batchsize=None, y=None):
    method __call__ (line 349) | def __call__(self, batchsize=None, y=None, z=None, mult_until_exec=Non...
    method __str__ (line 402) | def __str__(self, **kwargs):

FILE: image_generation_chainer/jobs/pinet/train_mn_mnist.py
  function make_optimizer (line 24) | def make_optimizer(model, comm, alpha=0.001, beta1=0.9, beta2=0.999, chm...
  function main (line 37) | def main():

FILE: image_generation_chainer/source/functions/cond_bn_wrapper.py
  function cond_bn_wrapper (line 13) | def cond_bn_wrapper(x, c, bn, gamma, beta):

FILE: image_generation_chainer/source/functions/losses.py
  function _tensor_to_matrix (line 7) | def _tensor_to_matrix(tensor, axis=0):
  function cosine_loss (line 19) | def cosine_loss(tens1, tens2, absol=True):
  function decov_loss (line 43) | def decov_loss(tensor, xp=None, axis=1):
  function decov_loss_matrix (line 72) | def decov_loss_matrix(tensor, xp=None, axis=1):
  function loss_revKL_dis (line 106) | def loss_revKL_dis(dis_fake, dis_real):
  function loss_revKL_gen (line 113) | def loss_revKL_gen(dis_fake):
  function loss_dcgan_dis (line 119) | def loss_dcgan_dis(dis_fake, dis_real):
  function loss_dcgan_gen (line 126) | def loss_dcgan_gen(dis_fake):
  function loss_hinge_dis (line 132) | def loss_hinge_dis(dis_fake, dis_real):
  function loss_hinge_gen (line 138) | def loss_hinge_gen(dis_fake):
  function loss_wgan_dis (line 144) | def loss_wgan_dis(dis_fake, dis_real):
  function loss_wgan_gen (line 149) | def loss_wgan_gen(dis_fake):
  function gradient_penalty (line 154) | def gradient_penalty(dis_output, x):
  function gradient_penalty_wgangp (line 160) | def gradient_penalty_wgangp(dis_output, x, lipnorm):

FILE: image_generation_chainer/source/functions/max_sv.py
  function _l2normalize_gpu (line 9) | def _l2normalize_gpu(v, eps=1e-12):
  function _l2normalize_cpu (line 20) | def _l2normalize_cpu(v, eps=1e-12):
  function max_singular_value (line 24) | def max_singular_value(W, u=None, Ip=1):

FILE: image_generation_chainer/source/inception/download.py
  function parse_args (line 27) | def parse_args():
  function copy_conv (line 33) | def copy_conv(sess, tftensor, layer):
  function copy_bn (line 45) | def copy_bn(sess, tftensor, layer):
  function copy_inception (line 68) | def copy_inception(sess, model):
  function download_tf_params (line 180) | def download_tf_params():
  function set_tf_params (line 203) | def set_tf_params(model, write_graph=False):
  function main (line 224) | def main(args):

FILE: image_generation_chainer/source/inception/example.py
  function parse_args (line 11) | def parse_args():
  function main (line 19) | def main(args):

FILE: image_generation_chainer/source/inception/inception_score.py
  function inception_forward (line 10) | def inception_forward(model, ims, batch_size):
  function inception_score (line 43) | def inception_score(model, ims, batch_size=100, splits=10, verbose=True):
  function inception_accuracy (line 78) | def inception_accuracy(model, ims, labels, batch_size=100, splits=10, la...
  class Mixed (line 115) | class Mixed(Chain):
    method __init__ (line 116) | def __init__(self, trunk):
    method __call__ (line 122) | def __call__(self, x):
  class Tower (line 130) | class Tower(Chain):
    method __init__ (line 131) | def __init__(self, trunk):
    method __call__ (line 138) | def __call__(self, x):
  function _average_pooling_2d (line 151) | def _average_pooling_2d(h):
  function _max_pooling_2d (line 155) | def _max_pooling_2d(h):
  function _max_pooling_2d_320 (line 159) | def _max_pooling_2d_320(h):
  class Inception (line 163) | class Inception(Chain):
    method __init__ (line 164) | def __init__(self):
    method __call__ (line 587) | def __call__(self, x, get_feature=False):

FILE: image_generation_chainer/source/inception/inception_score_tf.py
  function inception_forward (line 26) | def inception_forward(images, layer):
  function get_mean_and_cov (line 49) | def get_mean_and_cov(images):
  function get_fid (line 56) | def get_fid(images, ref_stats=None, images_ref=None, splits=10):
  function get_inception_score (line 75) | def get_inception_score(images, splits=10):
  function get_inception_accuracy (line 88) | def get_inception_accuracy(images, labels, lab_range=None):
  function _init_inception (line 115) | def _init_inception():

FILE: image_generation_chainer/source/links/categorical_conditional_batch_normalization.py
  class CategoricalConditionalBatchNormalization (line 16) | class CategoricalConditionalBatchNormalization(ConditionalBatchNormaliza...
    method __init__ (line 46) | def __init__(self, size, n_cat, decay=0.9, eps=2e-5, dtype=numpy.float32,
    method __call__ (line 63) | def __call__(self, x, c, **kwargs):
  function start_finetuning (line 101) | def start_finetuning(self):

FILE: image_generation_chainer/source/links/conditional_batch_normalization.py
  class ConditionalBatchNormalization (line 16) | class ConditionalBatchNormalization(chainer.Chain):
    method __init__ (line 46) | def __init__(self, size, n_cat, decay=0.9, eps=2e-5, dtype=numpy.float...
    method __call__ (line 62) | def __call__(self, x, gamma, beta, **kwargs):
  function start_finetuning (line 119) | def start_finetuning(self):

FILE: image_generation_chainer/source/links/resnet_layer.py
  class ResNetLayers (line 36) | class ResNetLayers(link.Chain):
    method __init__ (line 75) | def __init__(self, pretrained_model, n_layers):
    method functions (line 112) | def functions(self):
    method available_layers (line 126) | def available_layers(self):
    method convert_caffemodel_to_npz (line 130) | def convert_caffemodel_to_npz(cls, path_caffemodel, path_npz, n_layers...
    method __call__ (line 153) | def __call__(self, x, layers=['prob'], **kwargs):
    method extract (line 187) | def extract(self, images, layers=['pool5'], size=(224, 224), **kwargs):
    method predict (line 226) | def predict(self, images, oversample=True):
  class ResNet50Layers (line 255) | class ResNet50Layers(ResNetLayers):
    method __init__ (line 298) | def __init__(self, pretrained_model='auto'):
  class ResNet101Layers (line 304) | class ResNet101Layers(ResNetLayers):
    method __init__ (line 343) | def __init__(self, pretrained_model='auto'):
  class ResNet152Layers (line 349) | class ResNet152Layers(ResNetLayers):
    method __init__ (line 387) | def __init__(self, pretrained_model='auto'):
  function prepare (line 393) | def prepare(image, size=(224, 224)):
  class BuildingBlock (line 437) | class BuildingBlock(link.Chain):
    method __init__ (line 449) | def __init__(self, n_layer, in_channels, mid_channels,
    method __call__ (line 462) | def __call__(self, x):
    method forward (line 469) | def forward(self):
  class BottleneckA (line 473) | class BottleneckA(link.Chain):
    method __init__ (line 484) | def __init__(self, in_channels, mid_channels, out_channels,
    method __call__ (line 505) | def __call__(self, x):
  class BottleneckB (line 513) | class BottleneckB(link.Chain):
    method __init__ (line 522) | def __init__(self, in_channels, mid_channels, initialW=None):
    method __call__ (line 538) | def __call__(self, x):
  function _global_average_pooling_2d (line 545) | def _global_average_pooling_2d(x):
  function _transfer_components (line 552) | def _transfer_components(src, dst_conv, dst_bn, bname, cname):
  function _transfer_bottleneckA (line 563) | def _transfer_bottleneckA(src, dst, name):
  function _transfer_bottleneckB (line 570) | def _transfer_bottleneckB(src, dst, name):
  function _transfer_block (line 576) | def _transfer_block(src, dst, names):
  function _transfer_resnet50 (line 583) | def _transfer_resnet50(src, dst):
  function _transfer_resnet101 (line 600) | def _transfer_resnet101(src, dst):
  function _transfer_resnet152 (line 617) | def _transfer_resnet152(src, dst):
  function _make_npz (line 635) | def _make_npz(path_npz, path_caffemodel, model, n_layers):
  function _retrieve (line 655) | def _retrieve(n_layers, name_npz, name_caffemodel, model):

FILE: image_generation_chainer/source/links/sn_convolution_2d.py
  class SNConvolution2D (line 10) | class SNConvolution2D(Convolution2D):
    method __init__ (line 58) | def __init__(self, in_channels, out_channels, ksize, stride=1, pad=0,
    method W_bar (line 70) | def W_bar(self):
    method _initialize_params (line 87) | def _initialize_params(self, in_size):
    method __call__ (line 95) | def __call__(self, x):

FILE: image_generation_chainer/source/links/sn_convolution_nd.py
  class SNConvolutionND (line 12) | class SNConvolutionND(link.Link):
    method __init__ (line 58) | def __init__(self, ndim, in_channels, out_channels, ksize, stride=1, p...
    method W_bar (line 90) | def W_bar(self):
    method __call__ (line 106) | def __call__(self, x):

FILE: image_generation_chainer/source/links/sn_dilated_convolution_2d.py
  class SNDilatedConvolution2D (line 16) | class SNDilatedConvolution2D(DilatedConvolution2D):
    method __init__ (line 22) | def __init__(self, in_channels, out_channels, ksize=None, stride=1, pa...
    method W_bar (line 48) | def W_bar(self):
    method _initialize_params (line 63) | def _initialize_params(self, in_channels):
    method __call__ (line 71) | def __call__(self, x):
  function _pair (line 84) | def _pair(x):

FILE: image_generation_chainer/source/links/sn_embed_id.py
  class SNEmbedID (line 11) | class SNEmbedID(link.Link):
    method __init__ (line 39) | def __init__(self, in_size, out_size, initialW=None, ignore_label=None...
    method W_bar (line 52) | def W_bar(self):
    method __call__ (line 65) | def __call__(self, x):

FILE: image_generation_chainer/source/links/sn_linear.py
  class SNLinear (line 9) | class SNLinear(Linear):
    method __init__ (line 46) | def __init__(self, in_size, out_size, use_gamma=False, nobias=False,
    method W_bar (line 58) | def W_bar(self):
    method _initialize_params (line 74) | def _initialize_params(self, in_size):
    method __call__ (line 81) | def __call__(self, x):

FILE: image_generation_chainer/source/links/sn_symmetric_linear.py
  class SNSymmetricLinear (line 9) | class SNSymmetricLinear(Linear):
    method __init__ (line 43) | def __init__(self, in_size, out_size, use_gamma=False, nobias=False,
    method W_sym (line 53) | def W_sym(self):
    method W_bar (line 57) | def W_bar(self):
    method _initialize_params (line 69) | def _initialize_params(self, in_size):
    method __call__ (line 76) | def __call__(self, x):

FILE: image_generation_chainer/source/misc_train_utils.py
  function printtime (line 18) | def printtime(msg, time_format='%a %d/%m %H:%M:%S'):
  function get_by_nested_path (line 26) | def get_by_nested_path(root, items):
  function get_config_value (line 31) | def get_config_value(config, path, default=None):
  function create_result_dir (line 44) | def create_result_dir(result_dir, config_path, config):
  function load_models (line 67) | def load_models(config):
  function load_models_cgan (line 75) | def load_models_cgan(config, rocgan=False):
  function ensure_config_paths (line 93) | def ensure_config_paths(config, pb=None, verbose=True):
  function moving_average (line 135) | def moving_average(values, n=3):
  function plot_losses_log (line 142) | def plot_losses_log(pout, savefig=True, title_len=30, name_out='losses.p...

FILE: image_generation_chainer/source/miscs/model_moiving_average.py
  function copypersistents (line 5) | def copypersistents(src, dst):
  function namedpersistents (line 19) | def namedpersistents(src):
  function apply_exponential_averaging (line 27) | def apply_exponential_averaging(src_model, dst_model, alpha):
  class ModelMovingAverage (line 46) | class ModelMovingAverage(object):
    method __init__ (line 49) | def __init__(self, alpha, model=None):
    method update (line 53) | def update(self, src_model):
    method copy_avg_model_to (line 58) | def copy_avg_model_to(self, model):
    method set_avg_model (line 63) | def set_avg_model(self, model):

FILE: image_generation_chainer/source/miscs/random_samples.py
  function sample_continuous (line 5) | def sample_continuous(dim, batchsize, distribution='normal', xp=np):
  function sample_categorical (line 22) | def sample_categorical(n_cat, batchsize, distribution='uniform', xp=np, ...
  function sample_from_categorical_distribution (line 31) | def sample_from_categorical_distribution(batch_probs):

FILE: image_generation_chainer/source/yaml_utils.py
  class Config (line 15) | class Config(object):
    method __init__ (line 16) | def __init__(self, config_dict):
    method __getattr__ (line 19) | def __getattr__(self, key):
    method __getitem__ (line 25) | def __getitem__(self, key):
    method __repr__ (line 28) | def __repr__(self):
  function load_dataset (line 32) | def load_dataset(config, validation=False, valid_path=None):
  function load_module (line 51) | def load_module(fn, name):
  function load_model (line 58) | def load_model(model_fn, model_name, args=None, GPU=0):
  function load_updater_class (line 66) | def load_updater_class(config):

FILE: image_generation_chainer/updaters/gans/updater.py
  class Updater (line 10) | class Updater(chainer.training.StandardUpdater):
    method __init__ (line 11) | def __init__(self, *args, iter_incndis=None, iter_ndis=1, start_ndison...
    method _generate_samples (line 39) | def _generate_samples(self, n_gen_samples=None):
    method get_batch (line 50) | def get_batch(self, xp):
    method update_core (line 61) | def update_core(self):

FILE: image_generation_pytorch/FID/fid_score.py
  function tqdm (line 49) | def tqdm(x): return x
  function get_activations (line 67) | def get_activations(files, model, batch_size=50, dims=2048,
  function calculate_frechet_distance (line 136) | def calculate_frechet_distance(mu1, sigma1, mu2, sigma2, eps=1e-6):
  function calculate_activation_statistics (line 193) | def calculate_activation_statistics(files, model, batch_size=50,
  function _compute_statistics_of_path (line 218) | def _compute_statistics_of_path(path, model, batch_size, dims, cuda):
  function calculate_fid_given_paths (line 230) | def calculate_fid_given_paths(paths, batch_size, cuda, dims):

FILE: image_generation_pytorch/FID/inception.py
  class InceptionV3 (line 6) | class InceptionV3(nn.Module):
    method __init__ (line 21) | def __init__(self,
    method forward (line 107) | def forward(self, inp):

FILE: image_generation_pytorch/IS/inception_score.py
  function inception_score (line 12) | def inception_score(imgs, cuda=True, batch_size=1, resize=True, splits=1):

FILE: image_generation_pytorch/data_loader.py
  function get_loader (line 6) | def get_loader(data_path, batch_size, mode, num_workers=4):

FILE: image_generation_pytorch/logger.py
  class Logger (line 11) | class Logger(object):
    method __init__ (line 13) | def __init__(self, log_dir):
    method scalar_summary (line 17) | def scalar_summary(self, tag, value, step):
    method image_summary (line 22) | def image_summary(self, tag, images, step):
    method histo_summary (line 45) | def histo_summary(self, tag, values, step, bins=1000):

FILE: image_generation_pytorch/main.py
  function save_config (line 9) | def save_config(config, shared_path):
  function str2bool (line 16) | def str2bool(v):
  function get_time (line 25) | def get_time():
  function main (line 29) | def main(config):

FILE: image_generation_pytorch/model.py
  class Generator (line 9) | class Generator(nn.Module):
    method __init__ (line 10) | def __init__(self, g_layers=[], activation_fn=True, inject_z=True, tra...
    method forward (line 108) | def forward(self, x):
  class Discriminator (line 127) | class Discriminator(nn.Module):
    method __init__ (line 128) | def __init__(self, d_layers=[], activation_fn=True, spectral_norm=False):
    method forward (line 176) | def forward(self, x):

FILE: image_generation_pytorch/solver.py
  function save_is (line 19) | def save_is(base_path, score):
  function denorm (line 28) | def denorm(x):
  function to_cuda (line 34) | def to_cuda(x):
  function to_numpy (line 40) | def to_numpy(x):
  class Solver (line 46) | class Solver(object):
    method __init__ (line 47) | def __init__(self, config, data_loader):
    method build_model (line 91) | def build_model(self):
    method reset_grad (line 114) | def reset_grad(self):
    method weights_init (line 119) | def weights_init(self, m):
    method gradient_penalty (line 127) | def gradient_penalty(self, real_data, generated_data):
    method train (line 157) | def train(self):
    method sample (line 258) | def sample(self, n_samples):

FILE: mesh_pi_nets/autoencoder_dataset.py
  class autoencoder_dataset (line 7) | class autoencoder_dataset(Dataset):
    method __init__ (line 9) | def __init__(self, root_dir, points_dataset, shapedata, normalization=...
    method __len__ (line 18) | def __len__(self):
    method __getitem__ (line 21) | def __getitem__(self, idx):

FILE: mesh_pi_nets/mesh_sampling.py
  function compute_downsampling (line 22) | def compute_downsampling(downsample_directory, downsample_method, shaped...
  function vertex_quadrics (line 55) | def vertex_quadrics(mesh):
  function setup_deformation_transfer (line 83) | def setup_deformation_transfer(source, target, use_normals=False):
  function qslim_decimator_transformer (line 134) | def qslim_decimator_transformer(mesh, factor=None, n_verts_desired=None):
  function _get_sparse_transform (line 251) | def _get_sparse_transform(faces, num_original_verts):
  function generate_transform_matrices (line 267) | def generate_transform_matrices(mesh, factors):
  function generate_transform_matrices_given_downsamples (line 305) | def generate_transform_matrices_given_downsamples(mesh, downsample_direc...

FILE: mesh_pi_nets/models.py
  class SpiralPoly (line 8) | class SpiralPoly(nn.Module):
    method __init__ (line 9) | def __init__(self, in_c,
    method forward (line 79) | def forward(self, x, spiral_adj):
  class SpiralPolyAE (line 176) | class SpiralPolyAE(nn.Module):
    method __init__ (line 177) | def __init__(self,
    method encode (line 251) | def encode(self, x):
    method decode (line 268) | def decode(self, z):
    method forward (line 287) | def forward(self, x):

FILE: mesh_pi_nets/shape_data.py
  class ShapeData (line 17) | class ShapeData(object):
    method __init__ (line 18) | def __init__(self, nVal,
    method load (line 54) | def load(self):
    method normalize (line 66) | def normalize(self):
    method save_meshes (line 90) | def save_meshes(self, filename, meshes, mesh_indices):

FILE: mesh_pi_nets/spiral_pi_nets.py
  function str2bool (line 39) | def str2bool(v):
  function str2list2int (line 48) | def str2list2int(v):
  function str2ListOfLists2int (line 52) | def str2ListOfLists2int(v):
  function str2list2float (line 56) | def str2list2float(v):
  function str2list2bool (line 60) | def str2list2bool(v):
  function str2ListOfLists2bool (line 64) | def str2ListOfLists2bool(v):
  function loss_l1 (line 68) | def loss_l1(outputs, targets):
  function main (line 73) | def main(args):

FILE: mesh_pi_nets/spiral_utils.py
  function get_adj_trigs (line 9) | def get_adj_trigs(A, F, reference_mesh, meshpackage = 'mpi-mesh'):
  function generate_spirals (line 45) | def generate_spirals(step_sizes, M, Adj, Trigs, reference_points, dilati...
  function distance (line 101) | def distance(v,w):
  function single_source_shortest_path (line 104) | def single_source_shortest_path(V,E,source,dist=None,prev=None):
  function get_spirals (line 130) | def get_spirals(mesh, adj, trig, reference_points, n_steps=1, padding='z...

FILE: mesh_pi_nets/test_funcs.py
  function test_autoencoder_dataloader (line 8) | def test_autoencoder_dataloader(device, model, dataloader_test, shapedat...

FILE: mesh_pi_nets/train_funcs.py
  function isnotebook (line 1) | def isnotebook():
  function train_autoencoder_dataloader (line 21) | def train_autoencoder_dataloader(dataloader_train,
Copy disabled (too large) Download .json
Condensed preview — 108 files, each showing path, character count, and a content snippet. Download the .json file for the full structured content (20,779K chars).
[
  {
    "path": ".gitignore",
    "chars": 221,
    "preview": "*~\n*.pyc\n.idea/*\n*.egg-info/*\n*tmp*.py\n*tmp*\n*.*.backup\n**/__pycache__/\n**/results/\n**/results_*/\n**/template_icl/\n**/.i"
  },
  {
    "path": "LICENSE.txt",
    "chars": 16015,
    "preview": "Attribution-NonCommercial 4.0 International License\n\nCopyright (c) 2020, Grigorios G Chrysos, Stylianos Moschoglou, Gior"
  },
  {
    "path": "classification-NO-activation-function/README.md",
    "chars": 3916,
    "preview": "# PiNet without Activation Function\r\n\r\n<!-- [ALGORITHM] -->\r\n\r\n## Abstract\r\n\r\nTypically, neural networks required activa"
  },
  {
    "path": "classification-NO-activation-function/backbones/pinet_1x1_norelu.py",
    "chars": 24284,
    "preview": "# Copyright (c) OpenMMLab. All rights reserved.\n\nimport torch.nn as nn\nimport torch.utils.checkpoint as cp\nfrom mmcv.cnn"
  },
  {
    "path": "classification-NO-activation-function/backbones/pinet_1x1_relu.py",
    "chars": 24274,
    "preview": "# Copyright (c) OpenMMLab. All rights reserved.\n\nimport torch.nn as nn\nimport torch.utils.checkpoint as cp\nfrom mmcv.cnn"
  },
  {
    "path": "classification-NO-activation-function/backbones/pinet_norelu.py",
    "chars": 24332,
    "preview": "# Copyright (c) OpenMMLab. All rights reserved.\n\nimport torch.nn as nn\nimport torch.utils.checkpoint as cp\nfrom mmcv.cnn"
  },
  {
    "path": "classification-NO-activation-function/backbones/pinet_relu.py",
    "chars": 24322,
    "preview": "# Copyright (c) OpenMMLab. All rights reserved.\n\nimport torch.nn as nn\nimport torch.utils.checkpoint as cp\nfrom mmcv.cnn"
  },
  {
    "path": "classification-NO-activation-function/backbones/resnet_norelu.py",
    "chars": 24359,
    "preview": "# Copyright (c) OpenMMLab. All rights reserved.\n\nimport torch.nn as nn\nimport torch.utils.checkpoint as cp\nfrom mmcv.cnn"
  },
  {
    "path": "classification-NO-activation-function/logs/pinet_1x1_norelu.log",
    "chars": 781534,
    "preview": "2023-01-01 16:31:14,068 - mmcls - INFO - Environment info:\n------------------------------------------------------------\n"
  },
  {
    "path": "classification-NO-activation-function/logs/pinet_1x1_relu.log",
    "chars": 781512,
    "preview": "2022-12-31 14:18:36,463 - mmcls - INFO - Environment info:\n------------------------------------------------------------\n"
  },
  {
    "path": "classification-NO-activation-function/logs/pinet_norelu.log",
    "chars": 780323,
    "preview": "2023-01-02 13:57:26,413 - mmcls - INFO - Environment info:\n------------------------------------------------------------\n"
  },
  {
    "path": "classification-NO-activation-function/logs/pinet_relu.log",
    "chars": 780336,
    "preview": "2023-01-03 15:18:24,147 - mmcls - INFO - Environment info:\n------------------------------------------------------------\n"
  },
  {
    "path": "classification-NO-activation-function/logs/resnet_norelu.log",
    "chars": 773156,
    "preview": "2023-01-04 15:10:41,671 - mmcls - INFO - Environment info:\n------------------------------------------------------------\n"
  },
  {
    "path": "face_recognition/README.md",
    "chars": 2156,
    "preview": "Official Implementation of the experiments on discriminative tasks with polynomial networks as described in the CVPR'20 "
  },
  {
    "path": "face_recognition/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "face_recognition/config.py",
    "chars": 5714,
    "preview": "import numpy as np\nimport os\nfrom easydict import EasyDict as edict\n\nconfig = edict()\n\nconfig.bn_mom = 0.9\nconfig.worksp"
  },
  {
    "path": "face_recognition/data/build_eval_pack.py",
    "chars": 3910,
    "preview": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n#import mxn"
  },
  {
    "path": "face_recognition/data/lfw/pairs_label.txt",
    "chars": 469130,
    "preview": "Abel_Pacheco/Abel_Pacheco_0001.jpg\tAbel_Pacheco/Abel_Pacheco_0004.jpg\t1\nAkhmed_Zakayev/Akhmed_Zakayev_0001.jpg\tAkhmed_Za"
  },
  {
    "path": "face_recognition/data/rec2image.py",
    "chars": 1936,
    "preview": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nimport os\ni"
  },
  {
    "path": "face_recognition/eval/lfw.py",
    "chars": 11252,
    "preview": "\"\"\"Helper for evaluation on the Labeled Faces in the Wild dataset \n\"\"\"\n\n# MIT License\n# \n# Copyright (c) 2016 David Sand"
  },
  {
    "path": "face_recognition/eval/verification.py",
    "chars": 22651,
    "preview": "\"\"\"Helper for evaluation on the Labeled Faces in the Wild dataset \n\"\"\"\n\n# MIT License\n# \n# Copyright (c) 2016 David Sand"
  },
  {
    "path": "face_recognition/flops_counter.py",
    "chars": 3495,
    "preview": "\n'''\n@author: insightface\n'''\n\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ im"
  },
  {
    "path": "face_recognition/image_iter.py",
    "chars": 11133,
    "preview": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nimport os\n"
  },
  {
    "path": "face_recognition/metric.py",
    "chars": 1368,
    "preview": "import numpy as np\nimport mxnet as mx\n\nclass AccMetric(mx.metric.EvalMetric):\n  def __init__(self):\n    self.axis = 1\n  "
  },
  {
    "path": "face_recognition/models/MS1Mretina-polynet50-arcface/log_retina_r50newton_arcface.txt",
    "chars": 1091354,
    "preview": "gpu num: 8\nprefix ./models/r50-arcface-retina/model\nimage_size [112, 112]\nnum_classes 93431\nCalled with argument: Namesp"
  },
  {
    "path": "face_recognition/models/MS1Mretina-polynet50-arcface/model-symbol.json",
    "chars": 202222,
    "preview": "{\n  \"nodes\": [\n    {\n      \"op\": \"null\", \n      \"name\": \"data\", \n      \"inputs\": []\n    }, \n    {\n      \"op\": \"_copy\", \n"
  },
  {
    "path": "face_recognition/models/MS1Mretina-resnet50-arcface/log_retina_r50_arcface.txt",
    "chars": 995634,
    "preview": "gpu num: 8\nprefix ./models/r50-arcface-retina/model\nimage_size [112, 112]\nnum_classes 93431\nCalled with argument: Namesp"
  },
  {
    "path": "face_recognition/models/MS1Mretina-resnet50-arcface/model-symbol.json",
    "chars": 146976,
    "preview": "{\n  \"nodes\": [\n    {\n      \"op\": \"null\", \n      \"name\": \"data\", \n      \"inputs\": []\n    }, \n    {\n      \"op\": \"_copy\", \n"
  },
  {
    "path": "face_recognition/parall_module_local_v1.py",
    "chars": 22981,
    "preview": "\n'''\n@author: insightface\n'''\n\nimport logging\nimport copy\nimport time\nimport os\n\nimport mxnet as mx\nimport numpy as np\nf"
  },
  {
    "path": "face_recognition/sample_config.py",
    "chars": 5611,
    "preview": "import numpy as np\nimport os\nfrom easydict import EasyDict as edict\n\nconfig = edict()\n\nconfig.bn_mom = 0.9\nconfig.worksp"
  },
  {
    "path": "face_recognition/symbol/fdensenet.py",
    "chars": 5471,
    "preview": "# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE f"
  },
  {
    "path": "face_recognition/symbol/fmnasnet.py",
    "chars": 6136,
    "preview": "import sys\r\nimport os\r\nimport mxnet as mx\r\nimport mxnet.ndarray as nd\r\nimport mxnet.gluon as gluon\r\nimport mxnet.gluon.n"
  },
  {
    "path": "face_recognition/symbol/fmobilefacenet.py",
    "chars": 4194,
    "preview": "\nimport sys\nimport os\nimport mxnet as mx\nimport symbol_utils\nsys.path.append(os.path.join(os.path.dirname(__file__), '.."
  },
  {
    "path": "face_recognition/symbol/fmobilenet.py",
    "chars": 5800,
    "preview": "# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE f"
  },
  {
    "path": "face_recognition/symbol/fresnet.py",
    "chars": 33264,
    "preview": "# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE f"
  },
  {
    "path": "face_recognition/symbol/memonger.py",
    "chars": 5093,
    "preview": "import mxnet as mx\nimport math\n\ndef prod(shape):\n    \"\"\"Get product of the shape.\n    \"\"\"\n    ret = 1\n    for s in shape"
  },
  {
    "path": "face_recognition/symbol/symbol_utils.py",
    "chars": 14878,
    "preview": "import sys\nimport os\nimport mxnet as mx\nsys.path.append(os.path.join(os.path.dirname(__file__), '..'))\nfrom config impor"
  },
  {
    "path": "face_recognition/symbol/vargfacenet.py",
    "chars": 24256,
    "preview": "# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE f"
  },
  {
    "path": "face_recognition/train.py",
    "chars": 15049,
    "preview": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nimport os\n"
  },
  {
    "path": "face_recognition/train_parall.py",
    "chars": 12822,
    "preview": "\n'''\n@author: insightface\n'''\n\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ im"
  },
  {
    "path": "face_recognition/triplet_image_iter.py",
    "chars": 22657,
    "preview": "# THIS FILE IS FOR EXPERIMENTS, USE image_iter.py FOR NORMAL IMAGE LOADING.\nfrom __future__ import absolute_import\nfrom "
  },
  {
    "path": "image_generation_chainer/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "image_generation_chainer/datasets/mnist.py",
    "chars": 2035,
    "preview": "from os.path import isdir\nimport chainer\nimport numpy as np\n\n\nclass MnistDb(chainer.dataset.DatasetMixin):\n    def __ini"
  },
  {
    "path": "image_generation_chainer/dis_models/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "image_generation_chainer/dis_models/resblocks_dis.py",
    "chars": 3903,
    "preview": "import math\nimport chainer\nfrom source.links.sn_convolution_2d import SNConvolution2D\nfrom chainer import functions as F"
  },
  {
    "path": "image_generation_chainer/dis_models/snresnet_32.py",
    "chars": 1582,
    "preview": "import chainer\nfrom chainer import functions as F\nfrom source.links.sn_embed_id import SNEmbedID\nfrom source.links.sn_li"
  },
  {
    "path": "image_generation_chainer/evaluations/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "image_generation_chainer/evaluations/extensions.py",
    "chars": 15538,
    "preview": "import os\nimport sys\nimport math\n\nimport numpy as np\nfrom PIL import Image\nimport scipy.linalg\n\nimport chainer\nimport ch"
  },
  {
    "path": "image_generation_chainer/evaluations/ndb.py",
    "chars": 12856,
    "preview": "import os\nimport numpy as np\nfrom sklearn.cluster import KMeans\nfrom scipy.stats import norm\nfrom matplotlib import pypl"
  },
  {
    "path": "image_generation_chainer/gen_models/cnn_gen_custom_prodpoly.py",
    "chars": 20943,
    "preview": "import numpy as np\nimport chainer\nimport chainer.functions as F\nimport chainer.links as L\nfrom source.links.sn_linear im"
  },
  {
    "path": "image_generation_chainer/jobs/pinet/fashionmnist_cnn_prodpoly_linear.yml",
    "chars": 1274,
    "preview": "batchsize: 64\niteration: 50000\niteration_decay_start: 0\nseed: 0\ndisplay_interval: 200\nsnapshot_interval: 5000\nevaluation"
  },
  {
    "path": "image_generation_chainer/jobs/pinet/train_mn_mnist.py",
    "chars": 9032,
    "preview": "import os, sys\nimport numpy as np\nfrom socket import gethostname\nfrom time import strftime\nimport argparse\nimport chaine"
  },
  {
    "path": "image_generation_chainer/readme.rst",
    "chars": 2678,
    "preview": "=======================================\nΠ-nets: Deep Polynomial Neural Networks\n=======================================\n"
  },
  {
    "path": "image_generation_chainer/source/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "image_generation_chainer/source/functions/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "image_generation_chainer/source/functions/cond_bn_wrapper.py",
    "chars": 691,
    "preview": "import chainer\nfrom chainer import configuration\nfrom chainer import cuda\nfrom chainer.functions.normalization import ba"
  },
  {
    "path": "image_generation_chainer/source/functions/losses.py",
    "chars": 5002,
    "preview": "import numpy as np\n\nimport chainer\nimport chainer.functions as F\nfrom chainer import Variable\n\ndef _tensor_to_matrix(ten"
  },
  {
    "path": "image_generation_chainer/source/functions/max_sv.py",
    "chars": 1253,
    "preview": "import chainer\nfrom chainer import cuda\nfrom chainer.functions.math import sum\nfrom chainer.functions.connection import "
  },
  {
    "path": "image_generation_chainer/source/inception/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "image_generation_chainer/source/inception/download.py",
    "chars": 10439,
    "preview": "\"\"\"\nIncluding code from the official implementation by OpenAI found at\nhttps://github.com/openai/improved-gan\n\"\"\"\nfrom _"
  },
  {
    "path": "image_generation_chainer/source/inception/example.py",
    "chars": 1263,
    "preview": "import argparse\nimport numpy as np\n\nfrom chainer import cuda\nfrom chainer import datasets\nfrom chainer import serializer"
  },
  {
    "path": "image_generation_chainer/source/inception/inception_score.py",
    "chars": 28599,
    "preview": "import math\n\nimport chainer\nfrom chainer import Chain\nfrom chainer import functions as F\nfrom chainer import links as L\n"
  },
  {
    "path": "image_generation_chainer/source/inception/inception_score_tf.py",
    "chars": 5994,
    "preview": "# Code derived from tensorflow/tensorflow/models/image/imagenet/classify_image.py\nfrom __future__ import absolute_import"
  },
  {
    "path": "image_generation_chainer/source/links/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "image_generation_chainer/source/links/categorical_conditional_batch_normalization.py",
    "chars": 4978,
    "preview": "import numpy\n\nimport chainer\nfrom chainer import configuration\nfrom chainer import cuda\nfrom chainer.functions.normaliza"
  },
  {
    "path": "image_generation_chainer/source/links/conditional_batch_normalization.py",
    "chars": 5765,
    "preview": "import numpy\n\nimport chainer\nfrom chainer import configuration\nfrom chainer import cuda\nfrom chainer.functions.normaliza"
  },
  {
    "path": "image_generation_chainer/source/links/resnet_layer.py",
    "chars": 29830,
    "preview": "from __future__ import print_function\nimport collections\nimport os\n\nimport numpy\n\ntry:\n    from PIL import Image\n\n    av"
  },
  {
    "path": "image_generation_chainer/source/links/sn_convolution_2d.py",
    "chars": 4687,
    "preview": "import chainer\nimport numpy as np\nfrom chainer import cuda\nfrom chainer.functions.array.broadcast import broadcast_to\nfr"
  },
  {
    "path": "image_generation_chainer/source/links/sn_convolution_nd.py",
    "chars": 5130,
    "preview": "import numpy as np\nfrom chainer.functions.connection import convolution_nd\nfrom chainer import initializers\nfrom chainer"
  },
  {
    "path": "image_generation_chainer/source/links/sn_dilated_convolution_2d.py",
    "chars": 3175,
    "preview": "import chainer\nimport numpy as np\nfrom chainer import cuda\nfrom chainer.functions.array.broadcast import broadcast_to\nfr"
  },
  {
    "path": "image_generation_chainer/source/links/sn_embed_id.py",
    "chars": 3026,
    "preview": "import chainer\nfrom chainer.functions.connection import embed_id\nfrom chainer.initializers import normal\nfrom chainer im"
  },
  {
    "path": "image_generation_chainer/source/links/sn_linear.py",
    "chars": 3729,
    "preview": "import chainer\nimport numpy as np\nfrom chainer.functions.array.broadcast import broadcast_to\nfrom chainer.functions.conn"
  },
  {
    "path": "image_generation_chainer/source/links/sn_symmetric_linear.py",
    "chars": 3407,
    "preview": "import chainer\nimport numpy as np\nfrom chainer.functions.array.broadcast import broadcast_to\nfrom chainer.functions.conn"
  },
  {
    "path": "image_generation_chainer/source/misc_train_utils.py",
    "chars": 9166,
    "preview": "import matplotlib as mpl\nmpl.use('Agg')\nfrom os import makedirs, getcwd\nfrom os.path import basename, exists, join, isfi"
  },
  {
    "path": "image_generation_chainer/source/miscs/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "image_generation_chainer/source/miscs/model_moiving_average.py",
    "chars": 2117,
    "preview": "import copy\nimport chainer\n\n\ndef copypersistents(src, dst):\n    assert isinstance(src, chainer.Link)\n    assert isinstan"
  },
  {
    "path": "image_generation_chainer/source/miscs/random_samples.py",
    "chars": 1499,
    "preview": "import numpy as np\nimport chainer\n\n\ndef sample_continuous(dim, batchsize, distribution='normal', xp=np):\n    if distribu"
  },
  {
    "path": "image_generation_chainer/source/yaml_utils.py",
    "chars": 1866,
    "preview": "# !/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom os.path import splitext, basename, dirname, isfile, join\nfrom os im"
  },
  {
    "path": "image_generation_chainer/updaters/gans/updater.py",
    "chars": 5667,
    "preview": "import numpy as np\n\nimport chainer\nimport chainer.functions as F\nfrom chainer import Variable\nimport source.functions.lo"
  },
  {
    "path": "image_generation_pytorch/FID/LICENSE",
    "chars": 11357,
    "preview": "                                 Apache License\n                           Version 2.0, January 2004\n                   "
  },
  {
    "path": "image_generation_pytorch/FID/README.md",
    "chars": 3247,
    "preview": "# Fréchet Inception Distance (FID score) in PyTorch\n\nThis is a port of the official implementation of [Fréchet Inception"
  },
  {
    "path": "image_generation_pytorch/FID/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "image_generation_pytorch/FID/fid_score.py",
    "chars": 9848,
    "preview": "#!/usr/bin/env python3\n\"\"\"Calculates the Frechet Inception Distance (FID) to evalulate GANs\n\nThe FID metric calculates t"
  },
  {
    "path": "image_generation_pytorch/FID/inception.py",
    "chars": 4830,
    "preview": "import torch.nn as nn\nimport torch.nn.functional as F\nfrom torchvision import models\n\n\nclass InceptionV3(nn.Module):\n   "
  },
  {
    "path": "image_generation_pytorch/IS/LICENSE.md",
    "chars": 1055,
    "preview": "Copyright 2017 Shane T. Barratt\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this so"
  },
  {
    "path": "image_generation_pytorch/IS/README.md",
    "chars": 1659,
    "preview": "# Inception Score Pytorch\n\nPytorch was lacking code to calculate the Inception Score for GANs. This repository fills thi"
  },
  {
    "path": "image_generation_pytorch/IS/inception_score.py",
    "chars": 2450,
    "preview": "import torch\nfrom torch import nn\nfrom torch.autograd import Variable\nfrom torch.nn import functional as F\nimport torch."
  },
  {
    "path": "image_generation_pytorch/README.rst",
    "chars": 2631,
    "preview": "=======================================\nΠ-nets: Deep Polynomial Neural Networks\n=======================================\n"
  },
  {
    "path": "image_generation_pytorch/data_loader.py",
    "chars": 974,
    "preview": "import torch\nimport torchvision\nimport torchvision.transforms as transforms\n\n\ndef get_loader(data_path, batch_size, mode"
  },
  {
    "path": "image_generation_pytorch/logger.py",
    "chars": 2467,
    "preview": "# Code referenced from https://gist.github.com/gyglim/1f8dfb1b5c82627ae3efcfbbadb9f514\nimport tensorflow as tf\nimport nu"
  },
  {
    "path": "image_generation_pytorch/main.py",
    "chars": 5761,
    "preview": "import argparse\nimport os\nfrom solver import Solver\nfrom data_loader import get_loader\nfrom torch.backends import cudnn\n"
  },
  {
    "path": "image_generation_pytorch/model.py",
    "chars": 12328,
    "preview": "import torch.nn as nn\nimport torch.nn.functional as F\nfrom torch.nn.utils import spectral_norm as SN\nfrom numpy import s"
  },
  {
    "path": "image_generation_pytorch/solver.py",
    "chars": 12217,
    "preview": "import torch\nimport torch.nn as nn\nimport os\nfrom torch import optim\nfrom torch.autograd import Variable\nfrom model impo"
  },
  {
    "path": "mesh_pi_nets/.gitignore",
    "chars": 1808,
    "preview": "# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$py.class\n\n.idea/\n\n# C extensions\n*.so\n\n# Distribution /"
  },
  {
    "path": "mesh_pi_nets/README.md",
    "chars": 4058,
    "preview": "Official Implementation of the experiments on mesh representation learning with polynomial networks as described in the "
  },
  {
    "path": "mesh_pi_nets/autoencoder_dataset.py",
    "chars": 1309,
    "preview": "from torch.utils.data import Dataset\nimport torch\nimport numpy as np\nimport os\n\n\nclass autoencoder_dataset(Dataset):\n\n  "
  },
  {
    "path": "mesh_pi_nets/datasets/COMA/templates/COMA_downsample/downsampling_matrices.pkl",
    "chars": 4121788,
    "preview": "(dp0\nS'A'\np1\n(lp2\nccopy_reg\n_reconstructor\np3\n(cscipy.sparse.csc\ncsc_matrix\np4\nc__builtin__\nobject\np5\nNtp6\nRp7\n(dp8\nS'in"
  },
  {
    "path": "mesh_pi_nets/datasets/COMA/templates/template.obj",
    "chars": 313004,
    "preview": "####\n#\n# OBJ File Generated by Meshlab\n#\n####\n# Object head_eyes.obj\n#\n# Vertices: 5023\n# Faces: 9976\n#\n####\nv 0.061998 "
  },
  {
    "path": "mesh_pi_nets/datasets/DFAUST/templates/COMA_downsample/downsampling_matrices.pkl",
    "chars": 5727737,
    "preview": "(dp0\nS'A'\np1\n(lp2\nccopy_reg\n_reconstructor\np3\n(cscipy.sparse.csc\ncsc_matrix\np4\nc__builtin__\nobject\np5\nNtp6\nRp7\n(dp8\nS'in"
  },
  {
    "path": "mesh_pi_nets/datasets/DFAUST/templates/template.obj",
    "chars": 438347,
    "preview": "v 0.060936 1.110009 -0.057364\nv 0.058960 1.097874 -0.045189\nv 0.071923 1.094268 -0.055639\nv 0.075028 1.103552 -0.067193\n"
  },
  {
    "path": "mesh_pi_nets/mesh_sampling.py",
    "chars": 11783,
    "preview": "### Code obtained and modified from https://github.com/anuragranj/coma, Copyright (c) 2018 Anurag Ranjan, Timo Bolkart, "
  },
  {
    "path": "mesh_pi_nets/models.py",
    "chars": 13277,
    "preview": "import torch\nimport torch.nn as nn\nfrom torch.nn.parameter import Parameter\n\nimport math\n\n\nclass SpiralPoly(nn.Module):\n"
  },
  {
    "path": "mesh_pi_nets/shape_data.py",
    "chars": 4567,
    "preview": "### Code obtained and modified from https://github.com/anuragranj/coma, Copyright (c) 2018 Anurag Ranjan, Timo Bolkart, "
  },
  {
    "path": "mesh_pi_nets/spiral_pi_nets.py",
    "chars": 16716,
    "preview": "import argparse\n\nimport sys\n\nsys.path.append('../')\nimport numpy as np\nimport json\nimport os\nimport copy\nfrom shape_data"
  },
  {
    "path": "mesh_pi_nets/spiral_utils.py",
    "chars": 17088,
    "preview": "import numpy as np\nfrom random import choice\n\n## Note: Non-smooth surfaces or bad triangulations may lead to non-spiral "
  },
  {
    "path": "mesh_pi_nets/test_funcs.py",
    "chars": 1934,
    "preview": "import torch\nimport copy\nfrom tqdm import tqdm, tqdm_notebook\n\noutlier_threshold = 1\n\n\ndef test_autoencoder_dataloader(d"
  },
  {
    "path": "mesh_pi_nets/train_funcs.py",
    "chars": 6538,
    "preview": "def isnotebook():\n    try:\n        shell = get_ipython().__class__.__name__\n        if shell == 'ZMQInteractiveShell':\n "
  },
  {
    "path": "readme.rst",
    "chars": 5354,
    "preview": "=======================================\nΠ-nets: Deep Polynomial Neural Networks\n=======================================\n"
  }
]

About this extraction

This page contains the full source code of the grigorisg9gr/polynomial_nets GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 108 files (17.3 MB), approximately 4.5M tokens, and a symbol index with 617 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!