本文整理汇总了Python中smqtk.representation.descriptor_element.local_elements.DescriptorMemoryElement.has_vector方法的典型用法代码示例。如果您正苦于以下问题:Python DescriptorMemoryElement.has_vector方法的具体用法?Python DescriptorMemoryElement.has_vector怎么用?Python DescriptorMemoryElement.has_vector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类smqtk.representation.descriptor_element.local_elements.DescriptorMemoryElement
的用法示例。
在下文中一共展示了DescriptorMemoryElement.has_vector方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_none_set
# 需要导入模块: from smqtk.representation.descriptor_element.local_elements import DescriptorMemoryElement [as 别名]
# 或者: from smqtk.representation.descriptor_element.local_elements.DescriptorMemoryElement import has_vector [as 别名]
def test_none_set(self):
d = DescriptorMemoryElement('test', 0)
ntools.assert_false(d.has_vector())
d.set_vector(numpy.ones(16))
ntools.assert_true(d.has_vector())
numpy.testing.assert_equal(d.vector(), numpy.ones(16))
d.set_vector(None)
ntools.assert_false(d.has_vector())
ntools.assert_is(d.vector(), None)
示例2: test_none_set
# 需要导入模块: from smqtk.representation.descriptor_element.local_elements import DescriptorMemoryElement [as 别名]
# 或者: from smqtk.representation.descriptor_element.local_elements.DescriptorMemoryElement import has_vector [as 别名]
def test_none_set(self):
d = DescriptorMemoryElement('test', 0)
self.assertFalse(d.has_vector())
d.set_vector(numpy.ones(16))
self.assertTrue(d.has_vector())
numpy.testing.assert_equal(d.vector(), numpy.ones(16))
d.set_vector(None)
self.assertFalse(d.has_vector())
self.assertIs(d.vector(), None)
示例3: test_output_immutability
# 需要导入模块: from smqtk.representation.descriptor_element.local_elements import DescriptorMemoryElement [as 别名]
# 或者: from smqtk.representation.descriptor_element.local_elements.DescriptorMemoryElement import has_vector [as 别名]
def test_output_immutability(self):
# make sure that data stored is not susceptible to modifications after
# extraction
v = numpy.ones(16)
d = DescriptorMemoryElement('test', 0)
ntools.assert_false(d.has_vector())
d.set_vector(v)
r = d.vector()
r[:] = 0
ntools.assert_equal(r.sum(), 0)
ntools.assert_equal(d.vector().sum(), 16)