如何判断变量是否为Lua(Torch7)中的nngraph.Node

假设有一个名为a的变量,print(a)的输出为nngraph.Node(这来自于torch7包),print(type(a))的输出为table,那么如何使用if语句判断变量是否为nngraph.Node

语句

if a== nngraph.Node then

或者

if a== "nngraph.Node" then

都是不正确的!

点赞