本文整理匯總了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)