megengine.functional.nn.nvof

nvof(src, precision=1)[源代码]

NVIDIA光流SDK的实现

参数
  • src (Tensor) – input tensor with shape (n, t, h, w, c4) and unit8 dtype.

  • precision (int) – 0:NV_OF_PERF_LEVEL_SLOW 1:NV_OF_PERF_LEVEL_MEDIUM 2:NV_OF_PERF_LEVEL_FAST.

返回

(n, t-1, (h+out_grid_size-1)//out_grid_size, (w+out_grid_size-1)//out_grid_size, c2). By default, out_grid_size = 4. dtype: int16.

返回类型

output tensor with shape

import numpy as np
from megengine import tensor
import megengine.functional as F

x = np.random.random_integers(0, 255, (1,2,224,244,4)).astype("uint8")
src = tensor(x)
result = F.nn.nvof(src, precision=1)
print(result.numpy())