MCPcopy Create free account
hub / github.com/brightmart/text_classification / __init__

Method __init__

a07_Transformer/a2_encoder.py:14–31  ·  view source on GitHub ↗

:param d_model: :param d_k: :param d_v: :param sequence_length: :param h: :param batch_size: :param embedded_words: shape:[batch_size*sequence_length,embed_size]

(self,d_model,d_k,d_v,sequence_length,h,batch_size,num_layer,Q,K_s,type='encoder',mask=None,dropout_keep_prob=None,use_residual_conn=True)

Source from the content-addressed store, hash-verified

12import time
13class Encoder(BaseClass):
14 def __init__(self,d_model,d_k,d_v,sequence_length,h,batch_size,num_layer,Q,K_s,type='encoder',mask=None,dropout_keep_prob=None,use_residual_conn=True):
15 """
16 :param d_model:
17 :param d_k:
18 :param d_v:
19 :param sequence_length:
20 :param h:
21 :param batch_size:
22 :param embedded_words: shape:[batch_size*sequence_length,embed_size]
23 """
24 super(Encoder, self).__init__(d_model,d_k,d_v,sequence_length,h,batch_size,num_layer=num_layer)
25 self.Q=Q
26 self.K_s=K_s
27 self.type=type
28 self.mask=mask
29 self.initializer = tf.random_normal_initializer(stddev=0.1)
30 self.dropout_keep_prob=dropout_keep_prob
31 self.use_residual_conn=use_residual_conn
32
33 def encoder_fn(self):
34 start = time.time()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected