MCPcopy Create free account
hub / github.com/alibaba/euler / __call__

Method __call__

tf_euler/python/solution/base_sample.py:50–73  ·  view source on GitHub ↗
(self, inputs)

Source from the content-addressed store, hash-verified

48 return self.encoder(n_id)
49
50 def __call__(self, inputs):
51 inputs = self.parse_input_fn(inputs)
52 label = inputs[0]
53 if len(inputs) == 2:
54 node_groups = inputs[1]
55 else:
56 node_groups = inputs[1:]
57
58 if self.neg_sample_fn is not None:
59 neg_node_groups = self.neg_sample_fn(node_groups)
60 neg_labels = tf.zeros_like(neg_node_groups[0], dtype=tf.float32)
61 label = tf.concat([label, neg_labels], axis=0)
62 pos_node_groups = node_groups
63 node_groups = []
64 for pos_nodes, neg_nodes in zip(pos_node_groups, neg_node_groups):
65 node_groups.append(tf.concat([pos_node_groups, neg_node_groups], axis=0))
66
67 node_groups_embedding = self.embed(node_groups)
68 target_embedding, context_embedding, output_embedding = self.parse_group_emb_fn(node_groups_embedding)
69 logit = self.logit_fn(target_embedding, context_emb=context_embedding)
70 loss = self.loss_fn(label, logit)
71 metric = self.metric_class(label, logit)
72 embedding = output_embedding
73 return (embedding, loss, self.metric_name, metric)
74
75class UnsuperviseSampleSolution(object):
76 def __init__(self,

Callers

nothing calls this directly

Calls 3

embedMethod · 0.95
appendMethod · 0.80
loss_fnMethod · 0.45

Tested by

no test coverage detected