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

Factorized linear supports implementation switch and gradient checkpoint #26

Merged
merged 6 commits into from
Jun 23, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Embedding supports CUDA Tensor
jiaqig committed Jun 16, 2022
commit 4e5af825fb6b00ad5982b2b3d3a04166804295ec
4 changes: 2 additions & 2 deletions tltorch/factorized_layers/factorized_embedding.py
Original file line number Diff line number Diff line change
@@ -90,7 +90,7 @@ def forward(self, input, indices=0):
#to handle case where input is not 1-D
output_shape = (*input.shape, self.embedding_dim)

flatenned_input = input.view(-1)
flatenned_input = input.flatten()

if self.n_layers == 1:
if indices == 0:
@@ -107,7 +107,7 @@ def forward(self, input, indices=0):
elif self.factorization.lower() == 'tucker':
embeddings = embeddings.reshape(input.shape[0], -1)

return embeddings.view(output_shape)
return embeddings.reshape(output_shape)

@classmethod
def from_embedding(cls,
Loading