def dense_to_sparse_non_scalar(tensor):
    indices = array_ops.where(array_ops.ones_like(tensor, dtype=dtypes.bool))
    values = array_ops.gather_nd(tensor, indices)
    shape = array_ops.shape(tensor, out_type=dtypes.int64)
    return sparse_tensor.SparseTensorValue(indices, values, shape)
def dense_to_sparse_non_scalar(tensor):
    indices = array_ops.where(array_ops.ones_like(tensor, dtype=dtypes.bool))
    values = array_ops.gather_nd(tensor, indices)
    shape = array_ops.shape(tensor, out_type=dtypes.int64)
    return sparse_tensor.SparseTensorValue(indices, values, shape)