替代tf.extract_image_patches(
large_img,
[1,args.times , args.times ,1],
[1, args.times,args.times,1],
[1,1,1,1],
padding='SAME')函数的mindspore 方法
用户你好,mindspore.nn.Unfold 算子可以替代 tf.extract_image_patches 算子。Unfold 算子目前仅支持 Ascend 和 GPU 平台。
参考资料: mindspore.nn.Unfold — MindSpore master 文档
示例代码:
import tensorflow.compat.v1 as tf
from mindspore.nn import Unfold
from mindspore import Tensor
import numpy as np
ksizes = strides = rates = [1, 2, 2, 1]
image = np.ones([2, 6, 6, 3]).astype('float32')
padding = "SA