未验证 提交 4ff0a84b 编写于 作者: L liu zhengxi 提交者: GitHub

Python ZeroCopyTensor supplement (#1730)

add reshape(), shape(), set_lod(), lod(), type(). 
上级 38dfa334
......@@ -2,3 +2,4 @@
/doc/fluid/menu.zh.json
/doc/fluid/menu.en.json
.idea
build
......@@ -174,6 +174,7 @@ input_tensor = predictor.get_input_tensor(input_names[0])
# 设置输入
fake_input = numpy.random.randn(1, 3, 318, 318).astype("float32")
input_tensor.reshape([1, 3, 318, 318])
input_tensor.copy_from_cpu(fake_input)
# 运行predictor
......@@ -190,6 +191,11 @@ output_tensor = predictor.get_output_tensor(output_names[0])
* ZeroCopyTensor
* `copy_from_cpu(input: numpy.ndarray) -> None`
* `copy_to_cpu() -> numpy.ndarray`
* `reshape(input: numpy.ndarray|List[int]) -> None`
* `shape() -> List[int]`
* `set_lod(input: numpy.ndarray|List[List[int]]) -> None`
* `lod() -> List[List[int]]`
* `type() -> PaddleDType`
* AnalysisConfig
* `set_model(model_dir: str) -> None`
* `set_model(prog_file: str, params_file: str) -> None`
......@@ -312,6 +318,7 @@ def main():
# 设置输入
fake_input = np.random.randn(1, 3, 318, 318).astype("float32")
input_tensor.reshape([1, 3, 318, 318])
input_tensor.copy_from_cpu(fake_input)
# 运行predictor
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册