コード例 #1
0
    def build(self,
              hiddens=[16],
              activations=['relu'],
              dropout=0.5,
              l2_norm=5e-4,
              lr=0.01,
              use_bias=False):

        if self.kind == "T":
            with tf.device(self.device):
                self.model = tfGCN(self.graph.n_attrs,
                                   self.graph.n_classes,
                                   hiddens=hiddens,
                                   activations=activations,
                                   dropout=dropout,
                                   l2_norm=l2_norm,
                                   lr=lr,
                                   use_bias=use_bias)
        else:
            self.model = pyGCN(self.graph.n_attrs,
                               self.graph.n_classes,
                               hiddens=hiddens,
                               activations=activations,
                               dropout=dropout,
                               l2_norm=l2_norm,
                               lr=lr,
                               use_bias=use_bias).to(self.device)
コード例 #2
0
    def build(self,
              hiddens=[32],
              activations=['relu'],
              dropout=0.5,
              l2_norm=0.,
              lr=0.01,
              use_bias=False):

        #         if self.kind == "P":
        #             raise RuntimeError(f"Currently {self.name} only support for tensorflow backend.")

        if self.kind == "T":
            with tf.device(self.device):
                self.model = tfGCN(self.graph.n_attrs,
                                   self.graph.n_classes,
                                   hiddens=hiddens,
                                   activations=activations,
                                   dropout=dropout,
                                   l2_norm=l2_norm,
                                   lr=lr,
                                   use_bias=use_bias,
                                   experimental_run_tf_function=False)
        else:
            self.model = pyGCN(self.graph.n_attrs,
                               self.graph.n_classes,
                               hiddens=hiddens,
                               activations=activations,
                               dropout=dropout,
                               l2_norm=l2_norm,
                               lr=lr,
                               use_bias=use_bias).to(self.device)