Skip to content
This repository has been archived by the owner on Mar 19, 2021. It is now read-only.

Add a scalar weight classifier #18

Merged
merged 1 commit into from
Jan 7, 2020
Merged

Add a scalar weight classifier #18

merged 1 commit into from
Jan 7, 2020

Conversation

danieldk
Copy link
Member

@danieldk danieldk commented Jan 7, 2020

No description provided.

@danieldk danieldk requested review from DiveFish and twuebi January 7, 2020 13:51
src/scalar_weighting.rs Outdated Show resolved Hide resolved
//
// stack the layers to get a single tensor of shape:
// [batch_size, sequence_len, n_layers, layer_size]
let layers = Tensor::stack(&layers, 2);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does stack compare to a for loop?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question! In the big picture, these differences will not be visible, since the encoder dominates things time-wise. But we could benchmark this in isolation. I will create an issue to write a criterion bench for this. We could then replace it by a for-loop if it is faster.

@danieldk danieldk merged commit 6f2321c into master Jan 7, 2020
@danieldk danieldk deleted the scalar-weight branch January 7, 2020 14:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants