[PyTorch][codemod] Replace immediately-dereferenced cast calls w/castRaw (#50229)

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

`fastmod -m 'cast(<((at|c10)::)?\w+Type>\(\)\s*)->' 'castRaw${1}->'` Presuming it builds, this is a safe change: the
result of `cast()` wasn't being saved anywhere, so we didn't need
it, so we can use a raw pointer instead of a new `shared_ptr`.
ghstack-source-id: 120769170

Test Plan: CI

Reviewed By: SplitInfinity

Differential Revision: D25837494

fbshipit-source-id: 46319100dc0dfc78f6d2b45148207f83481f2ada
This commit is contained in:
Scott Wolchok
2021-02-01 23:09:26 -08:00
committed by Facebook GitHub Bot
parent f0006315a9
commit 7328710cbc
20 changed files with 44 additions and 41 deletions

View File

@ -257,7 +257,7 @@ struct SchemaParser {
break;
}
case TypeKind::ListType: {
auto elem_kind = arg_type->cast<ListType>()->getElementType();
auto elem_kind = arg_type->castRaw<ListType>()->getElementType();
if (L.cur().kind == TK_IDENT) {
return parseTensorDefault(range);
} else if (arg_N && L.cur().kind != '[') {