// Unpublished image APIs; all data is local and deterministic.
import aner.image
import aner.tensor

let work = image.context(workers: 1, memory_mb: 32)
let samples: Tensor = [[0.0, 1.0, 2.0, 3.0],
    [4.0, 5.0, 6.0, 7.0], [8.0, 9.0, 10.0, 11.0]]
let pixels = image.from_tensor(work, samples, dtype: "UInt16", layout: "HW")
let view = pixels.crop(x: 1, y: 1, width: 2, height: 2)
let packed = view.copy()
print(pixels.dtype())
print(view.sample(0, 0))
print(view.contiguous())
print(packed.contiguous())
print(pixels.cast("Float64").stats().mean())
print(work.used_bytes())
print(work.peak_bytes())
