https://github.com/facebookresearch/pythia
Raw File
Tip revision: dabf95f523cd07e93380c6931e5140ade0f50b2f authored by Sethu Sankaran on 26 October 2021, 19:18:43 UTC
Revert D30704069: [feat] Add a refiner head that can be used with MMFT
Tip revision: dabf95f
torchscript.py
# Copyright (c) Facebook, Inc. and its affiliates.

from typing import Dict, Optional

from torch import Tensor


def getattr_torchscriptable(
    dictionary: Dict[str, Tensor], key: str, default: Optional[Tensor] = None
) -> Optional[Tensor]:
    if key in dictionary:
        return dictionary[key]
    else:
        return default
back to top