Skip to content

Almost constant gates values. #1

Open
@mojesty

Description

@mojesty

Hello. I use python2.7 and PyTorch 0.3.1/0.3.0, when I run the following code:

sens = 'i like orange apples .'
words = sens.strip().split()
x = numpy.array([corpus.dictionary[w] for w in words])
input = Variable(torch.LongTensor(x[:, None]))

hidden = model.init_hidden(1)
_, hidden = model(input, hidden)

gates = model.gates.squeeze().data.numpy()

i receive the wollowing gates activations:
array([0.07, 0.07, 0.07, 0.07, 0.06], dtype=float32)
so the parse tree is built incorrectly.
The inputs look like this:
array([3277, 262, 35, 3339, 11])
It works the same on different sentences/different versions of PyTorch (I tried 0.3.0 and 0.3.1, on 0.4.1 code fails to work because of changed BatchNorm1D ), and always most of gates has value 0.07 and parse trees look like they are incorrect.
Please explain to me what am i doing wrong.

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