Commit a78ad1ac authored by Myle Ott's avatar Myle Ott Committed by Facebook Github Bot
Browse files

Add utils.deprecation_warning

Summary: Pull Request resolved: https://github.com/pytorch/fairseq/pull/607

Differential Revision: D14681031

Pulled By: myleott

fbshipit-source-id: 466ee526a30543218e2b7138fb651db866ae5ab3
parent 8ab27e6e
...@@ -12,6 +12,7 @@ import os ...@@ -12,6 +12,7 @@ import os
import re import re
import sys import sys
import traceback import traceback
import warnings
import torch import torch
import torch.nn.functional as F import torch.nn.functional as F
...@@ -463,3 +464,8 @@ def log_softmax(x, dim, onnx_trace=False): ...@@ -463,3 +464,8 @@ def log_softmax(x, dim, onnx_trace=False):
return F.log_softmax(x.float(), dim=dim) return F.log_softmax(x.float(), dim=dim)
else: else:
return F.log_softmax(x, dim=dim, dtype=torch.float32) return F.log_softmax(x, dim=dim, dtype=torch.float32)
def deprecation_warning(message, stacklevel=3):
# don't use DeprecationWarning, since it's ignored by default
warnings.warn(message, stacklevel=stacklevel)
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