Torch and C FFI optimized L1 distance metric