|
- import argparse
-
- import torch
- import torch.nn as nn
- import torch.nn.functional as F
- import numpy as np
- from utils import overlap_and_add
- from mindspore import Tensor
- import numpy as np
- import mindspore
- import torch
- import mindspore.ops as ops
-
-
- input_x = Tensor(np.zeros((1, 1, 1, 2)), mindspore.int32)
- print(input_x)
- print("''''''''''''''''''")
-
- add_x = Tensor(np.ones((1, 1, 1, 2)), mindspore.int32)
- print("''''''''''''''''''add_x''''''''''''''''''''")
- print(add_x)
- print("''''''''''''''''''''''''''''''''''''''''''''''''")
-
- indices1 = Tensor(np.array( [[0],[2]] ), mindspore.int32)
- indices2 = Tensor(np.array([[[1], [2]]]), mindspore.int32)
- indices3 = Tensor(np.array([[[0]],[[0]]]), mindspore.int32)
- indices4 = Tensor(np.array([[0], [2]]), mindspore.int32)
- indices5 = Tensor(np.array([[0], [2]]), mindspore.int32)
- indices5 = Tensor(np.array([[0, 1] ,[1, 1]]), mindspore.int32)
- indices5 = Tensor(np.array([[0], [2]]), mindspore.int32)
- indices5 = Tensor(np.array([[0], [2]]), mindspore.int32)
-
- print("'''''''''''''''准备开始添加''''''''''''''''''''''''''''''''''''")
- scatter_nd_add = ops.ScatterNdAdd()
-
- output = scatter_nd_add(input_x, indices5, add_x)
- print("'''''''''''''''''''out''''''''''''''''''''''''''''''''''")
- print(output)
-
-
-
- print("'''''''")
-
-
-
-
-
-
-
-
-
-
-
-
|