pyrqlite
pyrqlite copied to clipboard
BinaryConverterTests.test_CheckBinaryInputForConverter fails with both pyrqlite and sqlite3
This test fails with pyrqlite as follows:
____________ BinaryConverterTests.test_CheckBinaryInputForConverter ____________
self = <test_types.BinaryConverterTests testMethod=test_CheckBinaryInputForConverter>
def test_CheckBinaryInputForConverter(self):
testdata = b"abcdefg" * 10
compressed = zlib.compress(testdata)
> result = self.con.execute('select ? as "x [bin]"', (compressed,)).fetchone()[0]
src/test/test_types.py:397:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/pyrqlite/connections.py:100: in execute
return cursor.execute(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyrqlite.cursors.Cursor object at 0x7efbf49d79d0>
operation = 'select \'x\x9cKLJNIMKO\xa4\x8c\x02\x00\xca\x0f\x1bY\' as "x [bin]"'
parameters = ('x\x9cKLJNIMKO\xa4\x8c\x02\x00\xca\x0f\x1bY',)
def execute(self, operation, parameters=None):
if parameters:
operation = self._substitute_params(operation, parameters)
command = self._get_sql_command(operation)
if command in ('SELECT', 'PRAGMA'):
payload = self._request("GET",
"/db/query?" + _urlencode({'q': operation}))
else:
payload = self._request("POST", "/db/execute?transaction",
headers={'Content-Type': 'application/json'}, body=json.dumps([operation]))
last_insert_id = None
rows_affected = -1
payload_rows = {}
try:
results = payload["results"]
except KeyError:
pass
else:
rows_affected = 0
for item in results:
if 'error' in item:
logging.error(json.dumps(item))
> raise Error(json.dumps(item))
E Error: {"error": "unrecognized token: \"'x\ufffdKLJNIMKO\ufffd\ufffd\u0002\""}
It also fails with python's own sqlite3 module, as follows:
____________ BinaryConverterTests.test_CheckBinaryInputForConverter ____________
self = <test_types.BinaryConverterTests testMethod=test_CheckBinaryInputForConverter>
def test_CheckBinaryInputForConverter(self):
testdata = b"abcdefg" * 10
compressed = zlib.compress(testdata)
> result = self.con.execute('select ? as "x [bin]"', (compressed,)).fetchone()[0]
E ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.
src/test/test_types.py:397: ProgrammingError
@alanjds
Hi @alex200420
Thank you for your interests in our work! I truly appreciate it. For the question, as mentioned in the official pytorch document, grad_outputs
means the vector in the Jacobian-vector product. In our case of multi-label classification with PPI, instead of computing the full Jacobian, we would only like to match the most critical gradient components that correspond to the target label.
Thank you for your interest again!
Cheers, Yongcheng