class_docstr: Model specification given adjacency matrix and labeling.
class_docstr_tok: ["Model","specification","given","adjacency","matrix","and","labeling","."]
docstr: This will sample a random architecture and update the edges in the
  naslib object accordingly.
  From the NASBench repository:
  one-hot adjacency matrix
  draw [0,1] for each slot in the adjacency matrix
docstr_tok: ["This","will","sample","a","random","architecture","and","update","the","edges","in","the","naslib","object","accordingly",".","From","the","NASBench","repository",":","one-hot","adjacency","matrix","draw","[","0,1","]","for","each","slot","in","the","adjacency","matrix"]
code: def random_sample_one_architecture(
      cls, dataset_api: dict, min_size=7
  ):
      """
      This will sample a random architecture and update the edges in the
      naslib object accordingly.
      From the NASBench repository:
      one-hot adjacency matrix
      draw [0,1] for each slot in the adjacency matrix
      """
      while True:
          matrix = np.random.choice(
              [0, 1], size=(NUM_VERTICES, NUM_VERTICES)
          )
          matrix = np.triu(matrix, 1)
          ops = np.random.choice(OPS, size=min_size).tolist()
          ops[0] = INPUT
          ops[-1] = OUTPUT
          spec = dataset_api["api"].ModelSpec(matrix=matrix, ops=ops)
          if not dataset_api["nb101_data"].is_valid(spec):
              continue
  
          spec = NASBench101ModelSpec(matrix, ops)
          # only sample model with 7 nodes.
          if len(spec.matrix) == min_size:
              break
  
      return spec
  
file_path: singa/examples/model_selection/TRAILS-Database-Native-Model-Selection/internal/ml/model_selection/src/third_pkg/sp101_lib/model_spec.py
imports: import copy
  import hashlib
  import itertools
  import numpy
label_desc: Use image node_id 5 for calling the NASBench101ModelSpec obj's underlying member method code with example usage: obj.random_sample_one_architecture(cls, dataset_api, min_size) and returns: spec