<jupyter_start><jupyter_text>Configuration> Using `YACS` to configure our library<jupyter_code>#export
from yacs.config import CfgNode as CN<jupyter_output><empty_output><jupyter_text>First, define a global config node:<jupyter_code>#export
_C = CN()
_C.URL = ''  # url for pretrained model storage

_C.__class__.__module__ == 'yacs.config' and _C.__class__.__name__ == 'CfgNode'<jupyter_output><empty_output><jupyter_text>Next, define the options of network structures. A CNN neural network architecture is represented as a Directed Acyclic Graph (DAG).The DAG graph consists of a sequence of stages,- `NUM_STAGES` : number of stages- `NUM_NODES` : number of nodes per stage- `NUM_CHANNELS` : number of channels per stage`NUM_NODES` for different variants of ResNet:- (3, 4, 6, 3) for resnet50- (3, 4, 23, 3) for resnet101- (3, 8, 36, 3) for resnet152<jupyter_code>#export
_C.GRAPH = CN()
#export
_C.GRAPH.NUM_STAGES = 4
_C.GRAPH.NUM_NODES = (3, 8, 36, 3)
_C.GRAPH.NUM_CHANNELS = (64, 128, 256, 512)
_C.GRAPH.STEM = ''
_C.GRAPH.UNIT = ''
_C.GRAPH.CONN = ''
_C.GRAPH.TAIL = ''
_C.GRAPH.FOLD = 1
_C.GRAPH.START_ID = 0
_C.GRAPH.END_ID = 0
_C.GRAPH.NI = 64
_C.GRAPH.BASE = 64
_C.GRAPH.EXP = 2
_C.GRAPH.BOTTLE_SCALE = 4.
_C.GRAPH.FIRST_DOWNSAMPLE = False
_C.GRAPH.DEEP_STEM = False
#export
def assert_cfg(cfg):
    "Assert config options"
    assert cfg.GRAPH.NUM_STAGES == len(cfg.GRAPH.NUM_NODES), 'num_stages should equal to length of num_nodes'
# Example usage:
#   from wong.config import cfg
#export
cfg = _C

cfg_file = 'configs/imagenet/resnet/resnet50.yaml'
cfg.merge_from_file(cfg_file)
cfg
assert_cfg(cfg)<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup