Home
last modified time | relevance | path

Searched refs:Tensor (Results 1 – 25 of 2784) sorted by relevance

12345678910>>...112

/third_party/mindspore/mindspore/ccsrc/minddata/dataset/kernels/image/
Dimage_utils.h71 bool CheckTensorShape(const std::shared_ptr<Tensor> &tensor, const int &channel);
77 Status Flip(std::shared_ptr<Tensor> input, std::shared_ptr<Tensor> *output, int flip_code);
82 Status HorizontalFlip(std::shared_ptr<Tensor> input, std::shared_ptr<Tensor> *output);
87 Status VerticalFlip(std::shared_ptr<Tensor> input, std::shared_ptr<Tensor> *output);
98 Status Resize(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output, int32_t output…
108 Status Decode(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output);
110 Status DecodeCv(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output);
112 bool IsNonEmptyJPEG(const std::shared_ptr<Tensor> &input);
114 bool IsNonEmptyPNG(const std::shared_ptr<Tensor> &input);
118 Status JpegCropAndDecode(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output, int…
[all …]
Dlite_image_utils.h50 bool IsNonEmptyJPEG(const std::shared_ptr<Tensor> &input);
54 Status JpegCropAndDecode(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output, int…
64 Status Crop(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output, int x, int y, in…
72 Status Decode(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output);
78 Status GetJpegImageInfo(const std::shared_ptr<Tensor> &input, int *img_width, int *img_height);
85 Status Normalize(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output, std::vector…
97 Status Resize(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output, int32_t output…
114 Status RgbToBgr(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output);
120 Status RgbToGray(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output);
133 Status Pad(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output, const int32_t &pa…
[all …]
/third_party/mindspore/tests/ut/python/ops/
Dtest_math_ops_check.py20 from mindspore import Tensor
34 …self.inputdata = Parameter(Tensor(np.zeros([1]).astype(np.bool_), mstype.bool_), name="assign_add1…
45 …self.inputdata = Parameter(Tensor(np.zeros([1]).astype(np.bool_), mstype.bool_), name="assign_sub1…
85 …'desc_inputs': [Tensor(np.ones([3, 5]).astype(np.float32)), Tensor(np.ones([3, 4]).astype(np.float…
91 'desc_inputs': [Tensor(np.ones([1]).astype(np.bool_), mstype.bool_)],
97 'desc_inputs': [Tensor(np.ones([1]).astype(np.bool_), mstype.bool_)],
104 'desc_inputs': [Tensor(np.ones([2, 3, 5]).astype(np.float32))],
110 'desc_inputs': [Tensor(np.ones([2, 3, 5]).astype(np.float32))],
117 'desc_inputs': [Tensor(np.ones([2, 3, 5]).astype(np.float32))],
123 'desc_inputs': [Tensor(np.ones([2, 3, 5]).astype(np.float32))],
[all …]
Dtest_nn_ops_check.py19 from mindspore import Tensor
67 'desc_inputs': [Tensor(np.ones([3, 4]).astype(np.float32))],
72 'desc_inputs': [Tensor(np.ones([3, 4]).astype(np.float32))],
83 'desc_inputs': [Tensor(np.ones([3, 4]).astype(np.float32))],
94 'desc_inputs': [Tensor(np.ones([3, 4]).astype(np.bool_))],
105 'desc_inputs': [Tensor(np.ones([3, 4]).astype(np.int32))],
116 'desc_inputs': [Tensor(np.ones([3, 4]).astype(np.int32))],
127 'desc_inputs': [Tensor(np.ones([3, 4]).astype(np.int32))],
144 …'desc_inputs': [Tensor(np.ones([5, 3]).astype(np.float32)), Tensor(np.ones([5, 3]).astype(np.float…
145 Tensor(np.ones([5, 3]).astype(np.float32)), None, None],
[all …]
Dtest_tensor_slice.py19 from mindspore import Tensor, Parameter
32 self.tensor_ret0 = Tensor(np.ones([1, 2, 2], np.int32))
33 self.tensor_ret1 = Tensor(np.ones([4, 7, 4], np.int32))
34 self.tensor_ret2 = Tensor(np.ones([6, 8, 10], np.int32))
35 self.tensor_ret3 = Tensor(np.ones([3, 8, 10], np.int32))
48 self.tensor_ret0 = Tensor(np.ones([2, 7, 8], np.int32))
49 self.tensor_ret1 = Tensor(np.ones([6, 7, 8, 9], np.int32))
50 self.tensor_ret2 = Tensor(np.ones([1, 6, 7, 8, 9], np.int32))
63 self.tensor_ret0 = Tensor(np.ones([2, 4, 1], np.int32))
64 self.tensor_ret1 = Tensor(np.ones([3, 4], np.int32))
[all …]
Dtest_ops.py23 from mindspore import Tensor
78 x = Tensor(3, mstype.float32)
79 y = Tensor(1, mstype.float32)
92 … self.input_x = Parameter(Tensor(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]).astype(np.float32)))
419 self.ref = Parameter(Tensor(np.ones(ref_shape, dtype)), name="ref")
432 … self.ref = Parameter(Tensor(np.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]], dtype)), name="ref")
445 … self.ref = Parameter(Tensor(np.array([[-1.0, 2.0, 3.0], [-4.0, 1.0, 6.0]], dtype)), name="ref")
458 self.ref = Parameter(Tensor(np.ones(ref_shape, dtype)), name="ref")
471 self.ref = Parameter(Tensor(np.ones(ref_shape, dtype)), name="ref")
484 self.ref = Parameter(Tensor(np.ones(ref_shape, dtype)), name="ref")
[all …]
Dtest_ops_check.py22 from mindspore import Tensor
65 inp = Tensor(np.ones([1, 1, 32, 32]).astype(np.float32))
84 inp = Tensor(np.ones([1, 1, 32, 32]).astype(np.float32))
126 'desc_inputs': [Tensor(np.ones(shape=[1, 1, 6, 5]).astype(np.float32))]}),
129 'desc_inputs': [Tensor(np.ones(shape=[1, 1, 6, 5]).astype(np.float32))]}),
132 'desc_inputs': [Tensor(np.ones(shape=[1, 1, 6, 5]).astype(np.float32))]}),
135 'desc_inputs': [Tensor(np.ones(shape=[1, 1, 6, 5]).astype(np.float32))]}),
137 … 'block': nn.Conv2d(1, 6, 5, has_bias=True, bias_init=Tensor(np.ones([6]).astype(np.float32))),
138 'desc_inputs': [Tensor(np.ones(shape=[1, 1, 6, 5]).astype(np.float32))]}),
141 'desc_inputs': [Tensor(np.ones(shape=[1, 1, 6, 5]).astype(np.float32))]}),
[all …]
Dtest_tuple_slice.py19 from mindspore import Tensor
34 self.index_0 = Tensor(3)
35 self.index_1 = Tensor([5])
36 self.index_3 = Tensor([True])
57 self.step = Tensor([-1])
58 self.index_0 = Tensor(-6)
101 self.index_0 = Tensor([2, 3])
112 self.index_0 = Tensor([2.1])
121 'desc_inputs': [(Tensor(np.ones([2, 3, 4], np.int32)),
122 Tensor(np.zeros([2, 3, 4], np.int32)),
[all …]
/third_party/mindspore/mindspore/ccsrc/minddata/dataset/kernels/data/
Ddata_utils.h42 Status OneHotEncoding(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output, dsize_…
44 Status OneHotEncodingUnsigned(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output,
47 Status OneHotEncodingSigned(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output, …
55 Status Fill(const std::shared_ptr<Tensor> input, std::shared_ptr<Tensor> *output, std::shared_ptr<T…
65 void CastFrom(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output);
68 void Cast(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output);
70 Status ToFloat16(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output);
72 Status TypeCast(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output, const DataTy…
81 Status PadEnd(const std::shared_ptr<Tensor> &src, std::shared_ptr<Tensor> *dst, const std::vector<d…
82 const std::shared_ptr<Tensor> &pad_val);
[all …]
/third_party/mindspore/tests/st/ops/gpu/
Dtest_broadcast_op.py20 from mindspore.common.tensor import Tensor
36 output_ms = P.Minimum()(Tensor(x1_np), Tensor(x2_np))
40 output_ms = P.Maximum()(Tensor(x1_np), Tensor(x2_np))
44 output_ms = P.Greater()(Tensor(x1_np), Tensor(x2_np))
47 output_ms = P.Greater()(Tensor(x1_np_int32), Tensor(x2_np_int32))
51 output_ms = P.Less()(Tensor(x1_np), Tensor(x2_np))
54 output_ms = P.Less()(Tensor(x1_np_int32), Tensor(x2_np_int32))
58 output_ms = P.Pow()(Tensor(x1_np), Tensor(x2_np))
62 output_ms = P.RealDiv()(Tensor(x1_np), Tensor(x2_np))
66 output_ms = P.Mul()(Tensor(x1_np), Tensor(x2_np))
[all …]
Dtest_range_op.py21 from mindspore import Tensor
41 ms_out = range_net(Tensor(1000.04, mstype.float32),
42 Tensor(1001.04, mstype.float32),
43 Tensor(0.01, mstype.float32)).asnumpy()
48 ms_out = range_net(Tensor(100, mstype.float32),
49 Tensor(101, mstype.float32),
50 Tensor(0.001, mstype.float32)).asnumpy()
55 ms_out = range_net(Tensor(1, mstype.float32),
56 Tensor(8000, mstype.float32),
57 Tensor(0.01, mstype.float32)).asnumpy()
[all …]
/third_party/mindspore/mindspore/explainer/
D_operators.py51 _Idx = Union[int, mindspore.Tensor, Tuple[int, ...], Tuple[mindspore.Tensor, ...]]
54 Tensor = mindspore.Tensor variable
57 def absolute(inputs: Tensor) -> Tensor: argument
68 dtype: mindspore.dtype = None) -> Tensor:
71 nums = mindspore.Tensor(nums, dtype=dtype)
75 def argmax(inputs: Tensor, axis: int = -1, keep_dims: bool = False) -> Tensor: argument
83 return mindspore.Tensor(outputs, mindspore.int32)
86 def argmin(inputs: Tensor, axis: int = -1, keep_dims: bool = False) -> Tensor: argument
94 return mindspore.Tensor(outputs, mindspore.int32)
97 def argsort(inputs: Tensor, axis: int = -1, descending: bool = False) -> Tensor: argument
[all …]
/third_party/mindspore/tests/st/ops/cpu/
Dtest_cast_op.py21 from mindspore.common.tensor import Tensor
41 tensor_to_cast.append(Tensor(np.random.uniform(-2, 2, (3, 2)).astype(np.bool)))
42 tensor_to_cast.append(Tensor(np.random.uniform(-2, 2, (3, 2)).astype(np.float16)))
43 tensor_to_cast.append(Tensor(np.random.uniform(-2, 2, (3, 2)).astype(np.float32)))
44 tensor_to_cast.append(Tensor(np.random.uniform(-2, 2, (3, 2)).astype(np.float64)))
45 tensor_to_cast.append(Tensor(np.random.uniform(-2, 2, (3, 2)).astype(np.int8)))
46 tensor_to_cast.append(Tensor(np.random.uniform(-2, 2, (3, 2)).astype(np.int16)))
47 tensor_to_cast.append(Tensor(np.random.uniform(-2, 2, (3, 2)).astype(np.int32)))
48 tensor_to_cast.append(Tensor(np.random.uniform(-2, 2, (3, 2)).astype(np.int64)))
49 tensor_to_cast.append(Tensor(np.random.uniform(-2, 2, (3, 2)).astype(np.uint8)))
[all …]
/third_party/mindspore/tests/ut/python/ir/
Dtest_tensor.py27 from mindspore import Tensor, context
40 tensor_list = ms.Tensor(lst, ms.float32)
47 tensor_list = ms.Tensor(lst, ms.float32)
53 t1 = ms.Tensor(ndarr)
54 assert isinstance(t1, ms.Tensor)
57 t2 = ms.Tensor(np.zeros([1, 2, 3]), ms.float32)
58 assert isinstance(t2, ms.Tensor)
62 t3 = ms.Tensor(0.1)
63 assert isinstance(t3, ms.Tensor)
66 t4 = ms.Tensor(1)
[all …]
/third_party/mindspore/tests/ut/python/nn/
Dtest_loss.py20 from mindspore import Tensor
26 input_data = Tensor(np.array([[1, 2, 3], [2, 3, 4]]).astype(np.float32))
27 target_data = Tensor(np.array([[0, 2, 5], [3, 1, 1]]).astype(np.float32))
33 input_data = Tensor(np.array([[1, 2, 3], [2, 3, 2]]).astype(np.float32))
34 target_data = Tensor(np.array([[0, 0, 5], [1, 2, 3]]).astype(np.float32))
43 logits = Tensor(np.random.randint(0, 9, [100, 10]).astype(np.float32))
44 labels = Tensor(np.random.randint(0, 9, [100, 10]).astype(np.float32))
52 logits = Tensor(np.random.randint(0, 9, [100, 10]).astype(np.float32))
53 labels = Tensor(np.random.randint(0, 9, [100, 10]).astype(np.float32))
61 inputs_data = Tensor(np.array([[0.1, 0.2, 0.3], [0.5, 0.7, 0.9]]).astype(np.float32))
[all …]
Dtest_transformer.py18 from mindspore import Tensor
34 encoder_input_value = Tensor(np.ones((2, 20, 64)), dtype.float32)
35 encoder_input_mask = Tensor(np.ones((2, 20, 20)), dtype.float16)
51 encoder_input_value = Tensor(np.ones((2, 20, 64)), dtype.float32)
52 encoder_input_mask = Tensor(np.ones((2, 20, 20)), dtype.float16)
67 encoder_input_value = Tensor(np.ones((2, 20, 64)), dtype.float32)
68 encoder_input_mask = Tensor(np.ones((2, 20, 20)), dtype.float16)
83 encoder_input_value = Tensor(np.ones((2, 20, 64)), dtype.float32)
84 encoder_input_mask = Tensor(np.ones((2, 20, 20)), dtype.float16)
98 encoder_input_value = Tensor(np.ones((2, 20, 64)), dtype.float32)
[all …]
/third_party/mindspore/mindspore/lite/test/ut/src/runtime/
Druntime_pass_tests.cc24 extern void Nc4hw4PassAct(std::vector<kernel::LiteKernel *> *kernels, std::vector<Tensor *> *tensor…
33 void Nc4hw4PassConstruct(std::vector<kernel::LiteKernel *> *kernels, std::vector<lite::Tensor *> *t… in Nc4hw4PassConstruct()
37 lite::Tensor *conv_in_tensor = new lite::Tensor(kNumberTypeFloat32, {1, 1, 1, 1}, NHWC); in Nc4hw4PassConstruct()
39 lite::Tensor *conv_weight = new lite::Tensor(kNumberTypeFloat32, {1, 1, 1, 1}, NHWC); in Nc4hw4PassConstruct()
41 lite::Tensor *conv_out_tensor = new lite::Tensor(kNumberTypeFloat32, {1, 1, 1, 1}, NHWC); in Nc4hw4PassConstruct()
43 std::vector<lite::Tensor *> conv_in = {conv_in_tensor, conv_weight}; in Nc4hw4PassConstruct()
44 std::vector<lite::Tensor *> conv_out = {conv_out_tensor}; in Nc4hw4PassConstruct()
54 lite::Tensor *trans_param_tensor = new lite::Tensor(kNumberTypeFloat32, {1, 1, 1, 1}, NHWC); in Nc4hw4PassConstruct()
56 lite::Tensor *trans_out_tensor = new lite::Tensor(kNumberTypeFloat32, {1, 1, 1, 1}, NHWC); in Nc4hw4PassConstruct()
62 std::vector<lite::Tensor *> trans_in = {conv_out_tensor, trans_param_tensor}; in Nc4hw4PassConstruct()
[all …]
/third_party/mindspore/tests/ut/cpp/dataset/
Dfill_op_test.cc33 std::shared_ptr<Tensor> input; in TEST_F()
34 Tensor::CreateFromVector(labels, &input); in TEST_F()
36 std::shared_ptr<Tensor> fill_tensor; in TEST_F()
37 Tensor::CreateScalar<uint64_t>(4, &fill_tensor); in TEST_F()
39 std::shared_ptr<Tensor> output; in TEST_F()
44 std::shared_ptr<Tensor> expected; in TEST_F()
45 Tensor::CreateFromVector(out, &expected); in TEST_F()
60 std::shared_ptr<Tensor> input; in TEST_F()
61 Tensor::CreateFromVector(labels, &input); in TEST_F()
63 std::shared_ptr<Tensor> fill_tensor; in TEST_F()
[all …]
Dslice_op_test.cc33 std::shared_ptr<Tensor> input; in TEST_F()
34 Tensor::CreateFromVector(labels, &input); in TEST_F()
36 std::shared_ptr<Tensor> output; in TEST_F()
42 std::shared_ptr<Tensor> expected; in TEST_F()
43 Tensor::CreateFromVector(out, &expected); in TEST_F()
60 std::shared_ptr<Tensor> input; in TEST_F()
61 Tensor::CreateFromVector(labels, &input); in TEST_F()
63 std::shared_ptr<Tensor> output; in TEST_F()
69 std::shared_ptr<Tensor> expected; in TEST_F()
70 Tensor::CreateFromVector(out, &expected); in TEST_F()
[all …]
/third_party/mindspore/tests/syntax/simple_expression/
Dtest_assignment_ops.py19 from mindspore import Tensor, Parameter
39 x = Tensor(np.ones([3, 3]).astype(np.bool_))
40 y = Tensor(np.zeros([3, 3]).astype(np.bool_))
50 x = Tensor(np.ones([3, 3]).astype(np.int8))
51 y = Tensor(np.zeros([3, 3]).astype(np.int8))
61 x = Tensor(np.ones([3, 3]).astype(np.uint8))
62 y = Tensor(np.zeros([3, 3]).astype(np.uint8))
72 x = Tensor(np.ones([3, 3]).astype(np.int16))
73 y = Tensor(np.zeros([3, 3]).astype(np.int16))
83 x = Tensor(np.ones([3, 3]).astype(np.uint16))
[all …]
/third_party/mindspore/tests/ut/python/nn/gradient/
Dtest_jvp_pynative.py21 from mindspore import Tensor
47 x = Tensor(np.array([[1, 2], [3, 4]]).astype(np.float32))
48 v = Tensor(np.array([[1, 1], [1, 1]]).astype(np.float32))
54 x = Tensor(np.array([[1, 2], [3, 4]]).astype(np.float32))
55 v = Tensor(np.array([[1, 2], [3, 4]]).astype(np.float32))
61 x = Tensor(np.array([[1, 2], [3, 4]]).astype(np.float32))
62 v = Tensor(np.array([[1, 1], [1, 1]]).astype(np.float32))
68 x = Tensor(np.array([[1, 2], [3, 4]]).astype(np.float32))
69 v = Tensor(np.array([[1, 2], [3, 4]]).astype(np.float32))
75 x = Tensor(np.array([[1, 2], [3, 4]]).astype(np.float32))
[all …]
Dtest_jvp_graph.py21 from mindspore import Tensor
48 x = Tensor(np.array([[1, 2], [3, 4]]).astype(np.float32))
49 v = Tensor(np.array([[1, 1], [1, 1]]).astype(np.float32))
55 x = Tensor(np.array([[1, 2], [3, 4]]).astype(np.float32))
56 v = Tensor(np.array([[1, 2], [3, 4]]).astype(np.float32))
62 x = Tensor(np.array([[1, 2], [3, 4]]).astype(np.float32))
63 v = Tensor(np.array([[1, 1], [1, 1]]).astype(np.float32))
69 x = Tensor(np.array([[1, 2], [3, 4]]).astype(np.float32))
70 v = Tensor(np.array([[1, 2], [3, 4]]).astype(np.float32))
76 x = Tensor(np.array([[1, 2], [3, 4]]).astype(np.float32))
[all …]
/third_party/mindspore/tests/st/auto_monad/
Dtest_effect_optimizer.py18 from mindspore import context, Tensor
45 var = Tensor(np.ones([3, 3, 3]).astype(np.float32))
46 m = Tensor(np.ones([3, 3, 3]).astype(np.float32))
47 v = Tensor(np.ones([3, 3, 3]).astype(np.float32))
50 beta1_power = Tensor(0.9, mstype.float32)
51 beta2_power = Tensor(0.999, mstype.float32)
52 lr = Tensor(0.001, mstype.float32)
53 beta1 = Tensor(0.9, mstype.float32)
54 beta2 = Tensor(0.999, mstype.float32)
55 epsilon = Tensor(1e-8, mstype.float32)
[all …]
/third_party/mindspore/mindspore/lite/src/
Dlite_mindrt.h44 class LiteOpActor : public OpActor<lite::Tensor> {
46 …explicit LiteOpActor(kernel::LiteKernel *kernel) : OpActor<lite::Tensor>(kernel->name()), kernel_(… in LiteOpActor()
62 …void RunOpData(OpData<lite::Tensor> *input_data, OpContext<lite::Tensor> *context = nullptr) overr…
85 void SetOutputData(OpContext<Tensor> *context);
86 void AsyncOutput(OpContext<Tensor> *context);
94 std::vector<OpDataPtr<Tensor>> outputs_data_{};
95 std::vector<Tensor *> inputs_data_{};
96 …std::unordered_map<Tensor *, Tensor *> isolate_input_map_{}; /* <calculate-tensor, src-input-tens…
99 void ReplaceNodeInTensor(kernel::LiteKernel *kernel, Tensor *old_tensor, Tensor *new_tensor);
101 void MoveTensorInputData(Tensor *dst_tensor, Tensor *src_tensor);
[all …]
/third_party/mindspore/tests/st/gradient/
Dtest_jvp_graph.py21 from mindspore import Tensor
51 x = Tensor(np.array([[1, 2], [3, 4]]).astype(np.float32))
52 v = Tensor(np.array([[1, 1], [1, 1]]).astype(np.float32))
54 expect_primal = Tensor(np.array([[1, 8], [27, 64]]).astype(np.float32))
55 expect_grad = Tensor(np.array([[3, 12], [27, 48]]).astype(np.float32))
65 x = Tensor(np.array([[1, 2], [3, 4]]).astype(np.float32))
66 v = Tensor(np.array([[1, 2], [3, 4]]).astype(np.float32))
68 expect_primal = Tensor(np.array([[1, 8], [27, 64]]).astype(np.float32))
69 expect_grad = Tensor(np.array([[3, 24], [81, 192]]).astype(np.float32))
79 x = Tensor(np.array([[1, 2], [3, 4]]).astype(np.float32))
[all …]

12345678910>>...112