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

Method __init__

tf_euler/python/utils/layers.py:176–192  ·  view source on GitHub ↗
(self,
                 out_dim,
                 activation=tf.nn.elu,
                 activation_out=lambda x: x,
                 hidden_dim=[],
                 head_num=[1],
                 **kwargs)

Source from the content-addressed store, hash-verified

174 Attention Layer: input shape should be[batch_size, seq_length, feature_dim]
175 """
176 def __init__(self,
177 out_dim,
178 activation=tf.nn.elu,
179 activation_out=lambda x: x,
180 hidden_dim=[],
181 head_num=[1],
182 **kwargs):
183 super(AttLayer, self).__init__(**kwargs)
184 self.hidden_dim = hidden_dim
185 self.out_dim = out_dim
186 self.head_num = head_num
187 self.activation = activation
188 self.activation_out = activation_out
189 if len(head_num) < 1 or len(head_num) != len(hidden_dim) + 1:
190 raise ValueError('head_num must be greater than 1 and greater'
191 ' than hidden, got {},{}'.format(str(head_num),
192 str(hidden_dim)))
193
194 def call(self, inputs):
195 rank = inputs.shape.ndims

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected