cntk中如何使用卷积函数?

How to use convolution function in cntk?

我正在尝试使用 cntk.convolution 函数对两个常量数组进行卷积运算。

这是我的代码:

import cntk as C

w = C.constant(1, (2, 2))
a = C.constant(2, (2, 2))

c = C.convolution(w, a)

print(c.eval())

但是会导致下面的错误

RuntimeError: Convolution currently requires the main operand to have dynamic axes

我该如何使用convolution功能?
谢谢

我在卷积方法的文档字符串中找到了这个例子。

img = np.reshape(np.arange(25.0, dtype=np.float32), (1, 5, 5))
x = C.input_variable(img.shape)
filter = np.reshape(np.array([2, -1, -1, 2], dtype=np.float32), (1, 2, 2))
kernel = C.constant(value=filter)
out = np.round(C.convolution(kernel, x, auto_padding=[False]).eval({x: [img]}), 5)
print(out)