2016-09-20 38 views
1
from cs231n.fast_layers import conv_forward_fast, conv_backward_fast 

out_fast, cache_fast = conv_forward_fast(x, w, b, conv_param) 

如何通过命令找到conv_forward_fast函数的位置?如何知道从库中导入的python函数的位置

+0

你的意思是它属于什么模块?或者它在你的代码中? – mrstebo

+0

它属于哪个模块。以及模块位于何处。 –

+0

我认为这可能是一些帮助,http://stackoverflow.com/questions/7027848/getting-corresponding-module-from-function – mrstebo

回答

2

你可以只

import cs231n.fast_layers as path 
print(path) 

,它会告诉你该库的路径。

+0

那么它给的内存位置,但我想要的是找到的位置,它在哪里实际上来自于。 –

+0

@GayalShamane我改变了我的回答有点 – Aaron

+0

导入错误回溯(最近通话最后一个) () ----> 1的进口cs231n.fast_layers.conv_forward_fast为路径 2打印(路径) ImportError:没有名为conv_forward_fast的模块 –

0

在Python 2.x中:

from os.path import join 
path_to_module = __import__(join.__module__).__file__