mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[BE] Use f-string in various Python functions (#44161)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/44161 Reviewed By: seemethere Differential Revision: D23515874 Pulled By: malfet fbshipit-source-id: 868cf65aedd58fce943c08f8e079e84e0a36df1f
This commit is contained in:
committed by
Facebook GitHub Bot
parent
28b1360d24
commit
0c01f136f3
@ -45,7 +45,7 @@ class SobolEngine(object):
|
||||
def __init__(self, dimension, scramble=False, seed=None):
|
||||
if dimension > self.MAXDIM or dimension < 1:
|
||||
raise ValueError("Supported range of dimensionality "
|
||||
"for SobolEngine is [1, {}]".format(self.MAXDIM))
|
||||
f"for SobolEngine is [1, {self.MAXDIM}]")
|
||||
|
||||
self.seed = seed
|
||||
self.scramble = scramble
|
||||
@ -120,9 +120,9 @@ class SobolEngine(object):
|
||||
return self
|
||||
|
||||
def __repr__(self):
|
||||
fmt_string = ['dimension={}'.format(self.dimension)]
|
||||
fmt_string = [f'dimension={self.dimension}']
|
||||
if self.scramble:
|
||||
fmt_string += ['scramble=True']
|
||||
if self.seed is not None:
|
||||
fmt_string += ['seed={}'.format(self.seed)]
|
||||
fmt_string += [f'seed={self.seed}']
|
||||
return self.__class__.__name__ + '(' + ', '.join(fmt_string) + ')'
|
||||
|
Reference in New Issue
Block a user