本文整理汇总了Python中theano.misc.ordered_set.OrderedSet.union方法的典型用法代码示例。如果您正苦于以下问题:Python OrderedSet.union方法的具体用法?Python OrderedSet.union怎么用?Python OrderedSet.union使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类theano.misc.ordered_set.OrderedSet
的用法示例。
在下文中一共展示了OrderedSet.union方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Query
# 需要导入模块: from theano.misc.ordered_set import OrderedSet [as 别名]
# 或者: from theano.misc.ordered_set.OrderedSet import union [as 别名]
class Query(object):
"""
Parameters
----------
position_cutoff : float
Used by SequenceDB to keep only optimizer that are positioned before
the cut_off point.
"""
def __init__(self, include, require=None, exclude=None,
subquery=None, position_cutoff=None):
self.include = OrderedSet(include)
self.require = require or OrderedSet()
self.exclude = exclude or OrderedSet()
self.subquery = subquery or {}
self.position_cutoff = position_cutoff
if isinstance(self.require, (list, tuple)):
self.require = OrderedSet(self.require)
if isinstance(self.exclude, (list, tuple)):
self.exclude = OrderedSet(self.exclude)
def __str__(self):
return ("Query{inc=%s,ex=%s,require=%s,subquery=%s,"
"position_cutoff=%d}" %
(self.include, self.exclude, self.require, self.subquery,
self.position_cutoff))
# add all opt with this tag
def including(self, *tags):
return Query(self.include.union(tags),
self.require,
self.exclude,
self.subquery,
self.position_cutoff)
# remove all opt with this tag
def excluding(self, *tags):
return Query(self.include,
self.require,
self.exclude.union(tags),
self.subquery,
self.position_cutoff)
# keep only opt with this tag.
def requiring(self, *tags):
return Query(self.include,
self.require.union(tags),
self.exclude,
self.subquery,
self.position_cutoff)
示例2: Query
# 需要导入模块: from theano.misc.ordered_set import OrderedSet [as 别名]
# 或者: from theano.misc.ordered_set.OrderedSet import union [as 别名]
class Query(object):
"""
Parameters
----------
position_cutoff : float
Used by SequenceDB to keep only optimizer that are positioned before
the cut_off point.
"""
def __init__(self, include, require=None, exclude=None,
subquery=None, position_cutoff=None,
extra_optimizations=None):
self.include = OrderedSet(include)
self.require = require or OrderedSet()
self.exclude = exclude or OrderedSet()
self.subquery = subquery or {}
self.position_cutoff = position_cutoff
if extra_optimizations is None:
extra_optimizations = []
self.extra_optimizations = extra_optimizations
if isinstance(self.require, (list, tuple)):
self.require = OrderedSet(self.require)
if isinstance(self.exclude, (list, tuple)):
self.exclude = OrderedSet(self.exclude)
def __str__(self):
return ("Query{inc=%s,ex=%s,require=%s,subquery=%s,"
"position_cutoff=%d,extra_opts=%s}" %
(self.include, self.exclude, self.require, self.subquery,
self.position_cutoff, self.extra_optimizations))
def __setstate__(self, state):
self.__dict__.update(state)
if not hasattr(self, 'extra_optimizations'):
self.extra_optimizations = []
# add all opt with this tag
def including(self, *tags):
return Query(self.include.union(tags),
self.require,
self.exclude,
self.subquery,
self.position_cutoff,
self.extra_optimizations)
# remove all opt with this tag
def excluding(self, *tags):
return Query(self.include,
self.require,
self.exclude.union(tags),
self.subquery,
self.position_cutoff,
self.extra_optimizations)
# keep only opt with this tag.
def requiring(self, *tags):
return Query(self.include,
self.require.union(tags),
self.exclude,
self.subquery,
self.position_cutoff,
self.extra_optimizations)
def register(self, *optimizations):
return Query(self.include,
self.require,
self.exclude,
self.subquery,
self.position_cutoff,
self.extra_optimizations + list(optimizations))