Skip to content

AttributeError: 'ReLU' object has no attribute 'weight' #47

@dupanfei1

Description

@dupanfei1

Hi, I met a problem in CNNCharEmbedding.py. The ReLU has no weight. It seems like there should be a difference for the activation functions with weight and without weight.
Thank you !

Traceback (most recent call last):
File "train.py", line 372, in
main(params)
File "train.py", line 283, in main
lm = LearningMachine('train', conf, problem, vocab_info=vocab_info, initialize=initialize, use_gpu=conf.use_gpu)
File "/nb_code1/LearningMachine.py", line 38, in init
self.model = Model(conf, problem, vocab_info, use_gpu)
File "/nb_code1/Model.py", line 210, in init
self.add_layer(EMBED_LAYER_ID, get_layer(layer_arch['layer'], all_layer_configs[EMBED_LAYER_ID]))
File "/nb_code1/Model.py", line 121, in get_layer
layer = eval(layer_name)(conf)
File "/nb_code1/block_zoo/Embedding.py", line 125, in init
self.embeddings[input_cluster] = eval(layer_conf.conf[input_cluster]['type'])(char_emb_conf)
File "/nb_code1/block_zoo/embedding/CNNCharEmbedding.py", line 81, in init
self.activation.weight = torch.nn.Parameter(self.activation.weight.cuda())
File "anaconda3/envs/py36/lib/python3.6/site-packages/torch/nn/modules/module.py", line 535, in getattr
type(self).name, name))
AttributeError: 'ReLU' object has no attribute 'weight'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions