(db, tag_id, step)
| 394 | |
| 395 | |
| 396 | def get_tensor(db, tag_id, step): |
| 397 | cursor = db.execute( |
| 398 | 'SELECT dtype, shape, data FROM Tensors WHERE series = ? AND step = ?', |
| 399 | (tag_id, step)) |
| 400 | dtype, shape, data = cursor.fetchone() |
| 401 | assert dtype in _NUMPY_NUMERIC_TYPES |
| 402 | buf = np.frombuffer(data, dtype=_NUMPY_NUMERIC_TYPES[dtype]) |
| 403 | if not shape: |
| 404 | return buf[0] |
| 405 | return buf.reshape([int(i) for i in shape.split(',')]) |
| 406 | |
| 407 | |
| 408 | def int64(x): |
no test coverage detected