Skip to content
This repository was archived by the owner on Oct 21, 2023. It is now read-only.

Commit 92df6af

Browse files
committed
Modify GetInfo('version')
1 parent b6ebc3d commit 92df6af

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

fwdnxt.py

+10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from numpy.ctypeslib import ndpointer
66
f = CDLL("libfwdnxt.so")
77

8+
curversion = 'v0.3.16'
9+
810
#Allows None to be passed instead of a ndarray
911
def wrapped_ndptr(*args, **kwargs):
1012
base = ndpointer(*args, **kwargs)
@@ -90,6 +92,10 @@ def __init__(self):
9092

9193
self.trainlinear_end = f.ie_trainlinear_end
9294
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()
9399

94100
def TrainlinearStart(self, batchsize, A, b, Ashift, Xshift, Yshift, Ygshift, rate):
95101
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):
205211
def GetInfo(self, name):
206212
if name == 'hwtime':
207213
return_val = c_float()
214+
elif name == 'version':
215+
return_val = create_string_buffer(10)
208216
else:
209217
return_val = c_int()
210218
rc = self.ie_getinfo(self.handle, bytes(name, 'ascii'), byref(return_val))
211219
if rc != 0:
212220
raise Exception(rc)
221+
if name == 'version':
222+
return str(return_val.value, 'ascii')
213223
return return_val.value
214224
def params(self, images):
215225
if type(images) == np.ndarray:

0 commit comments

Comments
 (0)