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

Not able to understand, this specific part of the code #28

Open
nikhilrayaprolu opened this issue May 12, 2018 · 1 comment
Open

Not able to understand, this specific part of the code #28

nikhilrayaprolu opened this issue May 12, 2018 · 1 comment

Comments

@nikhilrayaprolu
Copy link

buckets[idx][1].append([label[ind] * label_size + label[ind + 1] for ind in range(0, cur_len)] + [
            label[cur_len] * label_size + pad_label] + [pad_label * label_size + pad_label] * (
                                   thresholds[idx] - cur_len_1))

there is a part of the code where targets are formed using the above function in construct_bucket_vb

what is it happening in this part of code?

@airship-explorer
Copy link

buckets[idx][1].append([label[ind] * label_size + label[ind + 1] for ind in range(0, cur_len)] + [
            label[cur_len] * label_size + pad_label] + [pad_label * label_size + pad_label] * (
                                   thresholds[idx] - cur_len_1))

there is a part of the code where targets are formed using the above function in construct_bucket_vb

what is it happening in this part of code?

You can read the code part crit.forward(scores, tg_v, mask_v) . The author preprocess the tags for easily calculating the score of golden sentence which is part of total loss. (Main idea: transform the 2-d index into 1-d.)

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

2 participants