|
5 | 5 | from numpy.ctypeslib import ndpointer
|
6 | 6 | f = CDLL("libfwdnxt.so")
|
7 | 7 |
|
| 8 | +curversion = 'v0.3.16' |
| 9 | + |
8 | 10 | #Allows None to be passed instead of a ndarray
|
9 | 11 | def wrapped_ndptr(*args, **kwargs):
|
10 | 12 | base = ndpointer(*args, **kwargs)
|
@@ -90,6 +92,10 @@ def __init__(self):
|
90 | 92 |
|
91 | 93 | self.trainlinear_end = f.ie_trainlinear_end
|
92 | 94 | self.trainlinear_end.argtypes = [c_void_p]
|
| 95 | + v = self.GetInfo('version') |
| 96 | + if v != curversion: |
| 97 | + print('Wrong libfwdnxt.so found, expecting', curversion, 'and found', v, 'quitting') |
| 98 | + quit() |
93 | 99 |
|
94 | 100 | def TrainlinearStart(self, batchsize, A, b, Ashift, Xshift, Yshift, Ygshift, rate):
|
95 | 101 | self.trainlinear_start(self.handle, A.shape[1], A.shape[0], batchsize, A, b, Ashift, Xshift, Yshift, Ygshift, rate)
|
@@ -205,11 +211,15 @@ def SetFlag(self, name, value):
|
205 | 211 | def GetInfo(self, name):
|
206 | 212 | if name == 'hwtime':
|
207 | 213 | return_val = c_float()
|
| 214 | + elif name == 'version': |
| 215 | + return_val = create_string_buffer(10) |
208 | 216 | else:
|
209 | 217 | return_val = c_int()
|
210 | 218 | rc = self.ie_getinfo(self.handle, bytes(name, 'ascii'), byref(return_val))
|
211 | 219 | if rc != 0:
|
212 | 220 | raise Exception(rc)
|
| 221 | + if name == 'version': |
| 222 | + return str(return_val.value, 'ascii') |
213 | 223 | return return_val.value
|
214 | 224 | def params(self, images):
|
215 | 225 | if type(images) == np.ndarray:
|
|
0 commit comments