0fbb027c8b368473e7e7fd6b05db5911cd34ce76,autokeras/blocks/basic.py,Embedding,build,#Embedding#Any#Any#,855
Before Change
input_node = nest.flatten(inputs)[0]
// TODO: support more pretrained embedding layers.
// glove, fasttext, and word2vec
pretraining = self.pretraining or hp.Choice(
"pretraining",
["random", "glove", "fasttext", "word2vec", "none"],
default="none",
)
embedding_dim = self.embedding_dim or hp.Choice(
"embedding_dim", [32, 64, 128, 256, 512], default=128
)
if pretraining != "none":
// TODO: load from pretrained weights
layer = layers.Embedding(
input_dim=self.max_features,
output_dim=embedding_dim,
input_length=input_node.shape[1],
)
// trainable=False,
// weights=[embedding_matrix])
else:
layer = layers.Embedding(
input_dim=self.max_features, output_dim=embedding_dim
)
// input_length=input_node.shape[1],
// trainable=True)
output_node = layer(input_node)
if self.dropout is not None:
dropout = self.dropout
else:
dropout = hp.Choice("dropout", [0.0, 0.25, 0.5], default=0.25)
if dropout > 0:
output_node = layers.Dropout(dropout)(output_node)
return output_node
After Change
input_node = nest.flatten(inputs)[0]
// TODO: support more pretrained embedding layers.
// glove, fasttext, and word2vec
pretraining = utils.add_to_hp(self.pretraining, hp)
embedding_dim = utils.add_to_hp(self.embedding_dim, hp)
if pretraining != "none":
// TODO: load from pretrained weights
layer = layers.Embedding(
input_dim=self.max_features,
output_dim=embedding_dim,
input_length=input_node.shape[1],
)
// trainable=False,
// weights=[embedding_matrix])
else:
layer = layers.Embedding(
input_dim=self.max_features, output_dim=embedding_dim
)
// input_length=input_node.shape[1],
// trainable=True)
output_node = layer(input_node)
dropout = utils.add_to_hp(self.dropout, hp)
if dropout > 0:
output_node = layers.Dropout(dropout)(output_node)
return output_node
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 21
Instances
Project Name: jhfjhfj1/autokeras
Commit Name: 0fbb027c8b368473e7e7fd6b05db5911cd34ce76
Time: 2021-03-18
Author: samriddhidjokestersinha@gmail.com
File Name: autokeras/blocks/basic.py
Class Name: Embedding
Method Name: build
Project Name: keras-team/autokeras
Commit Name: 48d4604e38da537503f1d5fe3afa94e4d7f708d7
Time: 2021-02-07
Author: mandalbiswadip448@gmail.com
File Name: autokeras/blocks/basic.py
Class Name: RNNBlock
Method Name: build
Project Name: jhfjhfj1/autokeras
Commit Name: 0fbb027c8b368473e7e7fd6b05db5911cd34ce76
Time: 2021-03-18
Author: samriddhidjokestersinha@gmail.com
File Name: autokeras/blocks/basic.py
Class Name: Embedding
Method Name: build