def _is_sparse_variable(x):
 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)

def _is_sparse_variable ( x ) : 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 )
returns boolean true iff x is a l{sparsevariable} .