Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
Signed-off-by: Zhiyuan Chen <[email protected]>
  • Loading branch information
ZhiyuanChen committed Mar 25, 2024
1 parent e1baf5e commit d06a64d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ Moreover, [`FlatDict`][chanfig.FlatDict] comes with [`difference`][chanfig.FlatD
[`FlatDict`][chanfig.FlatDict] supports [`to`][chanfig.FlatDict.to] method similar to PyTorch Tensor.
You can simply convert all member values of [`FlatDict`][chanfig.FlatDict] to a certain type or pass to a device in the same way.

[`FlatDict`][chanfig.FlatDict] also integrates `cpu`, `gpu` (`cuda`), and `tpu` (`xla`) methods for easier access.
[`FlatDict`][chanfig.FlatDict] also integrates [`cpu`][chanfig.FlatDict.cpu], [`gpu`][chanfig.FlatDict.gpu] ([`cuda`][chanfig.FlatDict.cuda]), and [`tpu`][chanfig.FlatDict.tpu] ([`xla`][chanfig.FlatDict.xla]) methods for easier access.

#### IO Operations

[`FlatDict`][chanfig.FlatDict] provides `json`, `jsons`, `yaml` and `yamls` methods to dump [`FlatDict`][chanfig.FlatDict] to a file or string.
It also provides `from_json`, `from_jsons`, `from_yaml` and `from_yamls` methods to build a [`FlatDict`][chanfig.FlatDict] from a string or file.
[`FlatDict`][chanfig.FlatDict] provides [`json`][chanfig.FlatDict.json], [`jsons`][chanfig.FlatDict.jsons], [`yaml`][chanfig.FlatDict.yaml] and [`yamls`][chanfig.FlatDict.yamls] methods to dump [`FlatDict`][chanfig.FlatDict] to a file or string.
It also provides [`from_json`][chanfig.FlatDict.from_json], [`from_jsons`][chanfig.FlatDict.from_jsons], [`from_yaml`][chanfig.FlatDict.from_yaml] and [`from_yamls`][chanfig.FlatDict.from_yamls] methods to build a [`FlatDict`][chanfig.FlatDict] from a string or file.

[`FlatDict`][chanfig.FlatDict] also includes `dump` and `load` methods which determine the type by their extension and dump/load [`FlatDict`][chanfig.FlatDict] to/from a file.

Expand Down
6 changes: 3 additions & 3 deletions README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ Python 的`dict`自 Python 3.7 之后就是有序的,但是并没有一个内
[`FlatDict`][chanfig.FlatDict]支持与 Pytorch Tensor 类似的[`to`][chanfig.FlatDict.to]方法。
你可以很简单的通过相同的方式将所有[`FlatDict`][chanfig.FlatDict]的成员值转换为某种类型或者转移到某个设备上。

[`FlatDict`][chanfig.FlatDict]同时集成了`cpu``gpu` (`cuda`)、`tpu` (`xla`)方法来提供更便捷的访问。
[`FlatDict`][chanfig.FlatDict]同时集成了[`cpu`][chanfig.FlatDict.cpu][`gpu`][chanfig.FlatDict.gpu] ([`cuda`][chanfig.FlatDict.cuda])、[`tpu`][chanfig.FlatDict.tpu] ([`xla`][chanfig.FlatDict.xla])方法来提供更便捷的访问。

#### IO 操作

[`FlatDict`][chanfig.FlatDict]支持`json``jsons``yaml``yamls`方法来将[`FlatDict`][chanfig.FlatDict]存储到文件或者转换成字符串。
它还提供了`from_json``from_jsons``from_yaml``from_yamls`来从一个字符串或者文件中构建[`FlatDict`][chanfig.FlatDict]
[`FlatDict`][chanfig.FlatDict]支持[`json`][chanfig.FlatDict.json][`jsons`][chanfig.FlatDict.jsons][`yaml`][chanfig.FlatDict.yaml][`yamls`][chanfig.FlatDict.yamls]方法来将[`FlatDict`][chanfig.FlatDict]存储到文件或者转换成字符串。
它还提供了[`from_json`][chanfig.FlatDict.from_json][`from_jsons`][chanfig.FlatDict.from_jsons][`from_yaml`][chanfig.FlatDict.from_yaml][`from_yamls`][chanfig.FlatDict.from_yamls]来从一个字符串或者文件中构建[`FlatDict`][chanfig.FlatDict]

[`FlatDict`][chanfig.FlatDict]也包括了`dump``load`方法,他们可以从文件扩展名中自动推断类型然后将[`FlatDict`][chanfig.FlatDict]存储到文件中/从文件中加载[`FlatDict`][chanfig.FlatDict]

Expand Down

0 comments on commit d06a64d

Please sign in to comment.