File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -783,13 +783,16 @@ def tensor(
783783 ** kwargs ,
784784) -> "TensorVariable" :
785785 if name is not None :
786- # Help catching errors with the new tensor API
787- # Many single letter strings are valid sctypes
788- if str (name ) == "floatX" or (len (str (name )) > 1 and np .dtype (name ).type ):
789- raise ValueError (
790- f"The first and only positional argument of tensor is now `name`. Got { name } .\n "
791- "This name looks like a dtype, which you should pass as a keyword argument only."
792- )
786+ try :
787+ # Help catching errors with the new tensor API
788+ # Many single letter strings are valid sctypes
789+ if str (name ) == "floatX" or (len (str (name )) > 1 and np .dtype (name ).type ):
790+ raise ValueError (
791+ f"The first and only positional argument of tensor is now `name`. Got { name } .\n "
792+ "This name looks like a dtype, which you should pass as a keyword argument only."
793+ )
794+ except TypeError :
795+ pass
793796
794797 if dtype is None :
795798 dtype = config .floatX
You can’t perform that action at this time.
0 commit comments