add float[] str[] constants (#31503)

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

Add support for float lists and string lists constants, which enables better constant propagation + constant pooling + freezing.

Test Plan: Imported from OSS

Differential Revision: D19233558

Pulled By: eellison

fbshipit-source-id: 4f7c6d9ddbe7623757a9a20606ce5f394e14e93d
This commit is contained in:
Elias Ellison
2019-12-30 11:56:22 -08:00
committed by Facebook Github Bot
parent 6064223808
commit dd0f2f0c19
8 changed files with 108 additions and 56 deletions
+11
View File
@@ -203,6 +203,17 @@ graph(%0 : Tensor,
)IR");
}
{
checkRoundtrip(
R"IR(
graph():
%0 : float[] = prim::Constant[value=[1., 2., 3.]]()
%1 : str[] = prim::Constant[value=["ab", "cd", "ef"]]()
%2 : (float[], str[]) = prim::TupleConstruct(%0, %1)
return (%2)
)IR");
}
{
bool error_thrown = false;
try {