已合并
move m to npu_op to struct codegen #1782
wang-guangbin创建于 2024年8月10日
move m to npu_op to struct codegen #1782
已合并
wang-guangbin创建于 2024年8月10日
refs/pull/1782/head合入到master
40 个文件变更+477-1625
@@ -2683,18 +2683,32 @@ official:
2683 - func: max_unpool2d(Tensor self, Tensor indices, SymInt[2] output_size) -> Tensor2683 - func: max_unpool2d(Tensor self, Tensor indices, SymInt[2] output_size) -> Tensor
2684 acl_op: v2.1, v2.2, v2.3, v2.4, v2.52684 acl_op: v2.1, v2.2, v2.3, v2.4, v2.5
2685 op_api: v2.1, v2.2, v2.3, v2.4, v2.52685 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
2686+ gen_opapi:
2687+ structured_inherit: max_unpool2d.out
2686 2688 
2687 - func: max_unpool2d(Tensor self, Tensor indices, int[2] output_size) -> Tensor2689 - func: max_unpool2d(Tensor self, Tensor indices, int[2] output_size) -> Tensor
2688 acl_op: v1.11, v2.02690 acl_op: v1.11, v2.0
2689 op_api: v1.112691 op_api: v1.11
2692+ gen_opapi:
2693+ structured_inherit: max_unpool2d.out
2690 2694 
2691 - func: max_unpool2d.out(Tensor self, Tensor indices, SymInt[2] output_size, *, Tensor(a!) out) -> Tensor(a!)2695 - func: max_unpool2d.out(Tensor self, Tensor indices, SymInt[2] output_size, *, Tensor(a!) out) -> Tensor(a!)
2692 acl_op: v2.1, v2.2, v2.3, v2.4, v2.52696 acl_op: v2.1, v2.2, v2.3, v2.4, v2.5
2693 op_api: v2.1, v2.2, v2.3, v2.4, v2.52697 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
2698+ gen_opapi:
2699+ out:
2700+ size: max_pool2d_out_size(self, output_size)
2701+ dtype: self
2702+ exec: aclnnMaxUnpool2d
2694 2703 
2695 - func: max_unpool2d.out(Tensor self, Tensor indices, int[2] output_size, *, Tensor(a!) out) -> Tensor(a!)2704 - func: max_unpool2d.out(Tensor self, Tensor indices, int[2] output_size, *, Tensor(a!) out) -> Tensor(a!)
2696 acl_op: v1.11, v2.02705 acl_op: v1.11, v2.0
2697 op_api: v1.112706 op_api: v1.11
2707+ gen_opapi:
2708+ out:
2709+ size: max_pool2d_out_size(self, output_size)
2710+ dtype: self
2711+ exec: aclnnMaxUnpool2d
2698 2712 
2699 - func: max_unpool2d_backward(Tensor grad_output, Tensor self, Tensor indices, int[2] output_size) -> Tensor2713 - func: max_unpool2d_backward(Tensor grad_output, Tensor self, Tensor indices, int[2] output_size) -> Tensor
2700 acl_op: v1.11, v2.02714 acl_op: v1.11, v2.0
@@ -2707,18 +2721,32 @@ official:
2707 - func: max_unpool3d(Tensor self, Tensor indices, SymInt[3] output_size, int[3] stride, int[3] padding) -> Tensor2721 - func: max_unpool3d(Tensor self, Tensor indices, SymInt[3] output_size, int[3] stride, int[3] padding) -> Tensor
2708 acl_op: v2.1, v2.2, v2.3, v2.4, v2.52722 acl_op: v2.1, v2.2, v2.3, v2.4, v2.5
2709 op_api: v2.1, v2.2, v2.3, v2.4, v2.52723 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
2724+ gen_opapi:
2725+ structured_inherit: max_unpool3d.out
2710 2726 
2711 - func: max_unpool3d(Tensor self, Tensor indices, int[3] output_size, int[3] stride, int[3] padding) -> Tensor2727 - func: max_unpool3d(Tensor self, Tensor indices, int[3] output_size, int[3] stride, int[3] padding) -> Tensor
2712 acl_op: v1.11, v2.02728 acl_op: v1.11, v2.0
2713 op_api: v1.112729 op_api: v1.11
2730+ gen_opapi:
2731+ structured_inherit: max_unpool3d.out
2714 2732 
2715 - func: max_unpool3d.out(Tensor self, Tensor indices, SymInt[3] output_size, int[3] stride, int[3] padding, *, Tensor(a!) out) -> Tensor(a!)2733 - func: max_unpool3d.out(Tensor self, Tensor indices, SymInt[3] output_size, int[3] stride, int[3] padding, *, Tensor(a!) out) -> Tensor(a!)
2716 acl_op: v2.1, v2.2, v2.3, v2.4, v2.52734 acl_op: v2.1, v2.2, v2.3, v2.4, v2.5
2717 op_api: v2.1, v2.2, v2.3, v2.4, v2.52735 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
2736+ gen_opapi:
2737+ out:
2738+ size: max_pool3d_output_size(self, output_size)
2739+ dtype: self
2740+ exec: aclnnMaxUnpool3d
2718 2741 
2719 - func: max_unpool3d.out(Tensor self, Tensor indices, int[3] output_size, int[3] stride, int[3] padding, *, Tensor(a!) out) -> Tensor(a!)2742 - func: max_unpool3d.out(Tensor self, Tensor indices, int[3] output_size, int[3] stride, int[3] padding, *, Tensor(a!) out) -> Tensor(a!)
2720 acl_op: v1.11, v2.02743 acl_op: v1.11, v2.0
2721 op_api: v1.112744 op_api: v1.11
2745+ gen_opapi:
2746+ out:
2747+ size: max_pool3d_output_size(self, output_size)
2748+ dtype: self
2749+ exec: aclnnMaxUnpool3d
2722 2750 
2723 - func: max_unpool3d_backward(Tensor grad_output, Tensor self, Tensor indices, int[3] output_size, int[3] stride, int[3] padding) -> Tensor2751 - func: max_unpool3d_backward(Tensor grad_output, Tensor self, Tensor indices, int[3] output_size, int[3] stride, int[3] padding) -> Tensor
2724 acl_op: v1.11, v2.02752 acl_op: v1.11, v2.0
@@ -2739,10 +2767,17 @@ official:
2739 - func: max_pool2d_with_indices_backward(Tensor grad_output, Tensor self, int[2] kernel_size, int[2] stride, int[2] padding, int[2] dilation, bool ceil_mode, Tensor indices) -> Tensor2767 - func: max_pool2d_with_indices_backward(Tensor grad_output, Tensor self, int[2] kernel_size, int[2] stride, int[2] padding, int[2] dilation, bool ceil_mode, Tensor indices) -> Tensor
2740 acl_op: all_version2768 acl_op: all_version
2741 op_api: all_version2769 op_api: all_version
2770+ gen_opapi:
2771+ out:
2772+ size: self
2773+ dtype: self
2774+ exec: aclnnMaxPool2dWithMaskBackward, grad_output, self, indices, kernel_size, stride, padding, dilation, ceil_mode, out
2742 2775 
2743 - func: max_pool2d_with_indices_backward.grad_input(Tensor grad_output, Tensor self, int[2] kernel_size, int[2] stride, int[2] padding, int[2] dilation, bool ceil_mode, Tensor indices, *, Tensor(a!) grad_input) -> Tensor(a!)2776 - func: max_pool2d_with_indices_backward.grad_input(Tensor grad_output, Tensor self, int[2] kernel_size, int[2] stride, int[2] padding, int[2] dilation, bool ceil_mode, Tensor indices, *, Tensor(a!) grad_input) -> Tensor(a!)
2744 acl_op: all_version2777 acl_op: all_version
2745 op_api: all_version2778 op_api: all_version
2779+ gen_opapi:
2780+ exec: aclnnMaxPool2dWithMaskBackward, grad_output, self, indices, kernel_size, stride, padding, dilation, ceil_mode, grad_input
2746 2781 
2747 - func: max_pool3d_with_indices(Tensor self, int[3] kernel_size, int[3] stride=[], int[3] padding=0, int[3] dilation=1, bool ceil_mode=False) -> (Tensor, Tensor)2782 - func: max_pool3d_with_indices(Tensor self, int[3] kernel_size, int[3] stride=[], int[3] padding=0, int[3] dilation=1, bool ceil_mode=False) -> (Tensor, Tensor)
2748 acl_op: all_version2783 acl_op: all_version
@@ -2795,14 +2830,33 @@ official:
2795 - func: median(Tensor self) -> Tensor2830 - func: median(Tensor self) -> Tensor
2796 acl_op: all_version2831 acl_op: all_version
2797 op_api: all_version2832 op_api: all_version
2833+ gen_opapi:
2834+ out:
2835+ size: reduce_ops_npu_output_size(self, get_dimlist_for_tensor(self), false)
2836+ dtype: self
2837+ exec: aclnnMedian
2798 2838 
2799 - func: median.dim(Tensor self, int dim, bool keepdim=False) -> (Tensor values, Tensor indices)2839 - func: median.dim(Tensor self, int dim, bool keepdim=False) -> (Tensor values, Tensor indices)
2800 acl_op: all_version2840 acl_op: all_version
2801 op_api: all_version2841 op_api: all_version
2842+ gen_opapi:
2843+ values:
2844+ size: reduce_ops_npu_output_size(self, {dim}, keepdim)
2845+ dtype: self
2846+ indices:
2847+ size: reduce_ops_npu_output_size(self, {dim}, keepdim)
2848+ dtype: at::kLong
2849+ exec: aclnnMedianDim
2802 2850 
2803 - func: median.dim_values(Tensor self, int dim, bool keepdim=False, *, Tensor(a!) values, Tensor(b!) indices) -> (Tensor(a!) values, Tensor(b!) indices)2851 - func: median.dim_values(Tensor self, int dim, bool keepdim=False, *, Tensor(a!) values, Tensor(b!) indices) -> (Tensor(a!) values, Tensor(b!) indices)
2804 acl_op: all_version2852 acl_op: all_version
2805 op_api: all_version2853 op_api: all_version
2854+ gen_opapi:
2855+ values:
2856+ size: reduce_ops_npu_output_size(self, {dim}, keepdim)
2857+ indices:
2858+ size: reduce_ops_npu_output_size(self, {dim}, keepdim)
2859+ exec: aclnnMedianDim
2806 2860 
2807 - func: min(Tensor self) -> Tensor2861 - func: min(Tensor self) -> Tensor
2808 acl_op: all_version2862 acl_op: all_version
@@ -2831,10 +2885,19 @@ official:
2831 - func: minimum(Tensor self, Tensor other) -> Tensor2885 - func: minimum(Tensor self, Tensor other) -> Tensor
2832 acl_op: all_version2886 acl_op: all_version
2833 op_api: all_version2887 op_api: all_version
2888+ gen_opapi:
2889+ out:
2890+ size: broadcast_ops_npu_output_size(self, other)
2891+ dtype: at::result_type(self, other)
2892+ exec: aclnnMinimum
2834 2893 
2835 - func: minimum.out(Tensor self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)2894 - func: minimum.out(Tensor self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)
2836 acl_op: all_version2895 acl_op: all_version
2837 op_api: all_version2896 op_api: all_version
2897+ gen_opapi:
2898+ out:
2899+ size: broadcast_ops_npu_output_size(self, other)
2900+ exec: aclnnMinimum
2838 2901 
2839 - func: mish(Tensor self) -> Tensor2902 - func: mish(Tensor self) -> Tensor
2840 acl_op: all_version2903 acl_op: all_version
@@ -2851,6 +2914,11 @@ official:
2851 - func: mish_backward(Tensor grad_output, Tensor self) -> Tensor2914 - func: mish_backward(Tensor grad_output, Tensor self) -> Tensor
2852 acl_op: all_version2915 acl_op: all_version
2853 op_api: all_version2916 op_api: all_version
2917+ gen_opapi:
2918+ out:
2919+ size: broadcast_ops_npu_output_size(grad_output, self)
2920+ dtype: at::native::result_type(grad_output, self)
2921+ exec: aclnnMishBackward
2854 2922 
2855 - func: mm(Tensor self, Tensor mat2) -> Tensor2923 - func: mm(Tensor self, Tensor mat2) -> Tensor
2856 acl_op: all_version2924 acl_op: all_version
@@ -2871,10 +2939,19 @@ official:
2871 - func: mse_loss_backward(Tensor grad_output, Tensor self, Tensor target, int reduction) -> Tensor2939 - func: mse_loss_backward(Tensor grad_output, Tensor self, Tensor target, int reduction) -> Tensor
2872 acl_op: all_version2940 acl_op: all_version
2873 op_api: all_version2941 op_api: all_version
2942+ gen_opapi:
2943+ out:
2944+ size: broadcast_ops_npu_output_size(broadcast_ops_npu_output_size(grad_output, self), target.sizes())
2945+ dtype: self
2946+ exec: aclnnMseLossBackward
2874 2947 
2875 - func: mse_loss_backward.grad_input(Tensor grad_output, Tensor self, Tensor target, int reduction, *, Tensor(a!) grad_input) -> Tensor(a!)2948 - func: mse_loss_backward.grad_input(Tensor grad_output, Tensor self, Tensor target, int reduction, *, Tensor(a!) grad_input) -> Tensor(a!)
2876 acl_op: all_version2949 acl_op: all_version
2877 op_api: all_version2950 op_api: all_version
2951+ gen_opapi:
2952+ grad_input:
2953+ size: broadcast_ops_npu_output_size(broadcast_ops_npu_output_size(grad_output, self), target.sizes())
2954+ exec: aclnnMseLossBackward
2878 2955 
2879 - func: mul.Scalar(Tensor self, Scalar other) -> Tensor2956 - func: mul.Scalar(Tensor self, Scalar other) -> Tensor
2880 acl_op: all_version2957 acl_op: all_version
@@ -2943,10 +3020,23 @@ official:
2943 - func: nanmedian(Tensor self) -> Tensor3020 - func: nanmedian(Tensor self) -> Tensor
2944 acl_op: all_version3021 acl_op: all_version
2945 op_api: all_version3022 op_api: all_version
3023+ gen_opapi:
3024+ out:
3025+ size: reduce_ops_npu_output_size(self, get_dimlist_for_tensor(self), false)
3026+ dtype: self
3027+ exec: aclnnNanMedian
2946 3028 
2947 - func: nanmedian.dim(Tensor self, int dim, bool keepdim=False) -> (Tensor values, Tensor indices)3029 - func: nanmedian.dim(Tensor self, int dim, bool keepdim=False) -> (Tensor values, Tensor indices)
2948 acl_op: all_version3030 acl_op: all_version
2949 op_api: all_version3031 op_api: all_version
3032+ gen_opapi:
3033+ output:
3034+ size: reduce_ops_npu_output_size(self, dim, keepdim)
3035+ dtype: self
3036+ indices:
3037+ size: reduce_ops_npu_output_size(self, dim, keepdim)
3038+ dtype: at::kLong
3039+ exec: aclnnNanMedianDim
2950 3040 
2951 - func: nansum(Tensor self, *, ScalarType? dtype=None) -> Tensor3041 - func: nansum(Tensor self, *, ScalarType? dtype=None) -> Tensor
2952 op_api: v1.113042 op_api: v1.11
@@ -2966,10 +3056,23 @@ official:
2966 - func: native_batch_norm(Tensor input, Tensor? weight, Tensor? bias, Tensor? running_mean, Tensor? running_var, bool training, float momentum, float eps) -> (Tensor, Tensor, Tensor)3056 - func: native_batch_norm(Tensor input, Tensor? weight, Tensor? bias, Tensor? running_mean, Tensor? running_var, bool training, float momentum, float eps) -> (Tensor, Tensor, Tensor)
2967 acl_op: all_version3057 acl_op: all_version
2968 op_api: all_version3058 op_api: all_version
3059+ gen_opapi:
3060+ out0:
3061+ size: input
3062+ dtype: input
3063+ out1:
3064+ size: 'training? c10::SmallVector<int64_t, op_infer::SIZE>{input.size(1)}: c10::SmallVector<int64_t, op_infer::SIZE>{0}'
3065+ dtype: 'training? at::kFloat: input.scalar_type()'
3066+ out2:
3067+ size: 'training? c10::SmallVector<int64_t, op_infer::SIZE>{input.size(1)}: c10::SmallVector<int64_t, op_infer::SIZE>{0}'
3068+ dtype: 'training? at::kFloat: input.scalar_type()'
3069+ exec: aclnnBatchNorm
2969 3070 
2970 - func: native_batch_norm.out(Tensor input, Tensor? weight, Tensor? bias, Tensor? running_mean, Tensor? running_var, bool training, float momentum, float eps, *, Tensor(a!) out, Tensor(b!) save_mean, Tensor(c!) save_invstd) -> (Tensor(a!), Tensor(b!), Tensor(c!))3071 - func: native_batch_norm.out(Tensor input, Tensor? weight, Tensor? bias, Tensor? running_mean, Tensor? running_var, bool training, float momentum, float eps, *, Tensor(a!) out, Tensor(b!) save_mean, Tensor(c!) save_invstd) -> (Tensor(a!), Tensor(b!), Tensor(c!))
2971 acl_op: all_version3072 acl_op: all_version
2972 op_api: all_version3073 op_api: all_version
3074+ gen_opapi:
3075+ exec: aclnnBatchNorm
2973 3076 
2974 - func: native_batch_norm_backward(Tensor grad_out, Tensor input, Tensor? weight, Tensor? running_mean, Tensor? running_var, Tensor? save_mean, Tensor? save_invstd, bool train, float eps, bool[3] output_mask) -> (Tensor, Tensor, Tensor)3077 - func: native_batch_norm_backward(Tensor grad_out, Tensor input, Tensor? weight, Tensor? running_mean, Tensor? running_var, Tensor? save_mean, Tensor? save_invstd, bool train, float eps, bool[3] output_mask) -> (Tensor, Tensor, Tensor)
2975 acl_op: all_version3078 acl_op: all_version
@@ -2986,6 +3089,17 @@ official:
2986 - func: native_group_norm(Tensor input, Tensor? weight, Tensor? bias, int N, int C, int HxW, int group, float eps) -> (Tensor, Tensor, Tensor)3089 - func: native_group_norm(Tensor input, Tensor? weight, Tensor? bias, int N, int C, int HxW, int group, float eps) -> (Tensor, Tensor, Tensor)
2987 acl_op: all_version3090 acl_op: all_version
2988 op_api: all_version3091 op_api: all_version
3092+ gen_opapi:
3093+ out0:
3094+ size: input
3095+ dtype: input
3096+ out1:
3097+ size: '{N, group}'
3098+ dtype: input
3099+ out2:
3100+ size: '{N, group}'
3101+ dtype: input
3102+ exec: aclnnGroupNorm
2989 3103 
2990 - func: native_group_norm_backward(Tensor grad_out, Tensor input, Tensor mean, Tensor rstd, Tensor? weight, int N, int C, int HxW, int group, bool[3] output_mask) -> (Tensor, Tensor, Tensor)3104 - func: native_group_norm_backward(Tensor grad_out, Tensor input, Tensor mean, Tensor rstd, Tensor? weight, int N, int C, int HxW, int group, bool[3] output_mask) -> (Tensor, Tensor, Tensor)
2991 acl_op: all_version3105 acl_op: all_version
@@ -3034,14 +3148,23 @@ official:
3034 - func: neg(Tensor self) -> Tensor3148 - func: neg(Tensor self) -> Tensor
3035 acl_op: all_version3149 acl_op: all_version
3036 op_api: all_version3150 op_api: all_version
3151+ gen_opapi:
3152+ structured_inherit: neg.out
3037 3153 
3038 - func: neg.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)3154 - func: neg.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
3039 acl_op: all_version3155 acl_op: all_version
3040 op_api: all_version3156 op_api: all_version
3157+ gen_opapi:
3158+ out:
3159+ size: self
3160+ dtype: self
3161+ exec: aclnnNeg
3041 3162 
3042 - func: neg_(Tensor(a!) self) -> Tensor(a!)3163 - func: neg_(Tensor(a!) self) -> Tensor(a!)
3043 acl_op: all_version3164 acl_op: all_version
3044 op_api: all_version3165 op_api: all_version
3166+ gen_opapi:
3167+ structured_inherit: neg.out
3045 3168 
3046 - func: nll_loss(Tensor self, Tensor target, Tensor? weight=None, int reduction=Mean, SymInt ignore_index=-100) -> Tensor3169 - func: nll_loss(Tensor self, Tensor target, Tensor? weight=None, int reduction=Mean, SymInt ignore_index=-100) -> Tensor
3047 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53170 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
@@ -3242,34 +3365,63 @@ official:
3242 - func: pow.Scalar(Scalar self, Tensor exponent) -> Tensor3365 - func: pow.Scalar(Scalar self, Tensor exponent) -> Tensor
3243 acl_op: all_version3366 acl_op: all_version
3244 op_api: all_version3367 op_api: all_version
3368+ gen_opapi:
3369+ out:
3370+ size: exponent
3371+ dtype: at::result_type(self, exponent)
3372+ exec: aclnnPowScalarTensor
3245 3373 
3246 - func: pow.Scalar_out(Scalar self, Tensor exponent, *, Tensor(a!) out) -> Tensor(a!)3374 - func: pow.Scalar_out(Scalar self, Tensor exponent, *, Tensor(a!) out) -> Tensor(a!)
3247 acl_op: all_version3375 acl_op: all_version
3248 op_api: all_version3376 op_api: all_version
3377+ gen_opapi:
3378+ out:
3379+ size: exponent
3380+ exec: aclnnPowScalarTensor
3249 3381 
3250 - func: pow.Tensor_Scalar(Tensor self, Scalar exponent) -> Tensor3382 - func: pow.Tensor_Scalar(Tensor self, Scalar exponent) -> Tensor
3251 acl_op: all_version3383 acl_op: all_version
3252 op_api: all_version3384 op_api: all_version
3385+ gen_opapi:
3386+ structured_inherit: pow.Tensor_Scalar_out
3253 3387 
3254 - func: pow.Tensor_Scalar_out(Tensor self, Scalar exponent, *, Tensor(a!) out) -> Tensor(a!)3388 - func: pow.Tensor_Scalar_out(Tensor self, Scalar exponent, *, Tensor(a!) out) -> Tensor(a!)
3255 acl_op: all_version3389 acl_op: all_version
3256 op_api: all_version3390 op_api: all_version
3391+ gen_opapi:
3392+ out:
3393+ size: self
3394+ dtype: at::result_type(self, exponent)
3395+ exec: aclnnPowTensorScalar
3257 3396 
3258 - func: pow.Tensor_Tensor(Tensor self, Tensor exponent) -> Tensor3397 - func: pow.Tensor_Tensor(Tensor self, Tensor exponent) -> Tensor
3259 acl_op: all_version3398 acl_op: all_version
3260 op_api: all_version3399 op_api: all_version
3400+ gen_opapi:
3401+ out:
3402+ size: broadcast_ops_npu_output_size(self, exponent)
3403+ dtype: at::result_type(self, exponent)
3404+ exec: aclnnPowTensorTensor
3261 3405 
3262 - func: pow.Tensor_Tensor_out(Tensor self, Tensor exponent, *, Tensor(a!) out) -> Tensor(a!)3406 - func: pow.Tensor_Tensor_out(Tensor self, Tensor exponent, *, Tensor(a!) out) -> Tensor(a!)
3263 acl_op: all_version3407 acl_op: all_version
3264 op_api: all_version3408 op_api: all_version
3409+ gen_opapi:
3410+ out:
3411+ size: broadcast_ops_npu_output_size(self, exponent)
3412+ exec: aclnnPowTensorTensor
3265 3413 
3266 - func: pow_.Scalar(Tensor(a!) self, Scalar exponent) -> Tensor(a!)3414 - func: pow_.Scalar(Tensor(a!) self, Scalar exponent) -> Tensor(a!)
3267 acl_op: all_version3415 acl_op: all_version
3268 op_api: all_version3416 op_api: all_version
3417+ gen_opapi:
3418+ exec: aclnnInplacePowTensorScalar
3269 3419 
3270 - func: pow_.Tensor(Tensor(a!) self, Tensor exponent) -> Tensor(a!)3420 - func: pow_.Tensor(Tensor(a!) self, Tensor exponent) -> Tensor(a!)
3271 acl_op: all_version3421 acl_op: all_version
3272 op_api: all_version3422 op_api: all_version
3423+ gen_opapi:
3424+ exec: aclnnInplacePowTensorTensor
3273 3425 
3274 - func: polar(Tensor abs, Tensor angle) -> Tensor3426 - func: polar(Tensor abs, Tensor angle) -> Tensor
3275 op_api: v2.1, v2.2, v2.3, v2.4, v2.53427 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
@@ -3366,114 +3518,216 @@ official:
3366 - func: reciprocal(Tensor self) -> Tensor3518 - func: reciprocal(Tensor self) -> Tensor
3367 acl_op: all_version3519 acl_op: all_version
3368 op_api: all_version3520 op_api: all_version
3521+ gen_opapi:
3522+ out:
3523+ size: self
3524+ dtype: 'isIntegralType(self.scalar_type(), true) ? at::kFloat : self.scalar_type()'
3525+ exec: aclnnReciprocal
3369 3526 
3370 - func: reciprocal.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)3527 - func: reciprocal.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
3371 acl_op: all_version3528 acl_op: all_version
3372 op_api: all_version3529 op_api: all_version
3530+ gen_opapi:
3531+ out:
3532+ size: self
3533+ exec: aclnnReciprocal
3373 3534 
3374 - func: reciprocal_(Tensor(a!) self) -> Tensor(a!)3535 - func: reciprocal_(Tensor(a!) self) -> Tensor(a!)
3375 acl_op: all_version3536 acl_op: all_version
3376 op_api: all_version3537 op_api: all_version
3538+ gen_opapi:
3539+ exec: aclnnInplaceReciprocal
3377 3540 
3378 - func: reflection_pad1d(Tensor self, SymInt[2] padding) -> Tensor3541 - func: reflection_pad1d(Tensor self, SymInt[2] padding) -> Tensor
3379 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53542 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3380 op_api: v2.1, v2.2, v2.3, v2.4, v2.53543 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
3544+ gen_opapi:
3545+ structured_inherit: reflection_pad1d.out
3381 3546 
3382 - func: reflection_pad1d(Tensor self, int[2] padding) -> Tensor3547 - func: reflection_pad1d(Tensor self, int[2] padding) -> Tensor
3383 acl_op: v1.113548 acl_op: v1.11
3384 op_api: v1.113549 op_api: v1.11
3550+ gen_opapi:
3551+ structured_inherit: reflection_pad1d.out
3385 3552 
3386 - func: reflection_pad1d.out(Tensor self, SymInt[2] padding, *, Tensor(a!) out) -> Tensor(a!)3553 - func: reflection_pad1d.out(Tensor self, SymInt[2] padding, *, Tensor(a!) out) -> Tensor(a!)
3387 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53554 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3388 op_api: v2.1, v2.2, v2.3, v2.4, v2.53555 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
3556+ gen_opapi:
3557+ out:
3558+ size: reflection_pad1d_npu_out_size(self, padding)
3559+ dtype: self
3560+ exec: aclnnReflectionPad1d
3389 3561 
3390 - func: reflection_pad1d.out(Tensor self, int[2] padding, *, Tensor(a!) out) -> Tensor(a!)3562 - func: reflection_pad1d.out(Tensor self, int[2] padding, *, Tensor(a!) out) -> Tensor(a!)
3391 acl_op: v1.113563 acl_op: v1.11
3392 op_api: v1.113564 op_api: v1.11
3565+ gen_opapi:
3566+ out:
3567+ size: reflection_pad1d_npu_out_size(self, padding)
3568+ dtype: self
3569+ exec: aclnnReflectionPad1d
3393 3570 
3394 - func: reflection_pad1d_backward(Tensor grad_output, Tensor self, SymInt[2] padding) -> Tensor3571 - func: reflection_pad1d_backward(Tensor grad_output, Tensor self, SymInt[2] padding) -> Tensor
3395 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53572 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3396 op_api: v2.1, v2.2, v2.3, v2.4, v2.53573 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
3574+ gen_opapi:
3575+ structured_inherit: reflection_pad1d_backward.grad_input
3397 3576 
3398 - func: reflection_pad1d_backward(Tensor grad_output, Tensor self, int[2] padding) -> Tensor3577 - func: reflection_pad1d_backward(Tensor grad_output, Tensor self, int[2] padding) -> Tensor
3399 acl_op: v1.113578 acl_op: v1.11
3400 op_api: v1.113579 op_api: v1.11
3580+ gen_opapi:
3581+ structured_inherit: reflection_pad1d_backward.grad_input
3401 3582 
3402 - func: reflection_pad1d_backward.grad_input(Tensor grad_output, Tensor self, SymInt[2] padding, *, Tensor(a!) grad_input) -> Tensor(a!)3583 - func: reflection_pad1d_backward.grad_input(Tensor grad_output, Tensor self, SymInt[2] padding, *, Tensor(a!) grad_input) -> Tensor(a!)
3403 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53584 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3404 op_api: v2.1, v2.2, v2.3, v2.4, v2.53585 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
3586+ gen_opapi:
3587+ grad_input:
3588+ size: self
3589+ dtype: self
3590+ exec: aclnnReflectionPad1dBackward
3405 3591 
3406 - func: reflection_pad1d_backward.grad_input(Tensor grad_output, Tensor self, int[2] padding, *, Tensor(a!) grad_input) -> Tensor(a!)3592 - func: reflection_pad1d_backward.grad_input(Tensor grad_output, Tensor self, int[2] padding, *, Tensor(a!) grad_input) -> Tensor(a!)
3407 acl_op: v1.113593 acl_op: v1.11
3408 op_api: v1.113594 op_api: v1.11
3595+ gen_opapi:
3596+ grad_input:
3597+ size: self
3598+ dtype: self
3599+ exec: aclnnReflectionPad1dBackward
3409 3600 
3410 - func: reflection_pad2d(Tensor self, SymInt[4] padding) -> Tensor3601 - func: reflection_pad2d(Tensor self, SymInt[4] padding) -> Tensor
3411 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53602 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3412 op_api: v2.1, v2.2, v2.3, v2.4, v2.53603 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
3604+ gen_opapi:
3605+ structured_inherit: reflection_pad2d.out
3413 3606 
3414 - func: reflection_pad2d(Tensor self, int[4] padding) -> Tensor3607 - func: reflection_pad2d(Tensor self, int[4] padding) -> Tensor
3415 acl_op: v1.113608 acl_op: v1.11
3416 op_api: v1.113609 op_api: v1.11
3610+ gen_opapi:
3611+ structured_inherit: reflection_pad2d.out
3417 3612 
3418 - func: reflection_pad2d.out(Tensor self, SymInt[4] padding, *, Tensor(a!) out) -> Tensor(a!)3613 - func: reflection_pad2d.out(Tensor self, SymInt[4] padding, *, Tensor(a!) out) -> Tensor(a!)
3419 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53614 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3420 op_api: v2.1, v2.2, v2.3, v2.4, v2.53615 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
3616+ gen_opapi:
3617+ out:
3618+ size: reflection_pad2d_npu_out_size(self, padding)
3619+ dtype: self
3620+ exec: aclnnReflectionPad2d
3421 3621 
3422 - func: reflection_pad2d.out(Tensor self, int[4] padding, *, Tensor(a!) out) -> Tensor(a!)3622 - func: reflection_pad2d.out(Tensor self, int[4] padding, *, Tensor(a!) out) -> Tensor(a!)
3423 acl_op: v1.113623 acl_op: v1.11
3424 op_api: v1.113624 op_api: v1.11
3625+ gen_opapi:
3626+ out:
3627+ size: reflection_pad2d_npu_out_size(self, padding)
3628+ dtype: self
3629+ exec: aclnnReflectionPad2d
3425 3630 
3426 - func: reflection_pad2d_backward(Tensor grad_output, Tensor self, SymInt[4] padding) -> Tensor3631 - func: reflection_pad2d_backward(Tensor grad_output, Tensor self, SymInt[4] padding) -> Tensor
3427 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53632 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3428 op_api: v2.1, v2.2, v2.3, v2.4, v2.53633 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
3634+ gen_opapi:
3635+ structured_inherit: reflection_pad2d_backward.grad_input
3429 3636 
3430 - func: reflection_pad2d_backward(Tensor grad_output, Tensor self, int[4] padding) -> Tensor3637 - func: reflection_pad2d_backward(Tensor grad_output, Tensor self, int[4] padding) -> Tensor
3431 acl_op: v1.113638 acl_op: v1.11
3432 op_api: v1.113639 op_api: v1.11
3640+ gen_opapi:
3641+ structured_inherit: reflection_pad2d_backward.grad_input
3433 3642 
3434 - func: reflection_pad2d_backward.grad_input(Tensor grad_output, Tensor self, SymInt[4] padding, *, Tensor(a!) grad_input) -> Tensor(a!)3643 - func: reflection_pad2d_backward.grad_input(Tensor grad_output, Tensor self, SymInt[4] padding, *, Tensor(a!) grad_input) -> Tensor(a!)
3435 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53644 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3436 op_api: v2.1, v2.2, v2.3, v2.4, v2.53645 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
3646+ gen_opapi:
3647+ grad_input:
3648+ size: self
3649+ dtype: self
3650+ exec: aclnnReflectionPad2dBackward
3437 3651 
3438 - func: reflection_pad2d_backward.grad_input(Tensor grad_output, Tensor self, int[4] padding, *, Tensor(a!) grad_input) -> Tensor(a!)3652 - func: reflection_pad2d_backward.grad_input(Tensor grad_output, Tensor self, int[4] padding, *, Tensor(a!) grad_input) -> Tensor(a!)
3439 acl_op: v1.113653 acl_op: v1.11
3440 op_api: v1.113654 op_api: v1.11
3655+ gen_opapi:
3656+ grad_input:
3657+ size: self
3658+ dtype: self
3659+ exec: aclnnReflectionPad2dBackward
3441 3660 
3442 - func: reflection_pad3d(Tensor self, SymInt[6] padding) -> Tensor3661 - func: reflection_pad3d(Tensor self, SymInt[6] padding) -> Tensor
3443 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53662 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3444 op_api: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53663 op_api: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3664+ gen_opapi:
3665+ structured_inherit: reflection_pad3d.out
3445 3666 
3446 - func: reflection_pad3d(Tensor self, int[6] padding) -> Tensor3667 - func: reflection_pad3d(Tensor self, int[6] padding) -> Tensor
3447 acl_op: v1.113668 acl_op: v1.11
3448 op_api: v1.113669 op_api: v1.11
3670+ gen_opapi:
3671+ structured_inherit: reflection_pad3d.out
3449 3672 
3450 - func: reflection_pad3d.out(Tensor self, SymInt[6] padding, *, Tensor(a!) out) -> Tensor(a!)3673 - func: reflection_pad3d.out(Tensor self, SymInt[6] padding, *, Tensor(a!) out) -> Tensor(a!)
3451 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53674 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3452 op_api: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53675 op_api: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3676+ gen_opapi:
3677+ out:
3678+ size: reflection_pad3d_npu_out_size(self, padding)
3679+ dtype: self
3680+ exec: aclnnReflectionPad3d
3453 3681 
3454 - func: reflection_pad3d.out(Tensor self, int[6] padding, *, Tensor(a!) out) -> Tensor(a!)3682 - func: reflection_pad3d.out(Tensor self, int[6] padding, *, Tensor(a!) out) -> Tensor(a!)
3455 acl_op: v1.113683 acl_op: v1.11
3456 op_api: v1.113684 op_api: v1.11
3685+ gen_opapi:
3686+ out:
3687+ size: reflection_pad3d_npu_out_size(self, padding)
3688+ dtype: self
3689+ exec: aclnnReflectionPad3d
3457 3690 
3458 - func: reflection_pad3d_backward(Tensor grad_output, Tensor self, SymInt[6] padding) -> Tensor3691 - func: reflection_pad3d_backward(Tensor grad_output, Tensor self, SymInt[6] padding) -> Tensor
3459 op_api: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53692 op_api: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3693+ gen_opapi:
3694+ structured_inherit: reflection_pad3d_backward.grad_input
3460 3695 
3461 - func: reflection_pad3d_backward(Tensor grad_output, Tensor self, int[6] padding) -> Tensor3696 - func: reflection_pad3d_backward(Tensor grad_output, Tensor self, int[6] padding) -> Tensor
3462 op_api: v1.113697 op_api: v1.11
3698+ gen_opapi:
3699+ structured_inherit: reflection_pad3d_backward.grad_input
3463 3700 
3464 - func: reflection_pad3d_backward.grad_input(Tensor grad_output, Tensor self, SymInt[6] padding, *, Tensor(a!) grad_input) -> Tensor(a!)3701 - func: reflection_pad3d_backward.grad_input(Tensor grad_output, Tensor self, SymInt[6] padding, *, Tensor(a!) grad_input) -> Tensor(a!)
3465 op_api: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53702 op_api: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3703+ gen_opapi:
3704+ grad_input:
3705+ size: self
3706+ dtype: self
3707+ exec: aclnnReflectionPad3dBackward
3466 3708 
3467 - func: reflection_pad3d_backward.grad_input(Tensor grad_output, Tensor self, int[6] padding, *, Tensor(a!) grad_input) -> Tensor(a!)3709 - func: reflection_pad3d_backward.grad_input(Tensor grad_output, Tensor self, int[6] padding, *, Tensor(a!) grad_input) -> Tensor(a!)
3468 op_api: v1.113710 op_api: v1.11
3711+ gen_opapi:
3712+ grad_input:
3713+ size: self
3714+ dtype: self
3715+ exec: aclnnReflectionPad3dBackward
3469 3716 
3470 - func: relu(Tensor self) -> Tensor3717 - func: relu(Tensor self) -> Tensor
3471 acl_op: all_version3718 acl_op: all_version
3472 op_api: all_version3719 op_api: all_version
3720+ gen_opapi:
3721+ out:
3722+ size: self
3723+ dtype: self
3724+ exec: aclnnRelu
3473 3725 
3474 - func: relu_(Tensor(a!) self) -> Tensor(a!)3726 - func: relu_(Tensor(a!) self) -> Tensor(a!)
3475 acl_op: all_version3727 acl_op: all_version
3476 op_api: all_version3728 op_api: all_version
3729+ gen_opapi:
3730+ exec: aclnnInplaceRelu
3477 3731 
3478 - func: remainder.Scalar(Tensor self, Scalar other) -> Tensor3732 - func: remainder.Scalar(Tensor self, Scalar other) -> Tensor
3479 acl_op: all_version3733 acl_op: all_version
@@ -3518,10 +3772,20 @@ official:
3518 - func: repeat(Tensor self, SymInt[] repeats) -> Tensor3772 - func: repeat(Tensor self, SymInt[] repeats) -> Tensor
3519 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53773 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3520 op_api: v2.1, v2.2, v2.3, v2.4, v2.53774 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
3775+ gen_opapi:
3776+ out:
3777+ size: repeat_npu_output_size(self, repeats)
3778+ dtype: self
3779+ exec: aclnnRepeat
3521 3780 
3522 - func: repeat(Tensor self, int[] repeats) -> Tensor3781 - func: repeat(Tensor self, int[] repeats) -> Tensor
3523 acl_op: v1.113782 acl_op: v1.11
3524 op_api: v1.113783 op_api: v1.11
3784+ gen_opapi:
3785+ out:
3786+ size: repeat_npu_output_size(self, repeats)
3787+ dtype: self
3788+ exec: aclnnRepeat
3525 3789 
3526 - func: repeat_interleave.self_Tensor(Tensor self, Tensor repeats, int? dim=None, *, SymInt? output_size=None) -> Tensor3790 - func: repeat_interleave.self_Tensor(Tensor self, Tensor repeats, int? dim=None, *, SymInt? output_size=None) -> Tensor
3527 acl_op: v2.2, v2.3, v2.4, v2.53791 acl_op: v2.2, v2.3, v2.4, v2.5
@@ -3546,106 +3810,202 @@ official:
3546 - func: replication_pad1d(Tensor self, SymInt[2] padding) -> Tensor3810 - func: replication_pad1d(Tensor self, SymInt[2] padding) -> Tensor
3547 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53811 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3548 op_api: v2.1, v2.2, v2.3, v2.4, v2.53812 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
3813+ gen_opapi:
3814+ structured_inherit: replication_pad1d.out
3549 3815 
3550 - func: replication_pad1d(Tensor self, int[2] padding) -> Tensor3816 - func: replication_pad1d(Tensor self, int[2] padding) -> Tensor
3551 acl_op: v1.113817 acl_op: v1.11
3552 op_api: v1.113818 op_api: v1.11
3819+ gen_opapi:
3820+ structured_inherit: replication_pad1d.out
3553 3821 
3554 - func: replication_pad1d.out(Tensor self, SymInt[2] padding, *, Tensor(a!) out) -> Tensor(a!)3822 - func: replication_pad1d.out(Tensor self, SymInt[2] padding, *, Tensor(a!) out) -> Tensor(a!)
3555 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53823 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3556 op_api: v2.1, v2.2, v2.3, v2.4, v2.53824 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
3825+ gen_opapi:
3826+ out:
3827+ size: replication_pad1d_npu_out_size(self, padding)
3828+ dtype: self
3829+ exec: aclnnReplicationPad1d
3557 3830 
3558 - func: replication_pad1d.out(Tensor self, int[2] padding, *, Tensor(a!) out) -> Tensor(a!)3831 - func: replication_pad1d.out(Tensor self, int[2] padding, *, Tensor(a!) out) -> Tensor(a!)
3559 acl_op: v1.113832 acl_op: v1.11
3560 op_api: v1.113833 op_api: v1.11
3834+ gen_opapi:
3835+ out:
3836+ size: replication_pad1d_npu_out_size(self, padding)
3837+ dtype: self
3838+ exec: aclnnReplicationPad1d
3561 3839 
3562 - func: replication_pad1d_backward(Tensor grad_output, Tensor self, SymInt[2] padding) -> Tensor3840 - func: replication_pad1d_backward(Tensor grad_output, Tensor self, SymInt[2] padding) -> Tensor
3563 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53841 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3564 op_api: v2.1, v2.2, v2.3, v2.4, v2.53842 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
3843+ gen_opapi:
3844+ structured_inherit: replication_pad1d_backward.grad_input
3565 3845 
3566 - func: replication_pad1d_backward(Tensor grad_output, Tensor self, int[2] padding) -> Tensor3846 - func: replication_pad1d_backward(Tensor grad_output, Tensor self, int[2] padding) -> Tensor
3567 acl_op: v1.113847 acl_op: v1.11
3568 op_api: v1.113848 op_api: v1.11
3849+ gen_opapi:
3850+ structured_inherit: replication_pad1d_backward.grad_input
3569 3851 
3570 - func: replication_pad1d_backward.grad_input(Tensor grad_output, Tensor self, SymInt[2] padding, *, Tensor(a!) grad_input) -> Tensor(a!)3852 - func: replication_pad1d_backward.grad_input(Tensor grad_output, Tensor self, SymInt[2] padding, *, Tensor(a!) grad_input) -> Tensor(a!)
3571 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53853 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3572 op_api: v2.1, v2.2, v2.3, v2.4, v2.53854 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
3855+ gen_opapi:
3856+ grad_input:
3857+ size: self
3858+ dtype: self
3859+ exec: aclnnReplicationPad1dBackward
3573 3860 
3574 - func: replication_pad1d_backward.grad_input(Tensor grad_output, Tensor self, int[2] padding, *, Tensor(a!) grad_input) -> Tensor(a!)3861 - func: replication_pad1d_backward.grad_input(Tensor grad_output, Tensor self, int[2] padding, *, Tensor(a!) grad_input) -> Tensor(a!)
3575 acl_op: v1.113862 acl_op: v1.11
3576 op_api: v1.113863 op_api: v1.11
3864+ gen_opapi:
3865+ grad_input:
3866+ size: self
3867+ dtype: self
3868+ exec: aclnnReplicationPad1dBackward
3577 3869 
3578 - func: replication_pad2d(Tensor self, SymInt[4] padding) -> Tensor3870 - func: replication_pad2d(Tensor self, SymInt[4] padding) -> Tensor
3579 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53871 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3580 op_api: v2.1, v2.2, v2.3, v2.4, v2.53872 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
3873+ gen_opapi:
3874+ structured_inherit: replication_pad2d.out
3581 3875 
3582 - func: replication_pad2d(Tensor self, int[4] padding) -> Tensor3876 - func: replication_pad2d(Tensor self, int[4] padding) -> Tensor
3583 acl_op: v1.113877 acl_op: v1.11
3584 op_api: v1.113878 op_api: v1.11
3879+ gen_opapi:
3880+ structured_inherit: replication_pad2d.out
3585 3881 
3586 - func: replication_pad2d.out(Tensor self, SymInt[4] padding, *, Tensor(a!) out) -> Tensor(a!)3882 - func: replication_pad2d.out(Tensor self, SymInt[4] padding, *, Tensor(a!) out) -> Tensor(a!)
3587 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53883 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3588 op_api: v2.1, v2.2, v2.3, v2.4, v2.53884 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
3885+ gen_opapi:
3886+ out:
3887+ size: replication_pad2d_npu_out_size(self, padding)
3888+ dtype: self
3889+ exec: aclnnReplicationPad2d
3589 3890 
3590 - func: replication_pad2d.out(Tensor self, int[4] padding, *, Tensor(a!) out) -> Tensor(a!)3891 - func: replication_pad2d.out(Tensor self, int[4] padding, *, Tensor(a!) out) -> Tensor(a!)
3591 acl_op: v1.113892 acl_op: v1.11
3592 op_api: v1.113893 op_api: v1.11
3894+ gen_opapi:
3895+ out:
3896+ size: replication_pad2d_npu_out_size(self, padding)
3897+ dtype: self
3898+ exec: aclnnReplicationPad2d
3593 3899 
3594 - func: replication_pad2d_backward(Tensor grad_output, Tensor self, SymInt[4] padding) -> Tensor3900 - func: replication_pad2d_backward(Tensor grad_output, Tensor self, SymInt[4] padding) -> Tensor
3595 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53901 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3596 op_api: v2.1, v2.2, v2.3, v2.4, v2.53902 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
3903+ gen_opapi:
3904+ structured_inherit: replication_pad2d_backward.grad_input
3597 3905 
3598 - func: replication_pad2d_backward(Tensor grad_output, Tensor self, int[4] padding) -> Tensor3906 - func: replication_pad2d_backward(Tensor grad_output, Tensor self, int[4] padding) -> Tensor
3599 acl_op: v1.113907 acl_op: v1.11
3600 op_api: v1.113908 op_api: v1.11
3909+ gen_opapi:
3910+ structured_inherit: replication_pad2d_backward.grad_input
3601 3911 
3602 - func: replication_pad2d_backward.grad_input(Tensor grad_output, Tensor self, SymInt[4] padding, *, Tensor(a!) grad_input) -> Tensor(a!)3912 - func: replication_pad2d_backward.grad_input(Tensor grad_output, Tensor self, SymInt[4] padding, *, Tensor(a!) grad_input) -> Tensor(a!)
3603 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53913 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3604 op_api: v2.1, v2.2, v2.3, v2.4, v2.53914 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
3915+ gen_opapi:
3916+ grad_input:
3917+ size: self
3918+ dtype: self
3919+ exec: aclnnReplicationPad2dBackward
3605 3920 
3606 - func: replication_pad2d_backward.grad_input(Tensor grad_output, Tensor self, int[4] padding, *, Tensor(a!) grad_input) -> Tensor(a!)3921 - func: replication_pad2d_backward.grad_input(Tensor grad_output, Tensor self, int[4] padding, *, Tensor(a!) grad_input) -> Tensor(a!)
3607 acl_op: v1.113922 acl_op: v1.11
3608 op_api: v1.113923 op_api: v1.11
3924+ gen_opapi:
3925+ grad_input:
3926+ size: self
3927+ dtype: self
3928+ exec: aclnnReplicationPad2dBackward
3609 3929 
3610 - func: replication_pad3d(Tensor self, SymInt[6] padding) -> Tensor3930 - func: replication_pad3d(Tensor self, SymInt[6] padding) -> Tensor
3611 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53931 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3612 op_api: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53932 op_api: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3933+ gen_opapi:
3934+ structured_inherit: replication_pad3d.out
3613 3935 
3614 - func: replication_pad3d(Tensor self, int[6] padding) -> Tensor3936 - func: replication_pad3d(Tensor self, int[6] padding) -> Tensor
3615 acl_op: v1.113937 acl_op: v1.11
3616 op_api: v1.113938 op_api: v1.11
3939+ gen_opapi:
3940+ structured_inherit: replication_pad3d.out
3617 3941 
3618 - func: replication_pad3d.out(Tensor self, SymInt[6] padding, *, Tensor(a!) out) -> Tensor(a!)3942 - func: replication_pad3d.out(Tensor self, SymInt[6] padding, *, Tensor(a!) out) -> Tensor(a!)
3619 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53943 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3620 op_api: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53944 op_api: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3945+ gen_opapi:
3946+ out:
3947+ size: replication_pad3d_npu_out_size(self, padding)
3948+ dtype: self
3949+ exec: aclnnReplicationPad3d
3621 3950 
3622 - func: replication_pad3d.out(Tensor self, int[6] padding, *, Tensor(a!) out) -> Tensor(a!)3951 - func: replication_pad3d.out(Tensor self, int[6] padding, *, Tensor(a!) out) -> Tensor(a!)
3623 acl_op: v1.113952 acl_op: v1.11
3624 op_api: v1.113953 op_api: v1.11
3954+ gen_opapi:
3955+ out:
3956+ size: replication_pad3d_npu_out_size(self, padding)
3957+ dtype: self
3958+ exec: aclnnReplicationPad3d
3625 3959 
3626 - func: replication_pad3d_backward(Tensor grad_output, Tensor self, SymInt[6] padding) -> Tensor3960 - func: replication_pad3d_backward(Tensor grad_output, Tensor self, SymInt[6] padding) -> Tensor
3627 op_api: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53961 op_api: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3962+ gen_opapi:
3963+ structured_inherit: replication_pad3d_backward.grad_input
3628 3964 
3629 - func: replication_pad3d_backward(Tensor grad_output, Tensor self, int[6] padding) -> Tensor3965 - func: replication_pad3d_backward(Tensor grad_output, Tensor self, int[6] padding) -> Tensor
3630 op_api: v1.113966 op_api: v1.11
3967+ gen_opapi:
3968+ structured_inherit: replication_pad3d_backward.grad_input
3631 3969 
3632 - func: replication_pad3d_backward.grad_input(Tensor grad_output, Tensor self, SymInt[6] padding, *, Tensor(a!) grad_input) -> Tensor(a!)3970 - func: replication_pad3d_backward.grad_input(Tensor grad_output, Tensor self, SymInt[6] padding, *, Tensor(a!) grad_input) -> Tensor(a!)
3633 op_api: v2.0, v2.1, v2.2, v2.3, v2.4, v2.53971 op_api: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
3972+ gen_opapi:
3973+ grad_input:
3974+ size: self
3975+ dtype: self
3976+ exec: aclnnReplicationPad3dBackward
3634 3977 
3635 - func: replication_pad3d_backward.grad_input(Tensor grad_output, Tensor self, int[6] padding, *, Tensor(a!) grad_input) -> Tensor(a!)3978 - func: replication_pad3d_backward.grad_input(Tensor grad_output, Tensor self, int[6] padding, *, Tensor(a!) grad_input) -> Tensor(a!)
3636 op_api: v1.113979 op_api: v1.11
3980+ gen_opapi:
3981+ grad_input:
3982+ size: self
3983+ dtype: self
3984+ exec: aclnnReplicationPad3dBackward
3637 3985 
3638 - func: roll(Tensor self, SymInt[1] shifts, int[1] dims=[]) -> Tensor3986 - func: roll(Tensor self, SymInt[1] shifts, int[1] dims=[]) -> Tensor
3639 acl_op: v2.1, v2.2, v2.3, v2.4, v2.53987 acl_op: v2.1, v2.2, v2.3, v2.4, v2.5
3640 op_api: v2.1, v2.2, v2.3, v2.4, v2.53988 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
3989+ gen_opapi:
3990+ grad_input:
3991+ size: self
3992+ dtype: self
3993+ exec: aclnnRoll
3641 3994 
3642 - func: roll(Tensor self, int[1] shifts, int[1] dims=[]) -> Tensor3995 - func: roll(Tensor self, int[1] shifts, int[1] dims=[]) -> Tensor
3643 acl_op: v1.11, v2.03996 acl_op: v1.11, v2.0
3644 op_api: v1.113997 op_api: v1.11
3998+ gen_opapi:
3999+ grad_input:
4000+ size: self
4001+ dtype: self
4002+ exec: aclnnRoll
3645 4003 
3646 - func: round(Tensor self) -> Tensor4004 - func: round(Tensor self) -> Tensor
3647 acl_op: all_version4005 acl_op: all_version
3648 op_api: all_version4006 op_api: all_version
4007+ gen_opapi:
4008+ structured_inherit: round.out
3649 4009 
3650 - func: round.decimals(Tensor self, *, int decimals) -> Tensor4010 - func: round.decimals(Tensor self, *, int decimals) -> Tensor
3651 acl_op: all_version4011 acl_op: all_version
@@ -3658,10 +4018,17 @@ official:
3658 - func: round.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)4018 - func: round.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
3659 acl_op: all_version4019 acl_op: all_version
3660 op_api: all_version4020 op_api: all_version
4021+ gen_opapi:
4022+ out:
4023+ size: self
4024+ dtype: self
4025+ exec: aclnnRound
3661 4026 
3662 - func: round_(Tensor(a!) self) -> Tensor(a!)4027 - func: round_(Tensor(a!) self) -> Tensor(a!)
3663 acl_op: all_version4028 acl_op: all_version
3664 op_api: all_version4029 op_api: all_version
4030+ gen_opapi:
4031+ exec: aclnnInplaceRound
3665 4032 
3666 - func: round_.decimals(Tensor(a!) self, *, int decimals) -> Tensor(a!)4033 - func: round_.decimals(Tensor(a!) self, *, int decimals) -> Tensor(a!)
3667 acl_op: all_version4034 acl_op: all_version
@@ -3682,22 +4049,43 @@ official:
3682 - func: rsqrt(Tensor self) -> Tensor4049 - func: rsqrt(Tensor self) -> Tensor
3683 acl_op: all_version4050 acl_op: all_version
3684 op_api: all_version4051 op_api: all_version
4052+ gen_opapi:
4053+ out:
4054+ size: self
4055+ dtype: 'isIntegralType(self.scalar_type(), true) ? at::kFloat : self.scalar_type()'
4056+ exec: aclnnRsqrt
3685 4057 
3686 - func: rsqrt.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)4058 - func: rsqrt.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
3687 acl_op: all_version4059 acl_op: all_version
3688 op_api: all_version4060 op_api: all_version
4061+ gen_opapi:
4062+ out:
4063+ size: self
4064+ exec: aclnnRsqrt
3689 4065 
3690 - func: rsqrt_(Tensor(a!) self) -> Tensor(a!)4066 - func: rsqrt_(Tensor(a!) self) -> Tensor(a!)
3691 acl_op: all_version4067 acl_op: all_version
3692 op_api: all_version4068 op_api: all_version
4069+ gen_opapi:
4070+ exec: aclnnInplaceRsqrt
3693 4071 
3694 - func: rsub.Scalar(Tensor self, Scalar other, Scalar alpha=1) -> Tensor4072 - func: rsub.Scalar(Tensor self, Scalar other, Scalar alpha=1) -> Tensor
3695 acl_op: all_version4073 acl_op: all_version
3696 op_api: all_version4074 op_api: all_version
4075+ gen_opapi:
4076+ out:
4077+ size: self
4078+ dtype: at::native::result_type(self, other)
4079+ exec: aclnnRsubs
3697 4080 
3698 - func: rsub.Tensor(Tensor self, Tensor other, *, Scalar alpha=1) -> Tensor4081 - func: rsub.Tensor(Tensor self, Tensor other, *, Scalar alpha=1) -> Tensor
3699 acl_op: all_version4082 acl_op: all_version
3700 op_api: all_version4083 op_api: all_version
4084+ gen_opapi:
4085+ out:
4086+ size: broadcast_ops_npu_output_size(self, other)
4087+ dtype: at::native::result_type(self, other)
4088+ exec: aclnnRsub
3701 4089 
3702 - func: scaled_dot_product_attention(Tensor query, Tensor key, Tensor value, Tensor? attn_mask=None, float dropout_p=0.0, bool is_causal=False, *, float? scale=None) -> Tensor4090 - func: scaled_dot_product_attention(Tensor query, Tensor key, Tensor value, Tensor? attn_mask=None, float dropout_p=0.0, bool is_causal=False, *, float? scale=None) -> Tensor
3703 op_api: v2.1, v2.2, v2.3, v2.4, v2.54091 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
@@ -4751,6 +5139,17 @@ custom:
4751 - func: npu_add_rms_norm(Tensor x1, Tensor x2, Tensor gamma, float epsilon=1e-06) -> (Tensor, Tensor, Tensor)5139 - func: npu_add_rms_norm(Tensor x1, Tensor x2, Tensor gamma, float epsilon=1e-06) -> (Tensor, Tensor, Tensor)
4752 acl_op: all_version5140 acl_op: all_version
4753 op_api: all_version5141 op_api: all_version
5142+ gen_opapi:
5143+ out0:
5144+ size: rms_norm_npu_output_size(x1, gamma)[0]
5145+ dtype: x1
5146+ out1:
5147+ size: rms_norm_npu_output_size(x1, gamma)[1]
5148+ dtype: at::kFloat
5149+ out2:
5150+ size: rms_norm_npu_output_size(x1, gamma)[0]
5151+ dtype: x1
5152+ exec: aclnnAddRmsNorm
4754 5153 
4755 - func: npu_all_gather_base_mm(Tensor self, Tensor x2, str hcom, int world_size, *, Tensor? bias=None, int gather_index=0, bool gather_output=True, int comm_turn=0) -> (Tensor, Tensor)5154 - func: npu_all_gather_base_mm(Tensor self, Tensor x2, str hcom, int world_size, *, Tensor? bias=None, int gather_index=0, bool gather_output=True, int comm_turn=0) -> (Tensor, Tensor)
4756 op_api: all_version5155 op_api: all_version
@@ -4799,10 +5198,20 @@ custom:
4799 - func: npu_binary_cross_entropy_with_logits_backward(Tensor grad_output, Tensor self, Tensor target, Tensor? weight=None, Tensor? pos_weight=None, int reduction=Mean) -> Tensor5198 - func: npu_binary_cross_entropy_with_logits_backward(Tensor grad_output, Tensor self, Tensor target, Tensor? weight=None, Tensor? pos_weight=None, int reduction=Mean) -> Tensor
4800 acl_op: v1.115199 acl_op: v1.11
4801 op_api: v1.115200 op_api: v1.11
5201+ gen_opapi:
5202+ out:
5203+ size: target
5204+ dtype: target
5205+ exec: aclnnBinaryCrossEntropyWithLogitsBackward
4802 5206 
4803 - func: npu_binary_cross_entropy_with_logits_backward(Tensor grad_output, Tensor self, Tensor target, Tensor? weight_opt, Tensor? pos_weight_opt, int reduction) -> Tensor5207 - func: npu_binary_cross_entropy_with_logits_backward(Tensor grad_output, Tensor self, Tensor target, Tensor? weight_opt, Tensor? pos_weight_opt, int reduction) -> Tensor
4804 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.55208 acl_op: v2.0, v2.1, v2.2, v2.3, v2.4, v2.5
4805 op_api: v2.1, v2.2, v2.3, v2.4, v2.55209 op_api: v2.1, v2.2, v2.3, v2.4, v2.5
5210+ gen_opapi:
5211+ out:
5212+ size: target
5213+ dtype: target
5214+ exec: aclnnBinaryCrossEntropyWithLogitsBackward
4806 5215 
4807 - func: npu_bmmV2(Tensor self, Tensor mat2, int[] output_sizes) -> Tensor5216 - func: npu_bmmV2(Tensor self, Tensor mat2, int[] output_sizes) -> Tensor
4808 acl_op: all_version5217 acl_op: all_version
@@ -5035,6 +5444,17 @@ custom:
5035 5444 
5036 - func: npu_group_norm_silu(Tensor input, Tensor? weight, Tensor? bias, int group, float eps=0.00001) -> (Tensor, Tensor, Tensor)5445 - func: npu_group_norm_silu(Tensor input, Tensor? weight, Tensor? bias, int group, float eps=0.00001) -> (Tensor, Tensor, Tensor)
5037 op_api: all_version5446 op_api: all_version
5447+ gen_opapi:
5448+ out0:
5449+ size: input
5450+ dtype: input
5451+ out1:
5452+ size: '{input.size(0), group}'
5453+ dtype: input
5454+ out2:
5455+ size: '{input.size(0), group}'
5456+ dtype: input
5457+ exec: aclnnGroupNormSilu
5038 5458 
5039 - func: npu_grouped_matmul(Tensor[] x, Tensor[] weight, *, Tensor[] bias, Tensor[] scale, Tensor[] offset, Tensor[] antiquant_scale, Tensor[] antiquant_offset, int[]? group_list=None, int? split_item=0, ScalarType? output_dtype=None) -> Tensor[]5459 - func: npu_grouped_matmul(Tensor[] x, Tensor[] weight, *, Tensor[] bias, Tensor[] scale, Tensor[] offset, Tensor[] antiquant_scale, Tensor[] antiquant_offset, int[]? group_list=None, int? split_item=0, ScalarType? output_dtype=None) -> Tensor[]
5040 op_api: v1.11, v2.05460 op_api: v1.11, v2.0
@@ -5122,6 +5542,11 @@ custom:
5122 5542 
5123 - func: npu_masked_softmax_with_rel_pos_bias(Tensor x, Tensor? atten_mask, Tensor relative_pos_bias, float scale_value=1.0, int inner_precision_mode=0) -> Tensor5543 - func: npu_masked_softmax_with_rel_pos_bias(Tensor x, Tensor? atten_mask, Tensor relative_pos_bias, float scale_value=1.0, int inner_precision_mode=0) -> Tensor
5124 op_api: all_version5544 op_api: all_version
5545+ gen_opapi:
5546+ out:
5547+ size: x
5548+ dtype: x
5549+ exec: aclnnMaskedSoftmaxWithRelPosBias
5125 5550 
5126 - func: npu_max.dim(Tensor self, int dim, bool keepdim=False) -> (Tensor values, Tensor indices)5551 - func: npu_max.dim(Tensor self, int dim, bool keepdim=False) -> (Tensor values, Tensor indices)
5127 acl_op: all_version5552 acl_op: all_version
@@ -5167,9 +5592,19 @@ custom:
5167 5592 
5168 - func: npu_moe_compute_expert_tokens(Tensor sorted_expert_for_source_row, int num_expert) -> Tensor5593 - func: npu_moe_compute_expert_tokens(Tensor sorted_expert_for_source_row, int num_expert) -> Tensor
5169 op_api: all_version5594 op_api: all_version
5595+ gen_opapi:
5596+ out:
5597+ size: '{num_expert}'
5598+ dtype: sorted_expert_for_source_row
5599+ exec: aclnnMoeComputeExpertTokens
5170 5600 
5171 - func: npu_moe_finalize_routing(Tensor expanded_permuted_rows, Tensor skip1, Tensor? skip2, Tensor bias, Tensor scales, Tensor expanded_src_to_dst_row, Tensor export_for_source_row) -> Tensor5601 - func: npu_moe_finalize_routing(Tensor expanded_permuted_rows, Tensor skip1, Tensor? skip2, Tensor bias, Tensor scales, Tensor expanded_src_to_dst_row, Tensor export_for_source_row) -> Tensor
5172 op_api: all_version5602 op_api: all_version
5603+ gen_opapi:
5604+ out:
5605+ size: skip1
5606+ dtype: skip1
5607+ exec: aclnnMoeFinalizeRouting
5173 5608 
5174 - func: npu_moe_gating_top_k_softmax(Tensor x, Tensor? finished=None, int k=1) -> (Tensor, Tensor, Tensor)5609 - func: npu_moe_gating_top_k_softmax(Tensor x, Tensor? finished=None, int k=1) -> (Tensor, Tensor, Tensor)
5175 op_api: all_version5610 op_api: all_version
@@ -1,39 +0,0 @@
1-// Copyright (c) 2024 Huawei Technologies Co., Ltd
2-// All rights reserved.
3-//
4-// Licensed under the BSD 3-Clause License (the "License");
5-// you may not use this file except in compliance with the License.
6-// You may obtain a copy of the License at
7-//
8-// https://opensource.org/licenses/BSD-3-Clause
9-//
10-// Unless required by applicable law or agreed to in writing, software
11-// distributed under the License is distributed on an "AS IS" BASIS,
12-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-// See the License for the specific language governing permissions and
14-// limitations under the License.
15- 
16-#include "op_plugin/OpApiInterface.h"
17-#include "op_plugin/AclOpsInterface.h"
18-#include "op_plugin/utils/op_api_common.h"
19- 
20-namespace op_api {
21-using npu_preparation = at_npu::native::OpPreparation;
22- 
23-std::tuple<at::Tensor, at::Tensor, at::Tensor> npu_add_rms_norm(
24- const at::Tensor& x1,
25- const at::Tensor& x2,
26- const at::Tensor& gamma,
27- double epsilon)
28-{
29- DO_COMPATIBILITY(aclnnAddRmsNorm, acl_op::npu_add_rms_norm(x1, x2, gamma, epsilon));
30- auto output_size = op_infer::rms_norm_npu_output_size(x1, gamma);
31- at::Tensor y = npu_preparation::apply_tensor_without_format(output_size[0], x1.options());
32- at::Tensor rstd = npu_preparation::apply_tensor_without_format(output_size[1], x1.options().dtype(at::kFloat));
33- at::Tensor x = npu_preparation::apply_tensor_without_format(output_size[0], x1.options());
34- 
35- EXEC_NPU_CMD(aclnnAddRmsNorm, x1, x2, gamma, epsilon, y, rstd, x);
36- return std::tuple<at::Tensor, at::Tensor, at::Tensor>(y, rstd, x);
37-}
38- 
39-}
@@ -1,60 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// All rights reserved.
3-//
4-// Licensed under the BSD 3-Clause License (the "License");
5-// you may not use this file except in compliance with the License.
6-// You may obtain a copy of the License at
7-//
8-// https://opensource.org/licenses/BSD-3-Clause
9-//
10-// Unless required by applicable law or agreed to in writing, software
11-// distributed under the License is distributed on an "AS IS" BASIS,
12-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-// See the License for the specific language governing permissions and
14-// limitations under the License.
15- 
16-#include "op_plugin/AclOpsInterface.h"
17-#include "op_plugin/OpApiInterface.h"
18-#include "op_plugin/utils/op_api_common.h"
19- 
20-namespace op_api {
21-using npu_preparation = at_npu::native::OpPreparation;
22- 
23-std::tuple<at::Tensor, at::Tensor, at::Tensor> native_batch_norm(const at::Tensor& self,
24- const c10::optional<at::Tensor>& weight_opt,
25- const c10::optional<at::Tensor>& bias_opt,
26- const c10::optional<at::Tensor>& running_mean_opt,
27- const c10::optional<at::Tensor>& running_var_opt,
28- bool train, double momentum, double eps) {
29- DO_COMPATIBILITY(aclnnBatchNorm, acl_op::native_batch_norm(self, weight_opt, bias_opt, running_mean_opt,
30- running_var_opt, train, momentum, eps));
31- // construct the output tensor of the NPU
32- at::Tensor result = npu_preparation::apply_tensor_without_format(self.sizes(), self.options());
33- at::Tensor save_mean;
34- at::Tensor save_invstd;
35- if (train) {
36- save_mean = npu_preparation::apply_tensor_without_format({self.size(1)}, self.options().dtype(at::kFloat));
37- save_invstd = npu_preparation::apply_tensor_without_format({self.size(1)}, self.options().dtype(at::kFloat));
38- } else {
39- save_mean = at::empty({0}, self.options());
40- save_invstd = at::empty({0}, self.options());
41- }
42- 
43- EXEC_NPU_CMD(aclnnBatchNorm, self, weight_opt, bias_opt, running_mean_opt, running_var_opt, train, momentum, eps,
44- result, save_mean, save_invstd);
45- return std::tie(result, save_mean, save_invstd);
46-}
47- 
48-std::tuple<at::Tensor&, at::Tensor&, at::Tensor&> native_batch_norm_out(
49- const at::Tensor& self, const c10::optional<at::Tensor>& weight_opt, const c10::optional<at::Tensor>& bias_opt,
50- const c10::optional<at::Tensor>& running_mean_opt, const c10::optional<at::Tensor>& running_var_opt, bool train,
51- double momentum, double eps, at::Tensor& out, at::Tensor& save_mean, at::Tensor& save_invstd) {
52- DO_COMPATIBILITY(aclnnBatchNorm,
53- acl_op::native_batch_norm_out(self, weight_opt, bias_opt, running_mean_opt, running_var_opt, train,
54- momentum, eps, out, save_mean, save_invstd));
55- 
56- EXEC_NPU_CMD(aclnnBatchNorm, self, weight_opt, bias_opt, running_mean_opt, running_var_opt, train, momentum, eps, out,
57- save_mean, save_invstd);
58- return std::tie(out, save_mean, save_invstd);
59-}
60-}
@@ -1,37 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// All rights reserved.
3-//
4-// Licensed under the BSD 3-Clause License (the "License");
5-// you may not use this file except in compliance with the License.
6-// You may obtain a copy of the License at
7-//
8-// https://opensource.org/licenses/BSD-3-Clause
9-//
10-// Unless required by applicable law or agreed to in writing, software
11-// distributed under the License is distributed on an "AS IS" BASIS,
12-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-// See the License for the specific language governing permissions and
14-// limitations under the License.
15- 
16-#include "op_plugin/AclOpsInterface.h"
17-#include "op_plugin/OpApiInterface.h"
18-#include "op_plugin/utils/op_api_common.h"
19- 
20-namespace op_api {
21-using npu_preparation = at_npu::native::OpPreparation;
22- 
23-at::Tensor npu_binary_cross_entropy_with_logits_backward(const at::Tensor& grad_output, const at::Tensor& self,
24- const at::Tensor& target,
25- const c10::optional<at::Tensor>& weight_opt,
26- const c10::optional<at::Tensor>& pos_weight_opt,
27- int64_t reduction) {
28- DO_COMPATIBILITY(aclnnBinaryCrossEntropyWithLogitsBackward,
29- acl_op::npu_binary_cross_entropy_with_logits_backward(grad_output, self, target, weight_opt,
30- pos_weight_opt, reduction));
31- at::Tensor grad_input = npu_preparation::apply_tensor_without_format(target);
32- // calculate the output result of the NPU
33- EXEC_NPU_CMD(aclnnBinaryCrossEntropyWithLogitsBackward, grad_output, self, target, weight_opt, pos_weight_opt,
34- reduction, grad_input);
35- return grad_input;
36-}
37-}
@@ -1,45 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// Copyright (c) 2023, Facebook CORPORATION.
3-// All rights reserved.
4-//
5-// Licensed under the BSD 3-Clause License (the "License");
6-// you may not use this file except in compliance with the License.
7-// You may obtain a copy of the License at
8-//
9-// https://opensource.org/licenses/BSD-3-Clause
10-//
11-// Unless required by applicable law or agreed to in writing, software
12-// distributed under the License is distributed on an "AS IS" BASIS,
13-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-// See the License for the specific language governing permissions and
15-// limitations under the License.
16- 
17-#include "op_plugin/AclOpsInterface.h"
18-#include "op_plugin/OpApiInterface.h"
19-#include "op_plugin/utils/op_api_common.h"
20- 
21-namespace op_api {
22-using npu_preparation = at_npu::native::OpPreparation;
23- 
24-std::tuple<at::Tensor, at::Tensor, at::Tensor> native_group_norm(
25- const at::Tensor& X,
26- const c10::optional<at::Tensor>& gamma_opt,
27- const c10::optional<at::Tensor>& beta_opt,
28- int64_t N,
29- int64_t C,
30- int64_t HxW,
31- int64_t group,
32- double eps)
33-{
34- DO_COMPATIBILITY(aclnnGroupNorm,
35- acl_op::native_group_norm(X, gamma_opt, beta_opt, N, C, HxW, group, eps));
36- 
37- at::Tensor y = npu_preparation::apply_tensor_without_format(X);
38- at::Tensor mean = npu_preparation::apply_tensor_without_format(X, {N, group});
39- at::Tensor rstd = npu_preparation::apply_tensor_without_format(X, {N, group});
40- 
41- EXEC_NPU_CMD(aclnnGroupNorm, X, gamma_opt, beta_opt, N, C, HxW, group, eps, y, mean, rstd);
42- return std::make_tuple(y, mean, rstd);
43-}
44- 
45-}
@@ -1,41 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// Copyright (c) 2023, Facebook CORPORATION.
3-// All rights reserved.
4-//
5-// Licensed under the BSD 3-Clause License (the "License");
6-// you may not use this file except in compliance with the License.
7-// You may obtain a copy of the License at
8-//
9-// https://opensource.org/licenses/BSD-3-Clause
10-//
11-// Unless required by applicable law or agreed to in writing, software
12-// distributed under the License is distributed on an "AS IS" BASIS,
13-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-// See the License for the specific language governing permissions and
15-// limitations under the License.
16- 
17-#include "op_plugin/AclOpsInterface.h"
18-#include "op_plugin/OpApiInterface.h"
19-#include "op_plugin/utils/op_api_common.h"
20- 
21-namespace op_api {
22-using npu_preparation = at_npu::native::OpPreparation;
23- 
24-std::tuple<at::Tensor, at::Tensor, at::Tensor> npu_group_norm_silu(
25- const at::Tensor& X,
26- const c10::optional<at::Tensor>& gamma_opt,
27- const c10::optional<at::Tensor>& beta_opt,
28- int64_t group,
29- double eps)
30- 
31-{
32- at::Tensor y = npu_preparation::apply_tensor_without_format(X);
33- auto x_size = op_infer::array_to_small_vector(X.sizes());
34- at::Tensor mean = npu_preparation::apply_tensor_without_format(X, {x_size[0], group});
35- at::Tensor rstd = npu_preparation::apply_tensor_without_format(X, {x_size[0], group});
36- 
37- EXEC_NPU_CMD(aclnnGroupNormSilu, X, gamma_opt, beta_opt, group, eps, y, mean, rstd);
38- return std::make_tuple(y, mean, rstd);
39-}
40- 
41-}
@@ -1,33 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// All rights reserved.
3-//
4-// Licensed under the BSD 3-Clause License (the "License");
5-// you may not use this file except in compliance with the License.
6-// You may obtain a copy of the License at
7-//
8-// https://opensource.org/licenses/BSD-3-Clause
9-//
10-// Unless required by applicable law or agreed to in writing, software
11-// distributed under the License is distributed on an "AS IS" BASIS,
12-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-// See the License for the specific language governing permissions and
14-// limitations under the License.
15- 
16-#include "op_plugin/AclOpsInterface.h"
17-#include "op_plugin/OpApiInterface.h"
18-#include "op_plugin/utils/op_api_common.h"
19- 
20-namespace op_api {
21-using npu_preparation = at_npu::native::OpPreparation;
22-at::Tensor npu_masked_softmax_with_rel_pos_bias(
23- const at::Tensor& x,
24- const c10::optional<at::Tensor> &atten_mask,
25- const at::Tensor& relative_pos_bias,
26- double scale_value,
27- int64_t inner_precision_mode)
28-{
29- at::Tensor result = npu_preparation::apply_tensor_without_format(x);
30- EXEC_NPU_CMD(aclnnMaskedSoftmaxWithRelPosBias, x, atten_mask, relative_pos_bias, scale_value, inner_precision_mode, result);
31- return result;
32-}
33-}
@@ -1,63 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// All rights reserved.
3-//
4-// Licensed under the BSD 3-Clause License (the "License");
5-// you may not use this file except in compliance with the License.
6-// You may obtain a copy of the License at
7-//
8-// https://opensource.org/licenses/BSD-3-Clause
9-//
10-// Unless required by applicable law or agreed to in writing, software
11-// distributed under the License is distributed on an "AS IS" BASIS,
12-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-// See the License for the specific language governing permissions and
14-// limitations under the License.
15- 
16-#include "op_plugin/AclOpsInterface.h"
17-#include "op_plugin/OpApiInterface.h"
18-#include "op_plugin/utils/op_api_common.h"
19- 
20-namespace op_api {
21-using npu_preparation = at_npu::native::OpPreparation;
22- 
23-at::Tensor max_pool2d_with_indices_backward(
24- const at::Tensor& grad_output,
25- const at::Tensor& self,
26- at::IntArrayRef kernel_size,
27- at::IntArrayRef stride,
28- at::IntArrayRef padding,
29- at::IntArrayRef dilation,
30- bool ceil_mode,
31- const at::Tensor& indices)
32-{
33- DO_COMPATIBILITY(aclnnMaxPool2dWithMaskBackward,
34- acl_op::max_pool2d_with_indices_backward(grad_output, self, kernel_size,
35- stride, padding, dilation, ceil_mode, indices));
36- at::Tensor grad_input = npu_preparation::apply_tensor_without_format(self);
37- 
38- EXEC_NPU_CMD(aclnnMaxPool2dWithMaskBackward, grad_output, self, indices, kernel_size,
39- stride, padding, dilation, ceil_mode, grad_input);
40- return grad_input;
41-}
42- 
43-at::Tensor& max_pool2d_with_indices_backward_out(
44- const at::Tensor& grad_output,
45- const at::Tensor& self,
46- at::IntArrayRef kernel_size,
47- at::IntArrayRef stride,
48- at::IntArrayRef padding,
49- at::IntArrayRef dilation,
50- bool ceil_mode,
51- const at::Tensor& indices,
52- at::Tensor& grad_input)
53-{
54- DO_COMPATIBILITY(aclnnMaxPool2dWithMaskBackward,
55- acl_op::max_pool2d_with_indices_backward_out(grad_output, self, kernel_size, stride, padding,
56- dilation, ceil_mode, indices, grad_input));
57- 
58- EXEC_NPU_CMD(aclnnMaxPool2dWithMaskBackward, grad_output, self, indices, kernel_size,
59- stride, padding, dilation, ceil_mode, grad_input);
60- return grad_input;
61-}
62- 
63-}
@@ -1,46 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// All rights reserved.
3-//
4-// Licensed under the BSD 3-Clause License (the "License");
5-// you may not use this file except in compliance with the License.
6-// You may obtain a copy of the License at
7-//
8-// https://opensource.org/licenses/BSD-3-Clause
9-//
10-// Unless required by applicable law or agreed to in writing, software
11-// distributed under the License is distributed on an "AS IS" BASIS,
12-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-// See the License for the specific language governing permissions and
14-// limitations under the License.
15- 
16-#include "op_plugin/AclOpsInterface.h"
17-#include "op_plugin/OpApiInterface.h"
18-#include "op_plugin/utils/op_api_common.h"
19- 
20-namespace op_api {
21-using npu_preparation = at_npu::native::OpPreparation;
22- 
23-at::Tensor& max_unpool2d_out(
24- const at::Tensor& self,
25- const at::Tensor& indices,
26- at::IntArrayRef outputSize,
27- at::Tensor& output) {
28- DO_COMPATIBILITY(aclnnMaxUnpool2d, acl_op::max_unpool2d_out(self, indices, outputSize, output));
29- auto output_size = op_infer::max_pool2d_out_size(self, outputSize);
30- npu_preparation::check_tensor({self, indices}, output, self.scalar_type(), output_size);
31- 
32- EXEC_NPU_CMD(aclnnMaxUnpool2d, self, indices, outputSize, output);
33- return output;
34-};
35- 
36-at::Tensor max_unpool2d(
37- const at::Tensor& self,
38- const at::Tensor& indices,
39- at::IntArrayRef output_size) {
40- DO_COMPATIBILITY(aclnnMaxUnpool2d, acl_op::max_unpool2d(self, indices, output_size));
41- auto outputSize = op_infer::max_pool2d_out_size(self, output_size);
42- at::Tensor output = npu_preparation::apply_tensor_without_format(self, outputSize);
43- op_api::max_unpool2d_out(self, indices, output_size, output);
44- return output;
45-}
46-}
@@ -1,49 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// All rights reserved.
3-//
4-// Licensed under the BSD 3-Clause License (the "License");
5-// you may not use this file except in compliance with the License.
6-// You may obtain a copy of the License at
7-//
8-// https://opensource.org/licenses/BSD-3-Clause
9-//
10-// Unless required by applicable law or agreed to in writing, software
11-// distributed under the License is distributed on an "AS IS" BASIS,
12-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-// See the License for the specific language governing permissions and
14-// limitations under the License.
15- 
16-#include "op_plugin/AclOpsInterface.h"
17-#include "op_plugin/OpApiInterface.h"
18-#include "op_plugin/utils/op_api_common.h"
19- 
20-namespace op_api {
21-using npu_preparation = at_npu::native::OpPreparation;
22- 
23-at::Tensor& max_unpool3d_out(
24- const at::Tensor& self,
25- const at::Tensor& indices,
26- at::IntArrayRef output_size,
27- at::IntArrayRef stride,
28- at::IntArrayRef padding,
29- at::Tensor& result) {
30- DO_COMPATIBILITY(aclnnMaxUnpool3d, acl_op::max_unpool3d_out(self, indices, output_size, stride, padding, result));
31- auto out_shape = op_infer::max_pool3d_output_size(self, output_size);
32- npu_preparation::check_tensor({self, indices}, result, self.scalar_type(), out_shape);
33- EXEC_NPU_CMD(aclnnMaxUnpool3d, self, indices, output_size, stride, padding, result);
34- return result;
35-}
36- 
37-at::Tensor max_unpool3d(
38- const at::Tensor& self,
39- const at::Tensor& indices,
40- at::IntArrayRef output_size,
41- at::IntArrayRef stride,
42- at::IntArrayRef padding) {
43- DO_COMPATIBILITY(aclnnMaxUnpool3d, acl_op::max_unpool3d(self, indices, output_size, stride, padding));
44- auto out_shape = op_infer::max_pool3d_output_size(self, output_size);
45- at::Tensor result = npu_preparation::apply_tensor_without_format(self, out_shape);
46- EXEC_NPU_CMD(aclnnMaxUnpool3d, self, indices, output_size, stride, padding, result);
47- return result;
48-}
49-}
@@ -1,83 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// All rights reserved.
3-//
4-// Licensed under the BSD 3-Clause License (the "License");
5-// you may not use this file except in compliance with the License.
6-// You may obtain a copy of the License at
7-//
8-// https://opensource.org/licenses/BSD-3-Clause
9-//
10-// Unless required by applicable law or agreed to in writing, software
11-// distributed under the License is distributed on an "AS IS" BASIS,
12-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-// See the License for the specific language governing permissions and
14-// limitations under the License.
15- 
16-#include "op_plugin/AclOpsInterface.h"
17-#include "op_plugin/OpApiInterface.h"
18-#include "op_plugin/utils/op_api_common.h"
19- 
20-namespace op_api {
21-using npu_preparation = at_npu::native::OpPreparation;
22- 
23-at::Tensor median(const at::Tensor& self)
24-{
25- DO_COMPATIBILITY(aclnnMedian, acl_op::median(self));
26- at::SmallVector<int64_t, op_infer::SIZE> dims = op_plugin::utils::get_dimlist_for_tensor(self);
27- auto output_size = op_infer::reduce_ops_npu_output_size(self, dims, false);
28- at::Tensor result = npu_preparation::apply_tensor_without_format(self, output_size);
29- EXEC_NPU_CMD(aclnnMedian, self, result);
30- return result;
31-}
32- 
33-std::tuple<at::Tensor, at::Tensor> median(const at::Tensor& self,
34- int64_t dim,
35- bool keepdim)
36-{
37- DO_COMPATIBILITY(aclnnMedianDim, acl_op::median(self, dim, keepdim));
38- at::SmallVector<int64_t, op_infer::SIZE> dims = {dim};
39- auto outputSize = op_infer::reduce_ops_npu_output_size(self, dims, keepdim);
40- at::Tensor values = npu_preparation::apply_tensor_without_format(self, outputSize);
41- at::Tensor indices = npu_preparation::apply_tensor_without_format(outputSize, self.options().dtype(at::kLong));
42- EXEC_NPU_CMD(aclnnMedianDim, self, dim, keepdim, values, indices);
43- return std::tie(values, indices);
44-}
45- 
46-std::tuple<at::Tensor&, at::Tensor&> median_out(const at::Tensor& self,
47- int64_t dim,
48- bool keepdim,
49- at::Tensor& values,
50- at::Tensor& indices)
51-{
52- DO_COMPATIBILITY(aclnnMedianDim, acl_op::median_out(self, dim, keepdim, values, indices));
53- at::SmallVector<int64_t, op_infer::SIZE> dims = {dim};
54- auto outputSize = op_infer::reduce_ops_npu_output_size(self, dims, keepdim);
55- npu_preparation::check_tensor({self}, values, values.scalar_type(), outputSize);
56- npu_preparation::check_tensor({self}, indices, indices.scalar_type(), outputSize);
57- EXEC_NPU_CMD(aclnnMedianDim, self, dim, keepdim, values, indices);
58- return std::tie(values, indices);
59-}
60- 
61-#if VERSION_BETWEEN(V1R11, V1R11) || VERSION_BETWEEN(V2R1, VERSION_NEWEST)
62-at::Tensor nanmedian(const at::Tensor& self)
63-{
64- DO_COMPATIBILITY(aclnnNanMedian, acl_op::nanmedian(self));
65- at::SmallVector<int64_t, op_infer::SIZE> dims = op_plugin::utils::get_dimlist_for_tensor(self);
66- auto output_size = op_infer::reduce_ops_npu_output_size(self, dims, false);
67- at::Tensor result = npu_preparation::apply_tensor_without_format(self, output_size);
68- EXEC_NPU_CMD(aclnnNanMedian, self, result);
69- return result;
70-}
71- 
72-std::tuple<at::Tensor, at::Tensor> nanmedian(const at::Tensor &self, int64_t dim, bool keepdim)
73-{
74- DO_COMPATIBILITY(aclnnNanMedianDim, acl_op::nanmedian(self, dim, keepdim));
75- auto output_size = op_infer::reduce_ops_npu_output_size(self, dim, keepdim);
76- at::Tensor output = npu_preparation::apply_tensor_without_format(self, output_size);
77- at::Tensor indices = npu_preparation::apply_tensor_without_format(output_size, self.options().dtype(at::kLong));
78- EXEC_NPU_CMD(aclnnNanMedianDim, self, dim, keepdim, output, indices);
79- return std::tie(output, indices);
80-}
81-#endif
82- 
83-}
@@ -19,24 +19,6 @@
19 19 
20namespace op_api {20namespace op_api {
21 21 
22-at::Tensor minimum(const at::Tensor& self, const at::Tensor& other) {
23- DO_COMPATIBILITY(aclnnMinimum, acl_op::minimum(self, other));
24- auto result_type = at::result_type(self, other);
25- auto output_size = op_infer::broadcast_ops_npu_output_size(self, other);
26- at::Tensor result =
27- at_npu::native::OpPreparation::apply_tensor_without_format(output_size, self.options().dtype(result_type));
28- EXEC_NPU_CMD(aclnnMinimum, self, other, result);
29- return result;
30-}
31- 
32-at::Tensor& minimum_out(const at::Tensor& self, const at::Tensor& other, at::Tensor& result) {
33- DO_COMPATIBILITY(aclnnMinimum, acl_op::minimum_out(self, other, result));
34- auto output_size = op_infer::broadcast_ops_npu_output_size(self, other);
35- at_npu::native::OpPreparation::check_tensor({self, other}, result, result.scalar_type(), output_size);
36- EXEC_NPU_CMD(aclnnMinimum, self, other, result);
37- return result;
38-}
39- 
40at::Tensor min(const at::Tensor& self) {22at::Tensor min(const at::Tensor& self) {
41 DO_COMPATIBILITY(aclnnMin, acl_op::min(self));23 DO_COMPATIBILITY(aclnnMin, acl_op::min(self));
42 at::SmallVector<int64_t, op_infer::SIZE> dims = op_plugin::utils::get_dimlist_for_tensor(self);24 at::SmallVector<int64_t, op_infer::SIZE> dims = op_plugin::utils::get_dimlist_for_tensor(self);
@@ -1,34 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// All rights reserved.
3-//
4-// Licensed under the BSD 3-Clause License (the "License");
5-// you may not use this file except in compliance with the License.
6-// You may obtain a copy of the License at
7-//
8-// https://opensource.org/licenses/BSD-3-Clause
9-//
10-// Unless required by applicable law or agreed to in writing, software
11-// distributed under the License is distributed on an "AS IS" BASIS,
12-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-// See the License for the specific language governing permissions and
14-// limitations under the License.
15- 
16-#include "op_plugin/AclOpsInterface.h"
17-#include "op_plugin/OpInterface.h"
18-#include "op_plugin/utils/op_api_common.h"
19- 
20-namespace op_api {
21-using npu_preparation = at_npu::native::OpPreparation;
22- 
23-at::Tensor mish_backward(const at::Tensor &grad_output, const at::Tensor &self)
24-{
25- DO_COMPATIBILITY(aclnnMishBackward, acl_op::mish_backward(grad_output, self));
26- auto output_size = op_infer::broadcast_ops_npu_output_size(grad_output.sizes(), self.sizes());
27- at::ScalarType output_type = at::native::result_type(grad_output, self);
28- at::Tensor grad_input = npu_preparation::apply_tensor_without_format(output_size,
29- self.options().dtype(output_type));
30- EXEC_NPU_CMD(aclnnMishBackward, grad_output, self, grad_input);
31- return grad_input;
32-}
33- 
34-}
@@ -1,30 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// All rights reserved.
3-//
4-// Licensed under the BSD 3-Clause License (the "License");
5-// you may not use this file except in compliance with the License.
6-// You may obtain a copy of the License at
7-//
8-// https://opensource.org/licenses/BSD-3-Clause
9-//
10-// Unless required by applicable law or agreed to in writing, software
11-// distributed under the License is distributed on an "AS IS" BASIS,
12-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-// See the License for the specific language governing permissions and
14-// limitations under the License.
15- 
16-#include "op_plugin/OpApiInterface.h"
17-#include "op_plugin/utils/op_api_common.h"
18- 
19-namespace op_api {
20-at::Tensor npu_moe_compute_expert_tokens(const at::Tensor &sorted_expert_for_source_row, const int64_t num_expert)
21-{
22- c10::SmallVector<int64_t, SIZE> output_size = {num_expert};
23- at::Tensor result = at_npu::native::OpPreparation::apply_tensor_without_format(sorted_expert_for_source_row,
24- output_size);
25- EXEC_NPU_CMD(aclnnMoeComputeExpertTokens, sorted_expert_for_source_row, num_expert, result);
26- 
27- return result;
28-}
29- 
30-}
@@ -1,36 +0,0 @@
1-// Copyright (c) 2024 Huawei Technologies Co., Ltd
2-// All rights reserved.
3-//
4-// Licensed under the BSD 3-Clause License (the "License");
5-// you may not use this file except in compliance with the License.
6-// You may obtain a copy of the License at
7-//
8-// https://opensource.org/licenses/BSD-3-Clause
9-//
10-// Unless required by applicable law or agreed to in writing, software
11-// distributed under the License is distributed on an "AS IS" BASIS,
12-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-// See the License for the specific language governing permissions and
14-// limitations under the License.
15- 
16-#include <torch/csrc/autograd/custom_function.h>
17-#include "op_plugin/OpApiInterface.h"
18-#include "op_plugin/utils/op_api_common.h"
19- 
20-namespace op_api {
21-using npu_preparation = at_npu::native::OpPreparation;
22- 
23-at::Tensor npu_moe_finalize_routing(const at::Tensor& expanded_permuted_rows, const at::Tensor& skip1,
24- const c10::optional<at::Tensor>& skip2,
25- const at::Tensor& bias, const at::Tensor& scales,
26- const at::Tensor& expanded_src_to_dst_row,
27- const at::Tensor& expert_for_source_row)
28-{
29- at::Tensor result = npu_preparation::apply_tensor_without_format(skip1);
30- 
31- EXEC_NPU_CMD(aclnnMoeFinalizeRouting, expanded_permuted_rows, skip1, skip2, bias, scales,
32- expanded_src_to_dst_row, expert_for_source_row, result);
33- 
34- return result;
35-}
36-}
@@ -1,53 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// Copyright (c) 2019, Facebook CORPORATION.
3-// All rights reserved.
4-//
5-// Licensed under the BSD 3-Clause License (the "License");
6-// you may not use this file except in compliance with the License.
7-// You may obtain a copy of the License at
8-//
9-// https://opensource.org/licenses/BSD-3-Clause
10-//
11-// Unless required by applicable law or agreed to in writing, software
12-// distributed under the License is distributed on an "AS IS" BASIS,
13-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-// See the License for the specific language governing permissions and
15-// limitations under the License.
16- 
17-#include "op_plugin/AclOpsInterface.h"
18-#include "op_plugin/OpApiInterface.h"
19-#include "op_plugin/utils/op_api_common.h"
20- 
21-namespace op_api {
22- 
23-at::Tensor& mse_loss_backward_out(
24- const at::Tensor& grad_output,
25- const at::Tensor& self,
26- const at::Tensor& target,
27- int64_t reduction,
28- at::Tensor& grad_input) {
29- DO_COMPATIBILITY(aclnnMseLossBackward,
30- acl_op::mse_loss_backward_out(grad_output, self, target, reduction, grad_input));
31- auto output_size_pre = op_infer::broadcast_ops_npu_output_size(grad_output.sizes(), self.sizes());
32- auto output_size = op_infer::broadcast_ops_npu_output_size(output_size_pre, target.sizes());
33- at_npu::native::OpPreparation::check_tensor(
34- {grad_output, self, target}, grad_input, grad_input.scalar_type(), output_size);
35- EXEC_NPU_CMD(aclnnMseLossBackward, grad_output, self, target, reduction, grad_input);
36- return grad_input;
37-}
38- 
39-at::Tensor mse_loss_backward(
40- const at::Tensor& grad_output,
41- const at::Tensor& self,
42- const at::Tensor& target,
43- int64_t reduction) {
44- DO_COMPATIBILITY(aclnnMseLossBackward,
45- acl_op::mse_loss_backward(grad_output, self, target, reduction));
46- auto output_size_pre = op_infer::broadcast_ops_npu_output_size(grad_output.sizes(), self.sizes());
47- auto output_size = op_infer::broadcast_ops_npu_output_size(output_size_pre, target.sizes());
48- at::Tensor grad_input = at_npu::native::OpPreparation::apply_tensor_without_format(self, output_size);
49- EXEC_NPU_CMD(aclnnMseLossBackward, grad_output, self, target, reduction, grad_input);
50- return grad_input;
51-}
52- 
53-}
@@ -1,46 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// Copyright (c) 2019, Facebook CORPORATION.
3-// All rights reserved.
4-//
5-// Licensed under the BSD 3-Clause License (the "License");
6-// you may not use this file except in compliance with the License.
7-// You may obtain a copy of the License at
8-//
9-// https://opensource.org/licenses/BSD-3-Clause
10-//
11-// Unless required by applicable law or agreed to in writing, software
12-// distributed under the License is distributed on an "AS IS" BASIS,
13-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-// See the License for the specific language governing permissions and
15-// limitations under the License.
16- 
17-#include "op_plugin/AclOpsInterface.h"
18-#include "op_plugin/OpApiInterface.h"
19-#include "op_plugin/utils/op_api_common.h"
20- 
21-namespace op_api {
22- 
23-at::Tensor& neg_out(const at::Tensor& self, at::Tensor& result) {
24- DO_COMPATIBILITY(aclnnNeg, acl_op::neg_out(self, result));
25- at_npu::native::OpPreparation::check_tensor({self}, result, self.scalar_type(), self.sizes());
26- EXEC_NPU_CMD(aclnnNeg, self, result);
27- return result;
28-}
29- 
30-at::Tensor neg(const at::Tensor& self) {
31- DO_COMPATIBILITY(aclnnNeg, acl_op::neg(self));
32- // construct the output tensor of the NPU
33- at::Tensor result = at_npu::native::OpPreparation::apply_tensor_without_format(self.sizes(), self.options());
34- 
35- EXEC_NPU_CMD(aclnnNeg, self, result);
36- return result;
37-}
38- 
39-at::Tensor& neg_(at::Tensor& self) {
40- DO_COMPATIBILITY(aclnnInplaceNeg, acl_op::neg_(self));
41- at_npu::native::OpPreparation::check_memory({self}, {self});
42- 
43- EXEC_NPU_CMD(aclnnInplaceNeg, self);
44- return self;
45-}
46-}
@@ -1,96 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// Copyright (c) 2019, Facebook CORPORATION.
3-// All rights reserved.
4-//
5-// Licensed under the BSD 3-Clause License (the "License");
6-// you may not use this file except in compliance with the License.
7-// You may obtain a copy of the License at
8-//
9-// https://opensource.org/licenses/BSD-3-Clause
10-//
11-// Unless required by applicable law or agreed to in writing, software
12-// distributed under the License is distributed on an "AS IS" BASIS,
13-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-// See the License for the specific language governing permissions and
15-// limitations under the License.
16- 
17-#include "op_plugin/AclOpsInterface.h"
18-#include "op_plugin/OpApiInterface.h"
19-#include "op_plugin/utils/op_api_common.h"
20- 
21-namespace op_api {
22-using npu_preparation = at_npu::native::OpPreparation;
23- 
24-// pow.Tensor_Tensor_out
25-at::Tensor& pow_out(const at::Tensor& self, const at::Tensor& exp, at::Tensor& result) {
26- DO_COMPATIBILITY(aclnnPowTensorTensor, acl_op::pow_out(self, exp, result));
27- auto outputSize = op_infer::broadcast_ops_npu_output_size(self, exp);
28- npu_preparation::check_tensor({self, exp}, result, result, outputSize);
29- npu_preparation::check_memory({self, exp}, {result});
30- 
31- EXEC_NPU_CMD(aclnnPowTensorTensor, self, exp, result);
32- return result;
33-}
34- 
35-// pow.Tensor_Scalar_out
36-at::Tensor& pow_out(const at::Tensor& self, const at::Scalar& exp, at::Tensor& result) {
37- DO_COMPATIBILITY(aclnnPowTensorScalar, acl_op::pow_out(self, exp, result));
38- auto resultType = at::result_type(self, exp);
39- npu_preparation::check_tensor({self}, result, resultType, self.sizes());
40- npu_preparation::check_memory({self}, {result});
41- 
42- EXEC_NPU_CMD(aclnnPowTensorScalar, self, exp, result);
43- return result;
44-}
45- 
46-// pow.Scalar_out
47-at::Tensor &pow_out(const at::Scalar& self, const at::Tensor &exp, at::Tensor &result) {
48- DO_COMPATIBILITY(aclnnPowScalarTensor, acl_op::pow_out(self, exp, result));
49- npu_preparation::check_tensor({exp}, result, result.scalar_type(), exp.sizes());
50- 
51- EXEC_NPU_CMD(aclnnPowScalarTensor, self, exp, result);
52- return result;
53-}
54- 
55-at::Tensor pow(const at::Tensor& self, const at::Tensor& exp) {
56- DO_COMPATIBILITY(aclnnPowTensorTensor, acl_op::pow(self, exp));
57- // calculate the output size
58- auto output_size = op_infer::broadcast_ops_npu_output_size(self, exp);
59- at::ScalarType result_type = at::result_type(self, exp);
60- at::Tensor result = npu_preparation::apply_tensor_without_format(output_size, self.options().dtype(result_type));
61- 
62- EXEC_NPU_CMD(aclnnPowTensorTensor, self, exp, result);
63- return result;
64-}
65- 
66-at::Tensor pow(const at::Tensor& self, const at::Scalar& exp) {
67- DO_COMPATIBILITY(aclnnPowTensorScalar, acl_op::pow(self, exp));
68- auto outputSize = op_infer::input_same_output_size(self);
69- auto resultType = at::result_type(self, exp);
70- at::Tensor result = npu_preparation::apply_tensor_without_format(outputSize, self.options().dtype(resultType));
71- 
72- EXEC_NPU_CMD(aclnnPowTensorScalar, self, exp, result);
73- return result;
74-}
75- 
76-at::Tensor pow(const at::Scalar& self, const at::Tensor& exp) {
77- DO_COMPATIBILITY(aclnnPowScalarTensor, acl_op::pow(self, exp));
78- at::ScalarType result_type = at::result_type(self, exp);
79- at::Tensor result = npu_preparation::apply_tensor_without_format(exp.sizes(), exp.options().dtype(result_type));
80- 
81- EXEC_NPU_CMD(aclnnPowScalarTensor, self, exp, result);
82- return result;
83-}
84- 
85-at::Tensor &pow_(at::Tensor &self, const at::Tensor &exp) {
86- DO_COMPATIBILITY(aclnnInplacePowTensorTensor, acl_op::pow_(self, exp));
87- EXEC_NPU_CMD(aclnnInplacePowTensorTensor, self, exp);
88- return self;
89-}
90- 
91-at::Tensor &pow_(at::Tensor &self, const at::Scalar& exp) {
92- DO_COMPATIBILITY(aclnnInplacePowTensorScalar, acl_op::pow_(self, exp));
93- EXEC_NPU_CMD(aclnnInplacePowTensorScalar, self, exp);
94- return self;
95-}
96-}
@@ -1,55 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// Copyright (c) 2019, Facebook CORPORATION.
3-// All rights reserved.
4-//
5-// Licensed under the BSD 3-Clause License (the "License");
6-// you may not use this file except in compliance with the License.
7-// You may obtain a copy of the License at
8-//
9-// https://opensource.org/licenses/BSD-3-Clause
10-//
11-// Unless required by applicable law or agreed to in writing, software
12-// distributed under the License is distributed on an "AS IS" BASIS,
13-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-// See the License for the specific language governing permissions and
15-// limitations under the License.
16- 
17-#include "op_plugin/AclOpsInterface.h"
18-#include "op_plugin/OpApiInterface.h"
19-#include "op_plugin/utils/op_api_common.h"
20- 
21-namespace op_api {
22-using npu_preparation = at_npu::native::OpPreparation;
23- 
24-at::Tensor &reciprocal_out(const at::Tensor &self, at::Tensor &result)
25-{
26- DO_COMPATIBILITY(aclnnReciprocal, acl_op::reciprocal_out(self, result));
27- 
28- auto output_size = op_infer::input_same_output_size(self);
29- npu_preparation::check_tensor({self}, result, result.scalar_type(), output_size);
30- 
31- EXEC_NPU_CMD(aclnnReciprocal, self, result);
32- return result;
33-}
34- 
35-at::Tensor reciprocal(const at::Tensor &self)
36-{
37- DO_COMPATIBILITY(aclnnReciprocal, acl_op::reciprocal(self));
38- // calculate the output size
39- auto output_size = op_infer::input_same_output_size(self);
40- auto out_dtype = (isIntegralType(self.scalar_type(), true)) ? at::kFloat : self.scalar_type();
41- // construct the output tensor of the NPU
42- at::Tensor result = npu_preparation::apply_tensor_without_format(output_size, self.options().dtype(out_dtype));
43- // calculate the output result of the NPU
44- EXEC_NPU_CMD(aclnnReciprocal, self, result);
45- return result;
46-}
47- 
48-at::Tensor &reciprocal_(at::Tensor &self)
49-{
50- DO_COMPATIBILITY(aclnnInplaceReciprocal, acl_op::reciprocal_(self));
51- EXEC_NPU_CMD(aclnnInplaceReciprocal, self);
52- return self;
53-}
54- 
55-}
@@ -1,48 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// Copyright (c) 2019, Facebook CORPORATION.
3-// All rights reserved.
4-//
5-// Licensed under the BSD 3-Clause License (the "License");
6-// you may not use this file except in compliance with the License.
7-// You may obtain a copy of the License at
8-//
9-// https://opensource.org/licenses/BSD-3-Clause
10-//
11-// Unless required by applicable law or agreed to in writing, software
12-// distributed under the License is distributed on an "AS IS" BASIS,
13-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-// See the License for the specific language governing permissions and
15-// limitations under the License.
16- 
17-#include "op_plugin/AclOpsInterface.h"
18-#include "op_plugin/OpApiInterface.h"
19-#include "op_plugin/utils/op_api_common.h"
20- 
21-namespace op_api {
22-using npu_preparation = at_npu::native::OpPreparation;
23- 
24-at::Tensor& reflection_pad1d_backward_out(const at::Tensor& grad_output,
25- const at::Tensor& self,
26- at::IntArrayRef padding,
27- at::Tensor& grad_input) {
28- DO_COMPATIBILITY(aclnnReflectionPad1dBackward,
29- acl_op::reflection_pad1d_backward_out(grad_output, self, padding, grad_input));
30- 
31- npu_preparation::check_tensor({self, grad_output}, grad_input, self);
32- 
33- EXEC_NPU_CMD(aclnnReflectionPad1dBackward, grad_output, self, padding, grad_input);
34- return grad_input;
35-}
36- 
37-at::Tensor reflection_pad1d_backward(const at::Tensor& grad_output,
38- const at::Tensor& self,
39- at::IntArrayRef padding) {
40- DO_COMPATIBILITY(aclnnReflectionPad1dBackward,
41- acl_op::reflection_pad1d_backward(grad_output, self, padding));
42- 
43- at::Tensor grad_input = npu_preparation::apply_tensor_without_format(self);
44- EXEC_NPU_CMD(aclnnReflectionPad1dBackward, grad_output, self, padding, grad_input);
45- return grad_input;
46-}
47- 
48-}
@@ -1,41 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// Copyright (c) 2019, Facebook CORPORATION.
3-// All rights reserved.
4-//
5-// Licensed under the BSD 3-Clause License (the "License");
6-// you may not use this file except in compliance with the License.
7-// You may obtain a copy of the License at
8-//
9-// https://opensource.org/licenses/BSD-3-Clause
10-//
11-// Unless required by applicable law or agreed to in writing, software
12-// distributed under the License is distributed on an "AS IS" BASIS,
13-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-// See the License for the specific language governing permissions and
15-// limitations under the License.
16- 
17-#include "op_plugin/AclOpsInterface.h"
18-#include "op_plugin/OpApiInterface.h"
19-#include "op_plugin/utils/op_api_common.h"
20- 
21-namespace op_api {
22-using npu_preparation = at_npu::native::OpPreparation;
23- 
24-at::Tensor& reflection_pad1d_out(const at::Tensor& self, at::IntArrayRef padding,
25- at::Tensor& out) {
26- DO_COMPATIBILITY(aclnnReflectionPad1d, acl_op::reflection_pad1d_out(self, padding, out));
27- auto output_size = op_infer::reflection_pad1d_npu_out_size(self, padding);
28- npu_preparation::check_tensor({self}, out, self, output_size);
29- EXEC_NPU_CMD(aclnnReflectionPad1d, self, padding, out);
30- return out;
31-}
32- 
33-at::Tensor reflection_pad1d(const at::Tensor& self, at::IntArrayRef padding) {
34- DO_COMPATIBILITY(aclnnReflectionPad1d, acl_op::reflection_pad1d(self, padding));
35- auto output_size = op_infer::reflection_pad1d_npu_out_size(self, padding);
36- at::Tensor out = npu_preparation::apply_tensor_without_format(self, output_size);
37- EXEC_NPU_CMD(aclnnReflectionPad1d, self, padding, out);
38- return out;
39-}
40- 
41-}
@@ -1,45 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// Copyright (c) 2019, Facebook CORPORATION.
3-// All rights reserved.
4-//
5-// Licensed under the BSD 3-Clause License (the "License");
6-// you may not use this file except in compliance with the License.
7-// You may obtain a copy of the License at
8-//
9-// https://opensource.org/licenses/BSD-3-Clause
10-//
11-// Unless required by applicable law or agreed to in writing, software
12-// distributed under the License is distributed on an "AS IS" BASIS,
13-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-// See the License for the specific language governing permissions and
15-// limitations under the License.
16- 
17-#include "op_plugin/AclOpsInterface.h"
18-#include "op_plugin/OpApiInterface.h"
19-#include "op_plugin/utils/op_api_common.h"
20- 
21-namespace op_api {
22-using npu_preparation = at_npu::native::OpPreparation;
23- 
24-at::Tensor& reflection_pad2d_backward_out(const at::Tensor& grad_output,
25- const at::Tensor& self,
26- at::IntArrayRef padding,
27- at::Tensor& grad_input) {
28- DO_COMPATIBILITY(aclnnReflectionPad2dBackward,
29- acl_op::reflection_pad2d_backward_out(grad_output, self, padding, grad_input));
30- npu_preparation::check_tensor({self, grad_output}, grad_input, self);
31- EXEC_NPU_CMD(aclnnReflectionPad2dBackward, grad_output, self, padding, grad_input);
32- return grad_input;
33-}
34- 
35-at::Tensor reflection_pad2d_backward(const at::Tensor& grad_output,
36- const at::Tensor& self,
37- at::IntArrayRef padding) {
38-DO_COMPATIBILITY(aclnnReflectionPad2dBackward,
39- acl_op::reflection_pad2d_backward(grad_output, self, padding));
40- at::Tensor grad_input = npu_preparation::apply_tensor_without_format(self);
41- EXEC_NPU_CMD(aclnnReflectionPad2dBackward, grad_output, self, padding, grad_input);
42- return grad_input;
43-}
44- 
45-}
@@ -1,43 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// Copyright (c) 2019, Facebook CORPORATION.
3-// All rights reserved.
4-//
5-// Licensed under the BSD 3-Clause License (the "License");
6-// you may not use this file except in compliance with the License.
7-// You may obtain a copy of the License at
8-//
9-// https://opensource.org/licenses/BSD-3-Clause
10-//
11-// Unless required by applicable law or agreed to in writing, software
12-// distributed under the License is distributed on an "AS IS" BASIS,
13-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-// See the License for the specific language governing permissions and
15-// limitations under the License.
16- 
17-#include "op_plugin/AclOpsInterface.h"
18-#include "op_plugin/OpApiInterface.h"
19-#include "op_plugin/utils/op_api_common.h"
20- 
21-namespace op_api {
22-using npu_preparation = at_npu::native::OpPreparation;
23- 
24-at::Tensor& reflection_pad2d_out(const at::Tensor& self,
25- at::IntArrayRef padding,
26- at::Tensor& out) {
27- DO_COMPATIBILITY(aclnnReflectionPad2d, acl_op::reflection_pad2d_out(self, padding, out));
28- auto output_size = op_infer::reflection_pad2d_npu_out_size(self, padding);
29- npu_preparation::check_tensor({self}, out, self, output_size);
30- EXEC_NPU_CMD(aclnnReflectionPad2d, self, padding, out);
31- return out;
32-}
33- 
34-at::Tensor reflection_pad2d(const at::Tensor& self,
35- at::IntArrayRef padding) {
36- DO_COMPATIBILITY(aclnnReflectionPad2d, acl_op::reflection_pad2d(self, padding));
37- auto output_size = op_infer::reflection_pad2d_npu_out_size(self, padding);
38- at::Tensor out = npu_preparation::apply_tensor_without_format(self, output_size);
39- EXEC_NPU_CMD(aclnnReflectionPad2d, self, padding, out);
40- return out;
41-}
42- 
43-}
@@ -1,43 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// All rights reserved.
3-//
4-// Licensed under the BSD 3-Clause License (the "License");
5-// you may not use this file except in compliance with the License.
6-// You may obtain a copy of the License at
7-//
8-// https://opensource.org/licenses/BSD-3-Clause
9-//
10-// Unless required by applicable law or agreed to in writing, software
11-// distributed under the License is distributed on an "AS IS" BASIS,
12-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-// See the License for the specific language governing permissions and
14-// limitations under the License.
15- 
16- 
17-#include "op_plugin/AclOpsInterface.h"
18-#include "op_plugin/OpApiInterface.h"
19-#include "op_plugin/utils/op_api_common.h"
20- 
21-namespace op_api {
22-using npu_preparation = at_npu::native::OpPreparation;
23- 
24-at::Tensor& reflection_pad3d_backward_out(const at::Tensor& grad_output,
25- const at::Tensor& self,
26- at::IntArrayRef padding,
27- at::Tensor& grad_input)
28-{
29- npu_preparation::check_tensor({self, grad_output}, grad_input, self);
30- EXEC_NPU_CMD(aclnnReflectionPad3dBackward, grad_output, self, padding, grad_input);
31- return grad_input;
32-}
33- 
34-at::Tensor reflection_pad3d_backward(const at::Tensor& grad_output,
35- const at::Tensor& self,
36- at::IntArrayRef padding)
37-{
38- at::Tensor grad_input = npu_preparation::apply_tensor_without_format(self);
39- EXEC_NPU_CMD(aclnnReflectionPad3dBackward, grad_output, self, padding, grad_input);
40- return grad_input;
41-}
42- 
43-}
@@ -1,42 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// All rights reserved.
3-//
4-// Licensed under the BSD 3-Clause License (the "License");
5-// you may not use this file except in compliance with the License.
6-// You may obtain a copy of the License at
7-//
8-// https://opensource.org/licenses/BSD-3-Clause
9-//
10-// Unless required by applicable law or agreed to in writing, software
11-// distributed under the License is distributed on an "AS IS" BASIS,
12-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-// See the License for the specific language governing permissions and
14-// limitations under the License.
15- 
16-#include "op_plugin/AclOpsInterface.h"
17-#include "op_plugin/OpApiInterface.h"
18-#include "op_plugin/utils/op_api_common.h"
19- 
20-namespace op_api {
21-using npu_preparation = at_npu::native::OpPreparation;
22- 
23-at::Tensor& reflection_pad3d_out(const at::Tensor& self,
24- at::IntArrayRef padding,
25- at::Tensor& out) {
26- DO_COMPATIBILITY(aclnnReflectionPad3d, acl_op::reflection_pad3d_out(self, padding, out));
27- auto output_size = op_infer::reflection_pad3d_npu_out_size(self, padding);
28- npu_preparation::check_tensor({self}, out, self, output_size);
29- EXEC_NPU_CMD(aclnnReflectionPad3d, self, padding, out);
30- return out;
31-}
32- 
33-at::Tensor reflection_pad3d(const at::Tensor& self,
34- at::IntArrayRef padding) {
35- DO_COMPATIBILITY(aclnnReflectionPad3d, acl_op::reflection_pad3d(self, padding));
36- auto output_size = op_infer::reflection_pad3d_npu_out_size(self, padding);
37- at::Tensor out = npu_preparation::apply_tensor_without_format(self, output_size);
38- EXEC_NPU_CMD(aclnnReflectionPad3d, self, padding, out);
39- return out;
40-}
41- 
42-}
@@ -1,37 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// Copyright (c) 2019, Facebook CORPORATION.
3-// All rights reserved.
4-//
5-// Licensed under the BSD 3-Clause License (the "License");
6-// you may not use this file except in compliance with the License.
7-// You may obtain a copy of the License at
8-//
9-// https://opensource.org/licenses/BSD-3-Clause
10-//
11-// Unless required by applicable law or agreed to in writing, software
12-// distributed under the License is distributed on an "AS IS" BASIS,
13-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-// See the License for the specific language governing permissions and
15-// limitations under the License.
16- 
17-#include "op_plugin/AclOpsInterface.h"
18-#include "op_plugin/OpApiInterface.h"
19-#include "op_plugin/utils/op_api_common.h"
20- 
21-namespace op_api {
22-using npu_preparation = at_npu::native::OpPreparation;
23- 
24-at::Tensor relu(const at::Tensor& self) {
25- DO_COMPATIBILITY(aclnnRelu, acl_op::relu(self));
26- auto outputSize = op_infer::input_same_output_size(self);
27- at::Tensor result = npu_preparation::apply_tensor_without_format(outputSize, self.options());
28- EXEC_NPU_CMD(aclnnRelu, self, result);
29- return result;
30-}
31- 
32-at::Tensor& relu_(at::Tensor& self) {
33- DO_COMPATIBILITY(aclnnInplaceRelu, acl_op::relu_(self));
34- EXEC_NPU_CMD(aclnnInplaceRelu, self);
35- return self;
36-}
37-}
@@ -1,31 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// All rights reserved.
3-//
4-// Licensed under the BSD 3-Clause License (the "License");
5-// you may not use this file except in compliance with the License.
6-// You may obtain a copy of the License at
7-//
8-// https://opensource.org/licenses/BSD-3-Clause
9-//
10-// Unless required by applicable law or agreed to in writing, software
11-// distributed under the License is distributed on an "AS IS" BASIS,
12-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-// See the License for the specific language governing permissions and
14-// limitations under the License.
15- 
16-#include "op_plugin/AclOpsInterface.h"
17-#include "op_plugin/OpApiInterface.h"
18-#include "op_plugin/utils/op_api_common.h"
19- 
20-namespace op_api {
21-using npu_preparation = at_npu::native::OpPreparation;
22- 
23-at::Tensor repeat(const at::Tensor &self, at::IntArrayRef repeats)
24-{
25- DO_COMPATIBILITY(aclnnRepeat, acl_op::repeat(self, repeats));
26- auto outputSize = op_infer::repeat_npu_output_size(self, repeats);
27- at::Tensor result = npu_preparation::apply_tensor_with_sizes(outputSize, self.options());
28- EXEC_NPU_CMD(aclnnRepeat, self, repeats, result);
29- return result;
30-}
31-}
@@ -1,44 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// All rights reserved.
3-//
4-// Licensed under the BSD 3-Clause License (the "License");
5-// you may not use this file except in compliance with the License.
6-// You may obtain a copy of the License at
7-//
8-// https://opensource.org/licenses/BSD-3-Clause
9-//
10-// Unless required by applicable law or agreed to in writing, software
11-// distributed under the License is distributed on an "AS IS" BASIS,
12-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-// See the License for the specific language governing permissions and
14-// limitations under the License.
15- 
16-#include "op_plugin/AclOpsInterface.h"
17-#include "op_plugin/OpApiInterface.h"
18-#include "op_plugin/utils/op_api_common.h"
19- 
20-namespace op_api {
21-using npu_preparation = at_npu::native::OpPreparation;
22- 
23-at::Tensor& replication_pad1d_backward_out(const at::Tensor& grad_output,
24- const at::Tensor& self,
25- at::IntArrayRef padding,
26- at::Tensor& grad_input) {
27- DO_COMPATIBILITY(aclnnReplicationPad1dBackward,
28- acl_op::replication_pad1d_backward_out(grad_output, self, padding, grad_input));
29- npu_preparation::check_tensor({self, grad_output}, grad_input, self);
30- EXEC_NPU_CMD(aclnnReplicationPad1dBackward, grad_output, self, padding, grad_input);
31- return grad_input;
32-}
33- 
34-at::Tensor replication_pad1d_backward(const at::Tensor& grad_output,
35- const at::Tensor& self,
36- at::IntArrayRef padding) {
37- at::Tensor grad_input = npu_preparation::apply_tensor_without_format(self);
38- DO_COMPATIBILITY(aclnnReplicationPad1dBackward,
39- acl_op::replication_pad1d_backward(grad_output, self, padding));
40- EXEC_NPU_CMD(aclnnReplicationPad1dBackward, grad_output, self, padding, grad_input);
41- return grad_input;
42-}
43- 
44-}
@@ -1,42 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// All rights reserved.
3-//
4-// Licensed under the BSD 3-Clause License (the "License");
5-// you may not use this file except in compliance with the License.
6-// You may obtain a copy of the License at
7-//
8-// https://opensource.org/licenses/BSD-3-Clause
9-//
10-// Unless required by applicable law or agreed to in writing, software
11-// distributed under the License is distributed on an "AS IS" BASIS,
12-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-// See the License for the specific language governing permissions and
14-// limitations under the License.
15- 
16-#include "op_plugin/AclOpsInterface.h"
17-#include "op_plugin/OpApiInterface.h"
18-#include "op_plugin/utils/op_api_common.h"
19- 
20-namespace op_api {
21-using npu_preparation = at_npu::native::OpPreparation;
22- 
23-at::Tensor& replication_pad1d_out(const at::Tensor& self,
24- at::IntArrayRef padding,
25- at::Tensor& out) {
26- DO_COMPATIBILITY(aclnnReplicationPad1d, acl_op::replication_pad1d_out(self, padding, out));
27- auto output_size = op_infer::replication_pad1d_npu_out_size(self, padding);
28- npu_preparation::check_tensor({self}, out, self, output_size);
29- EXEC_NPU_CMD(aclnnReplicationPad1d, self, padding, out);
30- return out;
31-}
32- 
33-at::Tensor replication_pad1d(const at::Tensor& self,
34- at::IntArrayRef padding) {
35- DO_COMPATIBILITY(aclnnReplicationPad1d, acl_op::replication_pad1d(self, padding));
36- auto output_size = op_infer::replication_pad1d_npu_out_size(self, padding);
37- at::Tensor out = npu_preparation::apply_tensor_without_format(self, output_size);
38- EXEC_NPU_CMD(aclnnReplicationPad1d, self, padding, out);
39- return out;
40-}
41- 
42-}
@@ -1,47 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// All rights reserved.
3-//
4-// Licensed under the BSD 3-Clause License (the "License");
5-// you may not use this file except in compliance with the License.
6-// You may obtain a copy of the License at
7-//
8-// https://opensource.org/licenses/BSD-3-Clause
9-//
10-// Unless required by applicable law or agreed to in writing, software
11-// distributed under the License is distributed on an "AS IS" BASIS,
12-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-// See the License for the specific language governing permissions and
14-// limitations under the License.
15- 
16-#include "op_plugin/AclOpsInterface.h"
17-#include "op_plugin/OpApiInterface.h"
18-#include "op_plugin/utils/op_api_common.h"
19- 
20-namespace op_api {
21-using npu_preparation = at_npu::native::OpPreparation;
22- 
23-at::Tensor& replication_pad2d_backward_out(
24- const at::Tensor& grad_output,
25- const at::Tensor& self,
26- at::IntArrayRef padding,
27- at::Tensor& grad_input) {
28- DO_COMPATIBILITY(aclnnReplicationPad2dBackward,
29- acl_op::replication_pad2d_backward_out(grad_output, self, padding, grad_input));
30- npu_preparation::check_tensor({self, grad_output}, grad_input, self);
31- 
32- EXEC_NPU_CMD(aclnnReplicationPad2dBackward, grad_output, self, padding, grad_input);
33- return grad_input;
34-}
35- 
36-at::Tensor replication_pad2d_backward(
37- const at::Tensor& grad_output,
38- const at::Tensor& self,
39- at::IntArrayRef padding) {
40- at::Tensor grad_input = npu_preparation::apply_tensor_without_format(self);
41- DO_COMPATIBILITY(aclnnReplicationPad2dBackward,
42- acl_op::replication_pad2d_backward(grad_output, self, padding));
43- EXEC_NPU_CMD(aclnnReplicationPad2dBackward, grad_output, self, padding, grad_input);
44- return grad_input;
45-}
46- 
47-}
@@ -1,40 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// All rights reserved.
3-//
4-// Licensed under the BSD 3-Clause License (the "License");
5-// you may not use this file except in compliance with the License.
6-// You may obtain a copy of the License at
7-//
8-// https://opensource.org/licenses/BSD-3-Clause
9-//
10-// Unless required by applicable law or agreed to in writing, software
11-// distributed under the License is distributed on an "AS IS" BASIS,
12-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-// See the License for the specific language governing permissions and
14-// limitations under the License.
15- 
16-#include "op_plugin/AclOpsInterface.h"
17-#include "op_plugin/OpApiInterface.h"
18-#include "op_plugin/utils/op_api_common.h"
19- 
20-namespace op_api {
21-using npu_preparation = at_npu::native::OpPreparation;
22- 
23-at::Tensor& replication_pad2d_out(const at::Tensor& self, at::IntArrayRef padding, at::Tensor& out) {
24- DO_COMPATIBILITY(aclnnReplicationPad2d, acl_op::replication_pad2d_out(self, padding, out));
25- auto output_size = op_infer::replication_pad2d_npu_out_size(self, padding);
26- npu_preparation::check_tensor({self}, out, self, output_size);
27- EXEC_NPU_CMD(aclnnReplicationPad2d, self, padding, out);
28- return out;
29-}
30- 
31-at::Tensor replication_pad2d(const at::Tensor& self, at::IntArrayRef padding) {
32- DO_COMPATIBILITY(aclnnReplicationPad2d, acl_op::replication_pad2d(self, padding));
33- auto output_size = op_infer::replication_pad2d_npu_out_size(self, padding);
34- at::Tensor out = npu_preparation::apply_tensor_without_format(self, output_size);
35- EXEC_NPU_CMD(aclnnReplicationPad2d, self, padding, out);
36- return out;
37-}
38- 
39-} // namespace op_api
40- 
@@ -1,42 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// All rights reserved.
3-//
4-// Licensed under the BSD 3-Clause License (the "License");
5-// you may not use this file except in compliance with the License.
6-// You may obtain a copy of the License at
7-//
8-// https://opensource.org/licenses/BSD-3-Clause
9-//
10-// Unless required by applicable law or agreed to in writing, software
11-// distributed under the License is distributed on an "AS IS" BASIS,
12-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-// See the License for the specific language governing permissions and
14-// limitations under the License.
15- 
16-#include "op_plugin/AclOpsInterface.h"
17-#include "op_plugin/OpApiInterface.h"
18-#include "op_plugin/utils/op_api_common.h"
19- 
20-namespace op_api {
21-using npu_preparation = at_npu::native::OpPreparation;
22- 
23-at::Tensor& replication_pad3d_backward_out(const at::Tensor& grad_output,
24- const at::Tensor& self,
25- at::IntArrayRef padding,
26- at::Tensor& grad_input)
27-{
28- npu_preparation::check_tensor({self, grad_output}, grad_input, self);
29- EXEC_NPU_CMD(aclnnReplicationPad3dBackward, grad_output, self, padding, grad_input);
30- return grad_input;
31-}
32- 
33-at::Tensor replication_pad3d_backward(const at::Tensor& grad_output,
34- const at::Tensor& self,
35- at::IntArrayRef padding)
36-{
37- at::Tensor grad_input = npu_preparation::apply_tensor_without_format(self);
38- EXEC_NPU_CMD(aclnnReplicationPad3dBackward, grad_output, self, padding, grad_input);
39- return grad_input;
40-}
41- 
42-}
@@ -1,41 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// All rights reserved.
3-//
4-// Licensed under the BSD 3-Clause License (the "License");
5-// you may not use this file except in compliance with the License.
6-// You may obtain a copy of the License at
7-//
8-// https://opensource.org/licenses/BSD-3-Clause
9-//
10-// Unless required by applicable law or agreed to in writing, software
11-// distributed under the License is distributed on an "AS IS" BASIS,
12-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-// See the License for the specific language governing permissions and
14-// limitations under the License.
15- 
16-#include "op_plugin/AclOpsInterface.h"
17-#include "op_plugin/OpApiInterface.h"
18-#include "op_plugin/utils/op_api_common.h"
19- 
20-namespace op_api {
21-using npu_preparation = at_npu::native::OpPreparation;
22- 
23-at::Tensor& replication_pad3d_out(const at::Tensor& self, at::IntArrayRef padding, at::Tensor& out)
24-{
25- DO_COMPATIBILITY(aclnnReplicationPad3d, acl_op::replication_pad3d_out(self, padding, out));
26- auto output_size = op_infer::replication_pad3d_npu_out_size(self, padding);
27- npu_preparation::check_tensor({self}, out, self, output_size);
28- EXEC_NPU_CMD(aclnnReplicationPad3d, self, padding, out);
29- return out;
30-}
31- 
32-at::Tensor replication_pad3d(const at::Tensor& self, at::IntArrayRef padding)
33-{
34- DO_COMPATIBILITY(aclnnReplicationPad3d, acl_op::replication_pad3d(self, padding));
35- auto output_size = op_infer::replication_pad3d_npu_out_size(self, padding);
36- at::Tensor out = npu_preparation::apply_tensor_without_format(self, output_size);
37- EXEC_NPU_CMD(aclnnReplicationPad3d, self, padding, out);
38- return out;
39-}
40- 
41-}
@@ -1,31 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// All rights reserved.
3-//
4-// Licensed under the BSD 3-Clause License (the "License");
5-// you may not use this file except in compliance with the License.
6-// You may obtain a copy of the License at
7-//
8-// https://opensource.org/licenses/BSD-3-Clause
9-//
10-// Unless required by applicable law or agreed to in writing, software
11-// distributed under the License is distributed on an "AS IS" BASIS,
12-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-// See the License for the specific language governing permissions and
14-// limitations under the License.
15- 
16-#include "op_plugin/AclOpsInterface.h"
17-#include "op_plugin/OpApiInterface.h"
18-#include "op_plugin/utils/op_api_common.h"
19- 
20-namespace op_api {
21-using npu_preparation = at_npu::native::OpPreparation;
22- 
23-at::Tensor roll(const at::Tensor& self, at::IntArrayRef shifts, at::IntArrayRef dims)
24-{
25- DO_COMPATIBILITY(aclnnRoll, acl_op::roll(self, shifts, dims));
26- at::Tensor result = npu_preparation::apply_tensor_without_format(self);
27- EXEC_NPU_CMD(aclnnRoll, self, shifts, dims, result);
28- return result;
29-}
30- 
31-}
@@ -1,43 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// All rights reserved.
3-//
4-// Licensed under the BSD 3-Clause License (the "License");
5-// you may not use this file except in compliance with the License.
6-// You may obtain a copy of the License at
7-//
8-// https://opensource.org/licenses/BSD-3-Clause
9-//
10-// Unless required by applicable law or agreed to in writing, software
11-// distributed under the License is distributed on an "AS IS" BASIS,
12-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-// See the License for the specific language governing permissions and
14-// limitations under the License.
15- 
16-#include "op_plugin/AclOpsInterface.h"
17-#include "op_plugin/OpApiInterface.h"
18-#include "op_plugin/utils/op_api_common.h"
19- 
20-namespace op_api {
21-using npu_preparation = at_npu::native::OpPreparation;
22- 
23-at::Tensor& round_out(const at::Tensor& self, at::Tensor& result) {
24- DO_COMPATIBILITY(aclnnRound, acl_op::round_out(self, result));
25- npu_preparation::check_tensor({self}, result, self);
26- EXEC_NPU_CMD(aclnnRound, self, result);
27- return result;
28-}
29- 
30-at::Tensor round(const at::Tensor& self) {
31- DO_COMPATIBILITY(aclnnRound, acl_op::round(self));
32- at::Tensor result = npu_preparation::apply_tensor_without_format(self);
33- EXEC_NPU_CMD(aclnnRound, self, result);
34- return result;
35-}
36- 
37-at::Tensor& round_(at::Tensor& self) {
38- DO_COMPATIBILITY(aclnnInplaceRound, acl_op::round_(self));
39- EXEC_NPU_CMD(aclnnInplaceRound, self);
40- return self;
41-}
42- 
43-}
@@ -1,60 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// All rights reserved.
3-//
4-// Licensed under the BSD 3-Clause License (the "License");
5-// you may not use this file except in compliance with the License.
6-// You may obtain a copy of the License at
7-//
8-// https://opensource.org/licenses/BSD-3-Clause
9-//
10-// Unless required by applicable law or agreed to in writing, software
11-// distributed under the License is distributed on an "AS IS" BASIS,
12-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-// See the License for the specific language governing permissions and
14-// limitations under the License.
15- 
16-#include "op_plugin/AclOpsInterface.h"
17-#include "op_plugin/OpApiInterface.h"
18-#include "op_plugin/utils/op_api_common.h"
19- 
20-namespace op_api {
21-using npu_preparation = at_npu::native::OpPreparation;
22- 
23-at::Tensor& rsqrt_out(const at::Tensor& self, at::Tensor& result)
24-{
25- DO_COMPATIBILITY(aclnnRsqrt, acl_op::rsqrt_out(self, result));
26- auto result_dtype = self.scalar_type();
27- if (isIntegralType(self.scalar_type(), true)) {
28- result_dtype = at::kFloat;
29- }
30- TORCH_CHECK(!isIntegralType(result.scalar_type(), true),
31- "result dtype ", result_dtype, " can't be cast to the desired output type ", result.dtype(), ".",
32- OPS_ERROR(ErrCode::TYPE));
33- npu_preparation::check_tensor({self}, result, result.scalar_type(), self.sizes());
34- EXEC_NPU_CMD(aclnnRsqrt, self, result);
35- return result;
36-}
37- 
38-at::Tensor &rsqrt_(at::Tensor &self)
39-{
40- DO_COMPATIBILITY(aclnnInplaceRsqrt, acl_op::rsqrt_(self));
41- TORCH_CHECK(!isIntegralType(self.scalar_type(), true),
42- "result dtype float can't be cast to the desired output type ", self.dtype(), ".",
43- OPS_ERROR(ErrCode::TYPE));
44- EXEC_NPU_CMD(aclnnInplaceRsqrt, self);
45- return self;
46-}
47- 
48-at::Tensor rsqrt(const at::Tensor& self)
49-{
50- DO_COMPATIBILITY(aclnnRsqrt, acl_op::rsqrt(self));
51- auto outDtype = self.dtype();
52- if (isIntegralType(self.scalar_type(), true)) {
53- outDtype = at::kFloat;
54- }
55- at::Tensor result = npu_preparation::apply_tensor_without_format(self.sizes(), self.options().dtype(outDtype));
56- EXEC_NPU_CMD(aclnnRsqrt, self, result);
57- return result;
58-}
59-} // namespace op_api
60- 
@@ -1,41 +0,0 @@
1-// Copyright (c) 2023 Huawei Technologies Co., Ltd
2-// All rights reserved.
3-//
4-// Licensed under the BSD 3-Clause License (the "License");
5-// you may not use this file except in compliance with the License.
6-// You may obtain a copy of the License at
7-//
8-// https://opensource.org/licenses/BSD-3-Clause
9-//
10-// Unless required by applicable law or agreed to in writing, software
11-// distributed under the License is distributed on an "AS IS" BASIS,
12-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-// See the License for the specific language governing permissions and
14-// limitations under the License.
15- 
16-#include "op_plugin/AclOpsInterface.h"
17-#include "op_plugin/OpApiInterface.h"
18-#include "op_plugin/utils/op_api_common.h"
19- 
20-namespace op_api {
21-at::Tensor rsub(const at::Tensor& self, const at::Tensor& other, const at::Scalar& alpha) {
22- DO_COMPATIBILITY(aclnnRsub, acl_op::rsub(self, other, alpha));
23- auto output_size = op_infer::broadcast_ops_npu_output_size(self, other);
24- at::ScalarType result_type = at::native::result_type(self, other);
25- auto result = at_npu::native::OpPreparation::apply_tensor_without_format(output_size,
26- self.options().dtype(result_type));
27- EXEC_NPU_CMD(aclnnRsub, self, other, alpha, result);
28- return result;
29-}
30- 
31-at::Tensor rsub(const at::Tensor& self, const at::Scalar& other, const at::Scalar& alpha) {
32- DO_COMPATIBILITY(aclnnRsubs, acl_op::rsub(self, other, alpha));
33- auto output_size = op_infer::input_same_output_size(self);
34- at::ScalarType result_type = at::native::result_type(self, other);
35- auto result = at_npu::native::OpPreparation::apply_tensor_without_format(output_size,
36- self.options().dtype(result_type));
37- EXEC_NPU_CMD(aclnnRsubs, self, other, alpha, result);
38- return result;
39-}
40- 
41-}
@@ -0,0 +1,21 @@
1+import torch
2+import torch_npu
3+ 
4+from torch_npu.testing.testcase import TestCase, run_tests
5+ 
6+ 
7+class TestMinimum(TestCase):
8+ 
9+ def test_minimum(self):
10+ shape = (4, 4)
11+ cpu_input1 = torch.randn(shape, dtype=torch.float32)
12+ cpu_input2 = torch.randn(shape, dtype=torch.float32)
13+ npu_input1, npu_input2 = cpu_input1.npu(), cpu_input2.npu()
14+ 
15+ cpu_output = torch.minimum(cpu_input1, cpu_input2)
16+ npu_output = torch.minimum(npu_input1, npu_input2)
17+ self.assertEqual(npu_output, cpu_output)
18+ 
19+ 
20+if __name__ == "__main__":
21+ run_tests()
@@ -0,0 +1,20 @@
1+import torch
2+import torch_npu
3+ 
4+from torch_npu.testing.testcase import TestCase, run_tests
5+ 
6+ 
7+class TestNeg(TestCase):
8+ 
9+ def test_neg(self):
10+ shape = (4, 4)
11+ cpu_input = torch.randn(shape, dtype=torch.float32)
12+ cpu_output = torch.neg(cpu_input)
13+ 
14+ npu_input = cpu_input.npu()
15+ npu_output = torch.neg(npu_input)
16+ self.assertEqual(npu_output, cpu_output)
17+ 
18+ 
19+if __name__ == "__main__":
20+ run_tests()
@@ -12,6 +12,7 @@ class TestGroupNormSilu(TestCase):
12 12 
13 def supported_op_exec(self, x, gama, beta, group, eps):13 def supported_op_exec(self, x, gama, beta, group, eps):
14 res = torch.ops.aten.native_group_norm(x, gama, beta, x.shape[0], x.shape[1], x.shape[2] * x.shape[3], group, eps)14 res = torch.ops.aten.native_group_norm(x, gama, beta, x.shape[0], x.shape[1], x.shape[2] * x.shape[3], group, eps)
15+ res = list(res)
15 res[0] = torch.nn.functional.silu(res[0])16 res[0] = torch.nn.functional.silu(res[0])
16 return res17 return res
17 18