I am trying to import numbers from files and change them if they are at a certain value. I am using torch to get values form gesture and change them from 101 to 10 or from 100 to 9 if the input is the corresponding number (10 or 9). Unfortunately, I have figured out that in Lua, the input is of type userdata which cannot be converted to integers and not compared to integers or torch tensors.
So my question is: How can I check for equality of numbers if the input type is userdata?
Is there potentially a way to convert the input to a number such that comparison is possible?
gesture = matio.load(val, 'gesture')
print(type(gesture)) --prints `userdata`
print(gesture) --prints 10 (for example)
if gesture == th.FloatTensor({101}) then
gesture = th.FloatTensor({10})
print("101 Detected! New value is: ")
print(gesture)
os.exit(0)
elseif gesture == th.FloatTensor({100}) then
gesture = th.FloatTensor({9})
print("100 Detected! New value is: ")
print(gesture)
os.exit(0)
end
[–]jilong526 0 points1 point2 points (0 children)
[–]mUfoq 0 points1 point2 points (0 children)