MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / encode

Function encode

tools/Polygraphy/polygraphy/json/serde.py:207–212  ·  view source on GitHub ↗
(array)

Source from the content-addressed store, hash-verified

205 # imported before we need to encode/decode NumPy arrays.
206 @Encoder.register(np.ndarray)
207 def encode(array):
208 outfile = io.BytesIO()
209 np.save(outfile, array, allow_pickle=False)
210 outfile.seek(0)
211 data = base64.b64encode(outfile.read()).decode()
212 return {"array": data}
213
214 @Decoder.register(np.ndarray)
215 def decode(dct):

Callers

nothing calls this directly

Calls 3

readMethod · 0.80
saveMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected