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

Add linear activation

Summary: Pull Request resolved: https://github.com/fairinternal/fairseq-py/pull/698

Differential Revision: D16068477

Pulled By: myleott

fbshipit-source-id: a68f6f519dc5481f857d8e10cc443249eccb2545
parent 0bac688c
......@@ -320,6 +320,8 @@ def get_activation_fn(activation: str) -> Callable:
return gelu_accurate
elif activation == 'tanh':
return torch.tanh
elif activation == 'linear':
return lambda x: x
else:
raise RuntimeError("--activation-fn {} not supported".format(activation))
......@@ -331,4 +333,5 @@ def get_available_activation_fns() -> List:
'gelu_fast', # deprecated
'gelu_accurate',
'tanh',
'linear',
]
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