Update file export.py
Browse files
export.py
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
def SerializeFP32(file, tensor):
|
| 2 |
d = tensor.detach().cpu().view(-1).to(torch.float32).numpy()
|
| 3 |
b = struct.pack(f'{len(d)}f', *d)
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import struct
|
| 3 |
+
import argparse
|
| 4 |
+
import json
|
| 5 |
+
|
| 6 |
+
import numpy as np
|
| 7 |
+
import torch
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
|
| 11 |
def SerializeFP32(file, tensor):
|
| 12 |
d = tensor.detach().cpu().view(-1).to(torch.float32).numpy()
|
| 13 |
b = struct.pack(f'{len(d)}f', *d)
|