"...resnet50_tensorflow.git" did not exist on "5be3c06485003425e0a6892fac4fc33157d47ab3"
Unverified Commit 68dec6bf authored by Gautier Dagan's avatar Gautier Dagan Committed by GitHub
Browse files

Fix DETR model deprecation warnings for int div (#15702)

parent f8ff3fad
...@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment