将 PathLike
对象的输入转换为 str
类型。
用法
tf.compat.path_to_str(
path
)
参数
-
path
可以转换为路径表示的对象。
返回
-
str
对象。
从 PathLike
对象的任何 python 常量表示形式转换为字符串。如果输入不是PathLike
对象,则只需返回输入。
用法:
如果需要来自 os.PathLike
对象的简化 str
版本的路径
例子:
$ tf.compat.path_to_str('C:\XYZ\tensorflow\./.././tensorflow')
'C:\XYZ\tensorflow\./.././tensorflow' # Windows OS
$ tf.compat.path_to_str(Path('C:\XYZ\tensorflow\./.././tensorflow'))
'C:\XYZ\tensorflow\..\tensorflow' # Windows OS
$ tf.compat.path_to_str(Path('./corpus'))
'corpus' # Linux OS
$ tf.compat.path_to_str('./.././Corpus')
'./.././Corpus' # Linux OS
$ tf.compat.path_to_str(Path('./.././Corpus'))
'../Corpus' # Linux OS
$ tf.compat.path_to_str(Path('./..////../'))
'../..' # Linux OS
相关用法
- Python tf.compat.v1.distributions.Multinomial.stddev用法及代码示例
- Python tf.compat.v1.distribute.MirroredStrategy.experimental_distribute_dataset用法及代码示例
- Python tf.compat.v1.data.TFRecordDataset.interleave用法及代码示例
- Python tf.compat.v1.distributions.Bernoulli.cross_entropy用法及代码示例
- Python tf.compat.v1.Variable.eval用法及代码示例
- Python tf.compat.v1.train.FtrlOptimizer.compute_gradients用法及代码示例
- Python tf.compat.v1.layers.conv3d用法及代码示例
- Python tf.compat.v1.strings.length用法及代码示例
- Python tf.compat.v1.data.Dataset.snapshot用法及代码示例
- Python tf.compat.v1.data.experimental.SqlDataset.reduce用法及代码示例
- Python tf.compat.v1.feature_column.categorical_column_with_vocabulary_file用法及代码示例
- Python tf.compat.v1.data.TextLineDataset.from_tensors用法及代码示例
- Python tf.compat.v1.variable_scope用法及代码示例
- Python tf.compat.v1.data.experimental.SqlDataset.as_numpy_iterator用法及代码示例
- Python tf.compat.v1.distributions.Bernoulli.covariance用法及代码示例
- Python tf.compat.v1.placeholder用法及代码示例
- Python tf.compat.v1.layers.Conv3D用法及代码示例
- Python tf.compat.v1.train.get_or_create_global_step用法及代码示例
- Python tf.compat.v1.nn.static_rnn用法及代码示例
- Python tf.compat.v1.debugging.assert_shapes用法及代码示例
注:本文由纯净天空筛选整理自tensorflow.org大神的英文原创作品 tf.compat.path_to_str。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。