Пример #1
0
 def test_cudandarrayvariable(self):
     # Get counter value
     autoname_id = next(Variable.__count__)
     Variable.__count__ = count(autoname_id)
     mytype = tensor.TensorType(dtype='int32', broadcastable=())
     r1 = CudaNdarrayVariable(type='int32')
     r2 = CudaNdarrayVariable(type='int32')
     r3 = CudaNdarrayConstant(type=mytype,
                              data=1)
     r4 = CudaNdarraySharedVariable(name='x', type=mytype,
                                    value=1, strict=False)
     assert r1.auto_name == "auto_" + str(autoname_id)
     assert r2.auto_name == "auto_" + str(autoname_id + 1)
     assert r3.auto_name == "auto_" + str(autoname_id + 2)
     assert r4.auto_name == "auto_" + str(autoname_id + 3)
Пример #2
0
 def test_cudandarrayvariable(self):
     ## Re-init counter
     Variable.__count__ = count(0)
     mytype = tensor.TensorType(dtype='int32', broadcastable=())
     r1 = CudaNdarrayVariable(type='int32')
     r2 = CudaNdarrayVariable(type='int32')
     r3 = CudaNdarrayConstant(type=mytype, data=1)
     r4 = CudaNdarraySharedVariable(name='x',
                                    type=mytype,
                                    value=1,
                                    strict=False)
     assert r1.auto_name == "auto_0"
     assert r2.auto_name == "auto_1"
     assert r3.auto_name == "auto_2"
     assert r4.auto_name == "auto_3"