Add SymbolicShape and replace all uses of VaryingShape<ShapeSymbol> with it (#38544)
Summary:
Adding a SymbolicShape class to represent a generic tensor shape with ShapeSymbols.
Its core data structure is c10::optional<std::vector<ShapeSymbol>>. If has_value() == false, it represents an unranked tensor shape. At any dimension ShapeSymbol can contain dynamic size, checkable with ShapeSymbol::IsStatic method.
SymbolicShape now replaces all uses of VaryingShape<ShapeSymbol>, ie c10::optional<std::vector<c10::optional<ShapeSymbol>>>. The inner c10::optional wrapper around ShapeSymbol used to indicate dynamic shape, which overlaps with part of ShapeSymbol's representation.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/38544
Reviewed By: ZolotukhinM
Differential Revision: D21693984
Pulled By: gmagogsfm
fbshipit-source-id: 6e633e4f36cf570d6fb34ac15d00ec1fb2054a09