Make tuple checks faster (#16657)
authorAdam Paszke <adam.paszke@gmail.com>
Tue, 5 Feb 2019 17:31:21 +0000 (09:31 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 5 Feb 2019 17:35:37 +0000 (09:35 -0800)
commit963e410b57ce55f6381413ad2774ea6e75cc9cee
treebb8bf61d3d36617c39176893fec22c4d8108d799
parent85ad011843086c21269eb172bf51057092961b69
Make tuple checks faster (#16657)

Summary:
As the comment indicates, the issue is only present in some versions of
Python 2, so we should be able to use heavily optimized PyTuple_Check in
most cases, and skip allocation of the strings, and unnecessary lookups
on object's type.

cc ezyang zasdfgbnm
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16657

Differential Revision: D13957854

Pulled By: ezyang

fbshipit-source-id: be32eb473ad77a0805e8247d8d583d673d4bdf25
torch/csrc/utils/six.h