Skip to content

Commit

Permalink
[meta_tensor] fix error strings in meta registrations
Browse files Browse the repository at this point in the history
  • Loading branch information
1SAA committed Feb 17, 2023
1 parent 45d775c commit ca36d52
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions torch/_meta_registrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -1470,7 +1470,7 @@ def common_meta_baddbmm_bmm(batch1, batch2, is_bmm, self_baddbmm=None):
check(self_baddbmm.dim() == 3, lambda: "self must be a 3D tensor")
check(
self_baddbmm.size() == output_size,
lambda: "Expected an input tensor shape with shape {output_size} but got shape: {self.size()}",
lambda: f"Expected an input tensor shape with shape {output_size} but got shape: {self_baddbmm.size()}",
)

return output
Expand Down Expand Up @@ -1667,7 +1667,7 @@ def meta_max_pool2d_with_indices_backward(

check(
self.dtype == grad_output.dtype,
lambda: "expected dtype {self.dtype} for `gradOutput` but got dtype {grad_output.dtype}",
lambda: f"Expected dtype {self.dtype} for `gradOutput` but got dtype {grad_output.dtype}",
)

nOutputPlane = nInputPlane
Expand Down Expand Up @@ -2280,7 +2280,7 @@ def upsample_common_check(input_size, output_size, num_spatial_dims):
def upsample_nearest1d(input, output_size, scales=None):
check(
input.numel() != 0 or multiply_integers(input.size()[1:]),
lambda: "Non-empty 3D data tensor expected but got a tensor with sizes {input.size()}",
lambda: f"Non-empty 3D data tensor expected but got a tensor with sizes {input.size()}",
)
full_output_size = upsample_common_check(
input.size(), output_size, num_spatial_dims=1
Expand All @@ -2294,7 +2294,7 @@ def upsample_nearest1d(input, output_size, scales=None):
def upsample_nearest2d(input, output_size, scales_h=None, scales_w=None):
check(
input.numel() != 0 or multiply_integers(input.size()[1:]),
lambda: "Non-empty 4D data tensor expected but got a tensor with sizes {input.size()}",
lambda: f"Non-empty 4D data tensor expected but got a tensor with sizes {input.size()}",
)
full_output_size = upsample_common_check(
input.size(), output_size, num_spatial_dims=2
Expand All @@ -2318,7 +2318,7 @@ def upsample_nearest2d(input, output_size, scales_h=None, scales_w=None):
def upsample_nearest3d(input, output_size, scales_d=None, scales_h=None, scales_w=None):
check(
input.numel() != 0 or multiply_integers(input.size()[1:]),
lambda: "Non-empty 5D data tensor expected but got a tensor with sizes {input.size()}",
lambda: f"Non-empty 5D data tensor expected but got a tensor with sizes {input.size()}",
)
full_output_size = upsample_common_check(
input.size(), output_size, num_spatial_dims=3
Expand Down

0 comments on commit ca36d52

Please sign in to comment.