Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the issue regrading clockwork_mask (the upper triangular matrix) #5

Open
dzhu622911 opened this issue Mar 7, 2018 · 1 comment
Open

Comments

@dzhu622911
Copy link

According to the [arXiv, https://arxiv.org/abs/1402.3511], My understanding is the mask matrix shape is
[num_group * group_size, num_group * group_size], can also image the mask is constructed by [num_group, num_group] but each element in matrix is a sub-matrix which shape is
[group_size, group_size];

so i think the expected clockwork_mask is upper triangular matrix of [num_group, num_group], but not [num_group * group_size, num_group * group_size];

i also modify the code, change the below code:

self.clockwork_mask = tf.constant(np.triu(np.ones([self.config.num_hidden, self.config.num_hidden])), dtype=tf.float32, name="mask")

to,

        mask = np.zeros((self.config.num_hidden, self.config.num_hidden))
        for i in range(len(self.clockwork_periods)):
            mask[i*self.group_size:(i+1)*self.group_size, i*self.group_size:] = 1
        self.clockwork_mask = tf.constant(mask, name="mask")
@dzhu622911
Copy link
Author

sorry, should be this:

        mask = np.zeros((self.config.num_hidden, self.config.num_hidden))
        for i in range(len(self.clockwork_periods)):
            mask[i*self.group_size:(i+1)*self.group_size, i*self.group_size:] = 1
        self.clockwork_mask = tf.constant(mask, dtype=tf.float32, name="mask")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant