Home
last modified time | relevance | path

Searched refs:grads (Results 1 – 25 of 104) sorted by relevance

12345

/third_party/mindspore/tests/ut/python/pynative_mode/
Dtest_bprop.py47 grads = bprop(Net(), Tensor(np.ones([2, 3]).astype(np.float32)),
49 print(grads)
53grads = bprop(Net(), Tensor(np.ones([2, 3]).astype(np.float32)), Tensor(np.ones([3, 2]).astype(np.…
56 print(grads)
60grads = bprop(Net(), Tensor(np.ones([2, 3]).astype(np.float32)), Tensor(np.ones([3, 2]).astype(np.…
63 print(grads)
68grads = bprop(net, Tensor(np.ones([2, 3]).astype(np.float32)), Tensor(np.ones([3, 2]).astype(np.fl…
73 print(grads)
78grads = bprop(net, Tensor(np.ones([2, 3]).astype(np.float32)), Tensor(np.ones([3, 2]).astype(np.fl…
81 print(grads)
[all …]
/third_party/mindspore/mindspore/nn/optim/
Dada_grad.py156 def construct(self, grads): argument
159 grads = self.decay_weight(grads)
160 grads = self.gradients_centralization(grads)
161 grads = self.scale_grad(grads)
165 grads)
168 grads)
Dproximal_ada_grad.py183 def construct(self, grads): argument
186 grads = self.decay_weight(grads)
187 grads = self.gradients_centralization(grads)
188 grads = self.scale_grad(grads)
189 grads = self._grad_sparse_indices_deduplicate(grads)
193 lr, grads, params, accum)
197 grads, params, accum)
Dftrl.py222 def construct(self, grads): argument
226 grads = self.decay_weight(grads)
227 grads = self.gradients_centralization(grads)
228 grads = self.scale_grad(grads)
229 grads = self._grad_sparse_indices_deduplicate(grads)
234 linear, grads, params, moments, self.ps_parameters, self.cache_enable)
/third_party/mindspore/tests/st/networks/
Dtest_cell_bprop.py128 grads = grad_all(self.f)(x, y)
129 return out[1][0], grads[1]
140 grads = grad_all(grad_in_bprop)(Tensor(np.ones([2, 2]).astype(np.float32)),
142 assert (grads[0].asnumpy() == np.ones([2, 2]).astype(np.float32)).all()
143 assert (grads[1].asnumpy() == np.zeros([2, 2]).astype(np.float32)).all()
169 grads = grad_all(self.f)(x, y)
170 return out[1][0], grads[1]
181 grads = grad_all(grad_in_bprop)(Tensor(np.ones([2, 2]).astype(np.float32)),
183 assert (grads[0].asnumpy() == np.ones([2, 2]).astype(np.float32)).all()
184 assert (grads[1].asnumpy() == np.array([[2, 2], [2, 2]]).astype(np.float32)).all()
[all …]
/third_party/mindspore/mindspore/nn/wrap/
Dloss_scale.py323 grads = self.grad(self.network, weights)(*inputs, scaling_sens_filled)
324 grads = self.hyper_map(F.partial(_grad_scale, scaling_sens), grads)
326 grads = self.grad_reducer(grads)
329 cond = self.get_overflow_status(status, grads)
333 loss = F.depend(loss, self.optimizer(grads))
505 grads = self.grad(self.network, weights)(*inputs, scaling_sens_filled)
506 init = F.depend(init, grads)
512 grads = self.grad_reducer(grads)
513grads = self.hyper_map(F.partial(shard_grad_scale, scaling_sens * self.degree), grads, self.accu_g…
516grads = self.hyper_map(F.partial(grad_scale, scaling_sens * self.degree), grads, accu_grads)
[all …]
Dcell_wrapper.py182 grads = self.grad(self.network_with_loss, weights)(*inputs)
184 grads = self.grad(self.network_with_loss, weights)(*inputs, self.sens)
185 return grads
277 grads = self.grad(self.network, self.weights)(*grad_inputs)
279 grads = self.grad(self.network)(*grad_inputs)
280 return loss, grads
355 grads = self.grad(self.network, self.weights)(*inputs, sens)
356 grads = self.grad_reducer(grads)
357 loss = F.depend(loss, self.optimizer(grads))
514 grads = self.grad(self.network, weights)(*inputs, sens)
[all …]
Dgrad_reducer.py396 def construct(self, grads): argument
408 datatypes = self.map_(F.partial(_get_datatype), grads)
409 grads = self.map_(F.partial(_cast_datatype, mstype.float32), grads)
411 new_grad = grads
415 self.op_list, self.allreduce_filter, grads, self.ps_parameters)
418 self.op_list, self.allreduce_filter, grads)
422 … self.allreduce), self.allreduce_filter, grads, self.ps_parameters)
425 self.allreduce), self.allreduce_filter, grads)
/third_party/mindspore/mindspore/boost/
Dboost_cell_wrapper.py200 grads = self.grad(self.network, self.weights)(*inputs, sens)
201 grads = self.grad_reducer(grads)
203 loss = self.gradient_accumulation_process(loss, grads)
206 loss = F.depend(loss, self.adasum_process(loss, grads))
208 loss = F.depend(loss, self.optimizer(grads))
226 def gradient_accumulation_process(self, loss, grads): argument
229 self.grad_accumulation, grads))
244 def adasum_process(self, loss, grads): argument
246 loss = F.depend(loss, self.optimizer(grads))
379 grads = self.grad(self.network, weights)(*inputs, scaling_sens_filled)
[all …]
/third_party/mindspore/tests/
Dtrain_step_wrap.py39 grads = self.grad(self.network, weights)(x, label)
40 return self.optimizer(grads)
79 grads = self.grad(self.network, weights)(x, self.sens)
80 return self.optimizer(grads)
99 grads = self.grad(self.network, self.weights)(x, label)
100 return grads
/third_party/mindspore/tests/st/networks/models/bert/src/
Dbert_for_pre_training.py310 grads = self.grad(self.network, weights)(input_ids,
319 grads = self.hyper_map(F.partial(clip_grad, GRADIENT_CLIP_TYPE, GRADIENT_CLIP_VALUE), grads)
322 grads = self.grad_reducer(grads)
324 self.optimizer(grads)
408 grads = self.grad(self.network, weights)(input_ids,
418 grads = self.grad_reducer(grads)
419 grads = self.hyper_map(F.partial(grad_scale, scaling_sens * self.degree), grads)
420 grads = self.hyper_map(F.partial(clip_grad, GRADIENT_CLIP_TYPE, GRADIENT_CLIP_VALUE), grads)
421 init = F.depend(init, grads)
435 self.optimizer(grads)
/third_party/mindspore/tests/st/ops/ascend/test_tbe_ops/
Dtest_resize_nearest_neighbor_grad.py44 def construct(self, images, grads): argument
45 return self.grad(self.network)(images, grads)
50 grads = np.random.random(size=(32, 3, 2, 2)).astype(np.float32)
52 output = grad(Tensor(image), Tensor(grads))
/third_party/mindspore/tests/st/fl/cross_silo_lenet/src/
Dcell_wrapper.py38 grads = self.grad(self.network, self.weights)(*inputs, sens)
39 grads = self.grad_reducer(grads)
40 loss = self.depend(loss, self.optimizer(grads))
/third_party/mindspore/tests/ut/python/nn/
Dtest_nn_pad.py41 def construct(self, x, grads): argument
42 return self.grad(self.network)(x, grads)
49 grads = np.random.random(size=(4, 7)).astype(np.float32)
51 output = grad(Tensor(x), Tensor(grads))
/third_party/mindspore/tests/st/fl/albert/src/
Dcell_wrapper.py120 grads, argument
125 return grads
127 for grad in grads:
260 grads = self.grad(self.network, weights)(input_ids,
266 grads = self.hyper_map(F.partial(clip_grad, self.clip_type, self.clip_value), grads)
267 loss = F.depend(loss, self.optimizer(grads))
291 grads = self.grad(self.network, weights)(input_ids,
297 grads = self.hyper_map(F.partial(clip_grad, self.clip_type, self.clip_value), grads)
298 self.optimizer(grads)
/third_party/mindspore/mindspore/lite/src/runtime/kernel/arm/fp32_grad/
Dsoftmax_cross_entropy_with_logits.cc32 …ropyWithLogitsCPUKernel::ForwardPostExecute(const float *labels, const float *logits, float *grads, in ForwardPostExecute() argument
35 if (grads != nullptr) { in ForwardPostExecute()
41 grads[i * param_->number_of_classes_ + j] = in ForwardPostExecute()
67 float *grads = nullptr; in Execute() local
69 grads = reinterpret_cast<float *>(out_tensors_.at(1)->data()); in Execute()
78 ForwardPostExecute(labels, losses_, grads, out); in Execute()
/third_party/mindspore/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/infer/
Dsoftmax_cross_entropy_infer.c36 TensorC *grads = outputs[1]; in SoftmaxCrossEntropyInferShape() local
37 SetShapeTensor(grads, in0); in SoftmaxCrossEntropyInferShape()
38 SetDataTypeFormat(grads, in0); in SoftmaxCrossEntropyInferShape()
/third_party/mindspore/tests/st/control/inner/
Dtest_231_while_for_while.py55 grads = self.grad(self.forward_net)(*inputs)
56 return grads
74 grads = backward_net(x, y)
75 print("grads:", grads)
/third_party/mindspore/mindspore/ccsrc/pybind_api/ir/
Dprimitive_py.cc93 py::tuple grads; in check_bprop_out() local
95 grads = py::make_tuple(grads_obj); in check_bprop_out()
97 grads = py::cast<py::tuple>(grads_obj); in check_bprop_out()
100 if (grads.size() != py_args.size() - filter_args_size) { in check_bprop_out()
101 MS_EXCEPTION(TypeError) << "For user define net bprop, the gradients number: " << grads.size() in check_bprop_out()
105 for (size_t i = 0; i < grads.size(); i++) { in check_bprop_out()
107 if (!py::isinstance<tensor::Tensor>(grads[i])) { in check_bprop_out()
110 … << py::cast<std::string>(grads[i].attr("__class__").attr("__name__")) in check_bprop_out()
111 << ", and the value is " << py::cast<py::str>(grads[i]) << "."; in check_bprop_out()
115 py::object grad_dtype = grads[i].attr("dtype"); in check_bprop_out()
[all …]
/third_party/mindspore/tests/ut/python/parallel/
Dtest_loss_scale.py96 grads = self.grad(self.network, weights)(x, self.cast(scaling_sens, mstype.float32))
98 grads = self.grad_reducer(grads)
99 grads = self.hyper_map(F.partial(clip_grad, GRADIENT_CLIP_TYPE, GRADIENT_CLIP_VALUE), grads)
100 init = F.depend(init, grads)
109 self.optimizer(grads)
/third_party/mindspore/tests/st/auto_monad/
Dtest_auto_monad_mindtester.py201 grads = grad_net(Tensor(x), Tensor(y), Tensor(x), Tensor(input_data))
202 allclose_nparray(x * 2, grads[0].asnumpy(), 0.0000, 0.0000)
203 allclose_nparray(y * 3, grads[1].asnumpy(), 0.0000, 0.0000)
204 allclose_nparray(x, grads[2].asnumpy(), 0.0000, 0.0000)
205 allclose_nparray(input_data * 5.1, grads[3].asnumpy(), 0.0000, 0.0000)
234 grads = self.grad(x, y)
236 grads = self.grad(x, y)
237 return grads[0] * 2, grads[1] * 2
250 grads = grad_net(input1, input2)
251 allclose_nparray(input1.asnumpy() * 2, grads[1].asnumpy(), 0, 0)
[all …]
/third_party/mindspore/mindspore/ccsrc/backend/kernel_compiler/gpu/nn/
Dctcloss_gpu_kernel.h45 grads(nullptr), in CtcLossGpuKernel()
131 grads = GetDeviceAddress<T>(outputs, 1); in LaunchInit()
163 MemsetForWS(label_value_pcr, cum_labels_length, label_squence_length, costs, grads, stream); in LaunchFirstHalf()
214 sequence_length, label_squence_length, cum_labels_length, costs, grads, prob_num, in LaunchSecondHalf()
236 …tForWS(int *label_value_pcr, int *cum_labels_length, int *label_squence_length, T *costs, T *grads, in MemsetForWS() argument
251 …cudaMemsetAsync(grads, static_cast<T>(0), probs_dims_[0] * probs_dims_[1] * probs_dims_[2] * sizeo… in MemsetForWS()
299 T *grads; variable
/third_party/mindspore/tests/st/fl/cross_silo_faster_rcnn/src/
Dnetwork_define.py147grads = self.grad(self.network, weights)(x, img_shape, gt_bboxe, gt_label, gt_num, self.sens)
149 grads = self.grad_reducer(grads)
150 return F.depend(loss, self.optimizer(grads))
/third_party/mindspore/tests/st/fl/hybrid_lenet/src/
Dcell_wrapper.py157 grads = self.grad(self.network, weights)(*inputs, sens)
158 grads = self.grad_reducer(grads)
160 loss = F.depend(loss, self.optimizer(grads))
/third_party/mindspore/tests/ut/python/ops/
Dtest_momentum.py67 def construct(self, grads): argument
73 grads, weights, moments)
89 grads = grad_by_list(self.network, weights)(x, label)
90 return self.optimizer(grads)

12345