提交 a41da3ee authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: Brandon T. Willard

Make aesara.tensor.basic exceptions use f-strings

上级 de92edc0
...@@ -120,7 +120,7 @@ def _as_tensor_Scalar(x, name, ndim, **kwargs): ...@@ -120,7 +120,7 @@ def _as_tensor_Scalar(x, name, ndim, **kwargs):
def _as_tensor_Variable(x, name, ndim, **kwargs): def _as_tensor_Variable(x, name, ndim, **kwargs):
if not isinstance(x.type, TensorType): if not isinstance(x.type, TensorType):
raise TypeError( raise TypeError(
"Tensor type field must be a TensorType; found {}.".format(type(x.type)) f"Tensor type field must be a TensorType; found {type(x.type)}."
) )
if ndim is None: if ndim is None:
...@@ -134,9 +134,7 @@ def _as_tensor_Variable(x, name, ndim, **kwargs): ...@@ -134,9 +134,7 @@ def _as_tensor_Variable(x, name, ndim, **kwargs):
x = x.dimshuffle(list(range(x.ndim))[first_non_broadcastable:]) x = x.dimshuffle(list(range(x.ndim))[first_non_broadcastable:])
if x.ndim > ndim: if x.ndim > ndim:
raise ValueError( raise ValueError(
"Tensor of type {} could not be cast to have {} dimensions".format( f"Tensor of type {x.type} could not be cast to have {ndim} dimensions"
x.type, ndim
)
) )
return x return x
elif x.type.ndim < ndim: elif x.type.ndim < ndim:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论