コード例 #1
0
 def make_search_space(self):
   """Creates both the edge and operation search space definitions."""
   self.make_all_possible_edges()
   self.boolean_mask = pg.List(
       [pg.oneof([0, 1]) for edge in self.all_possible_edges])
   self.search_space = pg.Dict(boolean_mask=self.boolean_mask)
   self.template = pg.template(self.search_space)
コード例 #2
0
  def make_search_space(self):
    self.search_space = pg.Dict()

    for sector_pair in self.sectors:
      sector_before, sector_after = sector_pair
      for a in sector_before:
        for b in sector_after:
          edge_key = str((a, b))
          self.search_space[edge_key] = pg.one_of(
              list(range(self.num_partitions)))

    self.template = pg.template(self.search_space)
コード例 #3
0
  def make_search_space(self):
    """Creates both the edge and operation search space definitions."""
    self.make_all_possible_edges()
    self.edge_search_space = pg.sublist_of(
        self.num_edges,
        candidates=self.all_possible_edges,
        choices_sorted=False,
        choices_distinct=True)
    # Every node is allowed an operation over it, after matrix multiplication.
    self.op_search_space = pg.List(
        [pg.one_of(self.nonlinearity_ops) for i in range(self.total_nb_nodes)])

    self.search_space = pg.Dict(
        edge_search_space=self.edge_search_space,
        op_search_space=self.op_search_space)

    self.template = pg.template(self.search_space)
コード例 #4
0
  def make_search_space(self):
    if self.edge_policy_sample_mode == "aggregate_edges":
      total_number_k = sum(self.hidden_layer_edge_num)

      self.search_space = pg.sublist_of(
          total_number_k,
          candidates=self.all_possible_edges,
          choices_sorted=False,
          choices_distinct=True)

    elif self.edge_policy_sample_mode == "independent_edges":  # check if right
      self.search_space = pg.List(self.ssd_list)

    elif self.edge_policy_sample_mode == "residual_edges":
      total_number_k = sum(self.hidden_layer_edge_num)
      self.search_space = pg.sublist_of(
          total_number_k,
          candidates=self.all_possible_edges,
          choices_sorted=False,
          choices_distinct=True)

    self.template = pg.template(self.search_space)