def _is_sparse_variable(x):
"""
Returns
-------
boolean
True iff x is a L{SparseVariable} (and not a L{tensor.TensorType},
for instance).
"""
if not isinstance(x, gof.Variable):
raise NotImplementedError("this function should only be called on "
"*variables* (of type sparse.SparseType "
"or tensor.TensorType, for instance), not ",
x)
return isinstance(x.type, SparseType)
评论列表
文章目录