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

Method call

tf_euler/python/utils/encoders.py:135–171  ·  view source on GitHub ↗
(self, inputs)

Source from the content-addressed store, hash-verified

133 return output_dim
134
135 def call(self, inputs):
136 input_shape = inputs.shape
137 inputs = tf.reshape(inputs, [-1])
138 embeddings = []
139
140 if self.use_id:
141 embeddings.append(self.embedding(inputs))
142
143 if self.use_feature:
144 features = euler_ops.get_dense_feature(
145 inputs, self.feature_idx, self.feature_dim)
146 features = tf.concat(features, -1)
147 if self.combiner == 'add':
148 features = self.dense(features)
149 embeddings.append(features)
150
151 if self.use_sparse_feature:
152 default_values = [max_id + 1
153 for max_id in self.sparse_feature_max_id]
154 sparse_features = euler_ops.get_sparse_feature(
155 inputs, self.sparse_feature_idx, default_values=default_values)
156 embeddings.extend([
157 sparse_embedding(sparse_feature)
158 for sparse_embedding, sparse_feature
159 in zip(self.sparse_embeddings, sparse_features)
160 ])
161
162 if self.combiner == 'add':
163 embedding = tf.add_n(embeddings)
164 else:
165 embedding = tf.concat(embeddings, -1)
166 if self.dim:
167 embedding = self.dense(embedding)
168 output_shape = input_shape.concatenate(self.output_dim)
169 output_shape = [d if d is not None else -1
170 for d in output_shape.as_list()]
171 return tf.reshape(embedding, output_shape)
172
173
174class GCNEncoder(layers.Layer):

Callers

nothing calls this directly

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected