D-X-Y / AutoDL-Projects

Automated deep learning algorithms implemented in PyTorch.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to get the adjacency matrix of the cell?

bknyaz opened this issue · comments

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.

adjacency = basemodel.get_adjacency()

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?

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|')