Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
68dec6bf
"...resnet50_tensorflow.git" did not exist on "5be3c06485003425e0a6892fac4fc33157d47ab3"
Unverified
Commit
68dec6bf
authored
Feb 18, 2022
by
Gautier Dagan
Committed by
GitHub
Feb 18, 2022
Browse files
Fix DETR model deprecation warnings for int div (#15702)
parent
f8ff3fad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
src/transformers/models/detr/modeling_detr.py
src/transformers/models/detr/modeling_detr.py
+2
-1
No files found.
src/transformers/models/detr/modeling_detr.py
View file @
68dec6bf
...
@@ -36,6 +36,7 @@ from ...file_utils import (
...
@@ -36,6 +36,7 @@ from ...file_utils import (
)
)
from
...modeling_outputs
import
BaseModelOutput
,
BaseModelOutputWithCrossAttentions
,
Seq2SeqModelOutput
from
...modeling_outputs
import
BaseModelOutput
,
BaseModelOutputWithCrossAttentions
,
Seq2SeqModelOutput
from
...modeling_utils
import
PreTrainedModel
from
...modeling_utils
import
PreTrainedModel
from
...pytorch_utils
import
torch_int_div
from
...utils
import
logging
from
...utils
import
logging
from
.configuration_detr
import
DetrConfig
from
.configuration_detr
import
DetrConfig
...
@@ -419,7 +420,7 @@ class DetrSinePositionEmbedding(nn.Module):
...
@@ -419,7 +420,7 @@ class DetrSinePositionEmbedding(nn.Module):
x_embed
=
x_embed
/
(
x_embed
[:,
:,
-
1
:]
+
1e-6
)
*
self
.
scale
x_embed
=
x_embed
/
(
x_embed
[:,
:,
-
1
:]
+
1e-6
)
*
self
.
scale
dim_t
=
torch
.
arange
(
self
.
embedding_dim
,
dtype
=
torch
.
float32
,
device
=
pixel_values
.
device
)
dim_t
=
torch
.
arange
(
self
.
embedding_dim
,
dtype
=
torch
.
float32
,
device
=
pixel_values
.
device
)
dim_t
=
self
.
temperature
**
(
2
*
(
dim_t
//
2
)
/
self
.
embedding_dim
)
dim_t
=
self
.
temperature
**
(
2
*
torch_int_div
(
dim_t
,
2
)
/
self
.
embedding_dim
)
pos_x
=
x_embed
[:,
:,
:,
None
]
/
dim_t
pos_x
=
x_embed
[:,
:,
:,
None
]
/
dim_t
pos_y
=
y_embed
[:,
:,
:,
None
]
/
dim_t
pos_y
=
y_embed
[:,
:,
:,
None
]
/
dim_t
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment