當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python mxnet.recordio.pack用法及代碼示例

用法:

mxnet.recordio.pack(header, s)

參數

  • header(IRHeader) - 圖像記錄的標題。header.label可以是數字或數組。查看更多詳細信息IRHeader.
  • s(str) - 要打包的原始圖像字符串。

返回

s- 打包的字符串。

返回類型

str

將字符串打包到 MXImageRecord 中。

例子

>>> label = 4 # label can also be a 1-D array, for example: label = [1,2,3]
>>> id = 2574
>>> header = mx.recordio.IRHeader(0, label, id, 0)
>>> with open(path, 'r') as file:
...     s = file.read()
>>> packed_s = mx.recordio.pack(header, s)

相關用法


注:本文由純淨天空篩選整理自apache.org大神的英文原創作品 mxnet.recordio.pack。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。