py_func是不是不支持object member function呢? 如果func需要外部的资源,该怎么做呢?
Created by: fseasy
- 标题:使用member function 给py_func的func参数,但是报错; 我的func需要访问tensor外的外部资源,该怎么做呢?
- 版本、环境信息: 1)PaddlePaddle版本:1.6.3 2)CPU/GPU:CUDA Capability: 70, Driver API Version: 10.1, Runtime API Version: 10.0 3)系统环境:CentOS 7 4)Python版本号 3.7.4 5)显存信息: 32G
- 复现信息:
class O(object):
def __init__(self):
self._global_data = ["a", "b", "c"]
def forward(self, t):
return numpy.array([1,2])
----
o = O()
fluid.layers.py_func(x=t, func=o.forward, ...)
- 问题描述:
报错:
py_func raises an exception pybind11::error_already_set, IndexError: tuple index out of range