Mapping Between mox.file and Local APIs and Switchover
API Mapping
- Python: local file operation APIs of Python. The APIs can be shifted to the corresponding MoXing file operation APIs (mox.file) by one click.
- mox.file: file operation APIs in the MoXing framework, which have a one-to-one mapping relationship with Python APIs.
- tf.gfile: TensorFlow file operation APIs that have the same functions as the MoXing file operation APIs. In MoXing, the file operation APIs will not be automatically switched to the TensorFlow APIs. The following table only shows the similar functions to help you quickly understand the functions of the MoXing file operation APIs.
| Python (Local File Operation API) | mox.file (MoXing File Operation API) | tf.gfile (TensorFlow File Operation API) |
|---|---|---|
| glob.glob | mox.file.glob | tf.gfile.Glob |
| os.listdir | mox.file.list_directory(..., recursive=False) | tf.gfile.ListDirectory |
| os.makedirs | mox.file.make_dirs | tf.gfile.MakeDirs |
| os.mkdir | mox.file.mk_dir | tf.gfile.MkDir |
| os.path.exists | mox.file.exists | tf.gfile.Exists |
| os.path.getsize | mox.file.get_size | - |
| os.path.isdir | mox.file.is_directory | tf.gfile.IsDirectory |
| os.remove | mox.file.remove(..., recursive=False) | tf.gfile.Remove |
| os.rename | mox.file.rename | tf.gfile.Rename |
| os.scandir | mox.file.scan_dir | - |
| os.stat | mox.file.stat (st_mtime is the GMT time.) | tf.gfile.Stat |
| os.walk | mox.file.walk | tf.gfile.Walk |
| open | mox.file.File | tf.gfile.FastGFile(tf.gfile.Gfile) |
| shutil.copyfile | mox.file.copy | tf.gfile.Copy |
| shutil.copytree | mox.file.copy_parallel | - |
| shutil.rmtree | mox.file.remove(..., recursive=True) | tf.gfile.DeleteRecursively |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot