def _is_dense_variable(x):
"""
Returns
-------
boolean
True if x is a L{tensor.TensorType} (and not a L{SparseVariable},
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, tensor.TensorType)
评论列表
文章目录