在 Swift 中保存/加载 NumPy 数组文件
let npy = try Npy(contentsOf: npyUrl)
let shape = npy.shape
let elements: [Float] = npy.elements()
let isFortranOrder = npy.isFortranOrder
try save(npy: npy, to: url)
let npz = try Npz(contentsOf: npzUrl)
let npy = npz["name-of-array"]
try npz.save(to: url)
npy
, npz
文件。
布尔型
UInt8
, UInt16
, UInt32
, UInt64
它们也可以作为 UInt
类型读取
Int8
, Int16
, Int32
, Int64
它们也可以作为 Int
类型读取
Float
, Double