Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
combo
Manage
Activity
Members
Labels
Plan
Issues
20
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Syntactic Tools
combo
Commits
63d3cf6f
Commit
63d3cf6f
authored
3 years ago
by
Mateusz Klimaszewski
Browse files
Options
Downloads
Patches
Plain Diff
Use default tensor constructor.
parent
000157b0
Branches
update_allennlp
Branches containing commit
No related merge requests found
Pipeline
#2882
passed with stage
in 3 minutes and 15 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
combo/data/token_indexers/token_characters_indexer.py
+3
-2
3 additions, 2 deletions
combo/data/token_indexers/token_characters_indexer.py
with
3 additions
and
2 deletions
combo/data/token_indexers/token_characters_indexer.py
+
3
−
2
View file @
63d3cf6f
...
...
@@ -56,7 +56,8 @@ class TokenCharactersIndexer(token_characters_indexer.TokenCharactersIndexer):
padded_tokens
.
pop
()
# Truncates all the tokens to the desired length, and return the result.
return
{
"
token_characters
"
:
torch
.
LongTensor
(
[
list
(
token
[:
desired_token_length
])
for
token
in
padded_tokens
]
"
token_characters
"
:
torch
.
tensor
(
[
list
(
token
[:
desired_token_length
])
for
token
in
padded_tokens
],
dtype
=
torch
.
long
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment