forked from PaddlePaddle/Paddle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request PaddlePaddle#138 from jiweibo/go_doc
update go api doc
- Loading branch information
Showing
16 changed files
with
629 additions
and
524 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# 创建 Config | ||
|
||
`Config` 对象相关方法用于创建预测相关配置,构建 `Predictor` 对象的配置信息,如模型路径、是否开启gpu等等。 | ||
|
||
相关方法定义如下: | ||
|
||
```go | ||
// 创建 Config 对象 | ||
// 参数:None | ||
// 返回:*Config - Config 对象指针 | ||
func Config() *Config | ||
|
||
// 判断当前 Config 是否有效 | ||
// 参数:None | ||
// 返回:bool - 当前 Config 是否有效 | ||
func (config *Config) IsValid() bool | ||
``` | ||
|
||
代码示例: | ||
|
||
```go | ||
package main | ||
|
||
// 引入 Paddle Golang Package | ||
import pd "github.com/paddlepaddle/paddle/paddle/fluid/inference/goapi" | ||
import fmt | ||
|
||
func main() { | ||
// 创建 Config 对象 | ||
config := pd.NewConfig() | ||
|
||
// 判断当前 Config 是否有效 - true | ||
fmt.Println("Config validation is: ", config.IsValid()) | ||
} | ||
``` |
Oops, something went wrong.