megengine.functional.vision.nvof

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

NVIDIA光流SDK的实现

输入的形状

输入张量,其形状为 (n, t, h, w, c4).

输入的数据类型

uint8.

参数

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.

输出的数据类型

int16.

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())
返回类型

Tensor