本文整理汇总了Python中theano.typed_list.type.TypedListType类的典型用法代码示例。如果您正苦于以下问题:Python TypedListType类的具体用法?Python TypedListType怎么用?Python TypedListType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TypedListType类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_interface
def test_interface(self):
mySymbolicMatricesList = TypedListType(T.TensorType(theano.config.floatX, (False, False)))()
z = mySymbolicMatricesList.__len__()
f = theano.function([mySymbolicMatricesList], z)
x = rand_ranged_matrix(-1000, 1000, [100, 101])
self.assertTrue(f([x, x]) == 2)
示例2: test_filter_sanity_check
def test_filter_sanity_check(self):
# Simple test on typed list type filter
myType = TypedListType(T.TensorType(theano.config.floatX,
(False, False)))
x = rand_ranged_matrix(-1000, 1000, [100, 100])
self.assertTrue(np.array_equal(myType.filter([x]), [x]))
示例3: test_get_depth
def test_get_depth(self):
# test case for get_depth utilitary function
myType = TypedListType(T.TensorType(theano.config.floatX,
(False, False)))
myManualNestedType = TypedListType(TypedListType(
TypedListType(myType)))
self.assertTrue(myManualNestedType.get_depth() == 3)
示例4: test_intern_filter
def test_intern_filter(self):
# Test checking if values contained are themselves
# filtered. If they weren't this code would raise
# an exception.
myType = TypedListType(T.TensorType('float64',
(False, False)))
x = np.asarray([[4, 5], [4, 5]], dtype='float32')
self.assertTrue(np.array_equal(myType.filter([x]), [x]))
示例5: test_basic_nested_list
def test_basic_nested_list(self):
# Testing nested list with one level of depth
myNestedType = TypedListType(T.TensorType(theano.config.floatX,
(False, False)))
myType = TypedListType(myNestedType)
x = rand_ranged_matrix(-1000, 1000, [100, 100])
self.assertTrue(np.array_equal(myType.filter([[x]]), [[x]]))
示例6: test_interfaces
def test_interfaces(self):
mySymbolicMatricesList = TypedListType(T.TensorType(theano.config.floatX, (False, False)))()
myMatrix = T.matrix()
z = mySymbolicMatricesList.append(myMatrix)
f = theano.function([mySymbolicMatricesList, myMatrix], z)
x = rand_ranged_matrix(-1000, 1000, [100, 101])
y = rand_ranged_matrix(-1000, 1000, [100, 101])
self.assertTrue(numpy.array_equal(f([x], y), [x, y]))
示例7: test_interface
def test_interface(self):
mySymbolicMatricesList1 = TypedListType(T.TensorType(
theano.config.floatX, (False, False)))()
mySymbolicMatricesList2 = TypedListType(T.TensorType(
theano.config.floatX, (False, False)))()
z = mySymbolicMatricesList1.extend(mySymbolicMatricesList2)
f = theano.function([mySymbolicMatricesList1, mySymbolicMatricesList2],
z)
x = rand_ranged_matrix(-1000, 1000, [100, 101])
y = rand_ranged_matrix(-1000, 1000, [100, 101])
self.assertTrue(np.array_equal(f([x], [y]), [x, y]))