D-X-Y / AutoDL-Projects

Automated deep learning algorithms implemented in PyTorch.
MIT License
1.57k stars 282 forks source link

How to get the adjacency matrix of the cell? #84

Closed bknyaz closed 4 years ago

bknyaz commented 4 years ago

Hi, this maybe a noob question. In the NAS-101 (https://github.com/google-research/nasbench) I can get the adjacency matrix of a cell. Is there some existing way to get it in NAS-201? I found some your code referring to the get_adjacency function, but couldn't understand how to use it. https://github.com/D-X-Y/AutoDL-Projects/blob/cfb462e463bcbd7a133162ed00aca0b58a000912/lib/nas_infer_model/DXYs/construct_utils.py#L23 I understand that I can write some code to parse the string defining the architecture like |nor_conv_3x3~0|+|nor_conv_3x3~0|avg_pool_3x3~1|+|skip_connect~0|nor_conv_3x3~1|skip_connect~2|, but maybe there is already a function to do that?

D-X-Y commented 4 years ago

Hi, thanks for your interest. The codes under nas_infer_model is out-of-date and mainly used for reproducing some numbers in my previous papers. If you want to get the adjacency matrix of a cell in NAS-Bench-201, you can use this function: https://github.com/D-X-Y/AutoDL-Projects/blob/master/lib/nas_201_api/api_201.py#L235 You can simply call

api.str2matrix('|nor_conv_3x3~0|+|nor_conv_3x3~0|avg_pool_3x3~1|+|skip_connect~0|nor_conv_3x3~1|skip_connect~2|')