/third_party/mindspore/tests/st/fl/albert/src/ |
D | assessment_method.py | 28 def update(self, logits, labels): argument 31 logits = logits.asnumpy() 32 logit_id = np.argmax(logits, axis=-1) 48 def update(self, logits, labels): argument 50 logits = logits.asnumpy() 51 sorted_index = logits.argsort() 70 def update(self, logits, labels): argument 73 logits = logits.asnumpy() 74 logits = np.argmax(logits, axis=1) 76 self.logits_array = np.concatenate([self.logits_array, logits]).astype(np.bool) [all …]
|
/third_party/mindspore/mindspore/nn/loss/ |
D | loss.py | 103 def construct(self, logits, labels): argument 117 def construct(self, logits, labels): argument 192 def construct(self, logits, labels): argument 193 _check_is_tensor('logits', logits, self.cls_name) 195 x = self.abs(logits - labels) 257 def construct(self, logits, labels): argument 258 _check_is_tensor('logits', logits, self.cls_name) 260 x = F.square(logits - labels) 309 def construct(self, logits, label): argument 310 rmse_loss = F.sqrt(self.MSELoss(logits, label)) [all …]
|
/third_party/mindspore/mindspore/ccsrc/backend/kernel_compiler/gpu/cuda_impl/ |
D | cross_entropy_impl.cu | 24 __global__ void CrossEntropyWithSparseKernel(const T *logits, const S *labels, const size_t batch_s… in CrossEntropyWithSparseKernel() argument 29 T logit = logits[i * class_num + labels[i]]; in CrossEntropyWithSparseKernel() 40 __global__ void LargeBatchCrossEntropyWithSparseKernel(const T *logits, const S *labels, const size… in LargeBatchCrossEntropyWithSparseKernel() argument 45 T logit = logits[index * class_num + labels[index]]; in LargeBatchCrossEntropyWithSparseKernel() 54 __global__ void CrossEntropyGradWithSparseKernel(const T *logits, const S *labels, const size_t bat… in CrossEntropyGradWithSparseKernel() argument 59 grad[j * class_num + i] = (logits[j * class_num + i] - 1) / batch_size; in CrossEntropyGradWithSparseKernel() 61 grad[j * class_num + i] = logits[j * class_num + i] / batch_size; in CrossEntropyGradWithSparseKernel() 68 __global__ void CrossEntropyKernel(const T *logits, const S *labels, const size_t batch_size, const… in CrossEntropyKernel() argument 75 losses[index] -= logf((logits[i] <= 0 ? epsilon : logits[i])) * labels[i]; in CrossEntropyKernel() 76 dlogits[i] = logits[i] - labels[i]; in CrossEntropyKernel() [all …]
|
D | sparse_cross_entropy_cuda_impl.cu | 22 __global__ void CalCrossEntropyKernel(const float *logits, T *labels, const int batch_size, const i… in CalCrossEntropyKernel() argument 27 float logit = logits[i * class_num + labels[i]]; in CalCrossEntropyKernel() 41 __global__ void CalCrossEntropyGradKernel(const float *logits, T *labels, const int batch_size, con… in CalCrossEntropyGradKernel() argument 46 grad[i * class_num + j] = (logits[i * class_num + j] - 1) / batch_size; in CalCrossEntropyGradKernel() 48 grad[i * class_num + j] = logits[i * class_num + j] / batch_size; in CalCrossEntropyGradKernel() 56 void CalCrossEntropy(const float *logits, T *labels, const int batch_size, const int class_num, flo… in CalCrossEntropy() argument 58 CalCrossEntropyKernel<<<1, 1, 0, cuda_stream>>>(logits, labels, batch_size, class_num, loss); in CalCrossEntropy() 63 void CalCrossEntropyGrad(const float *logits, T *labels, const int batch_size, const int class_num,… in CalCrossEntropyGrad() argument 65 …CalCrossEntropyGradKernel<<<GET_BLOCKS(class_num), GET_THREADS, 0, cuda_stream>>>(logits, labels, … in CalCrossEntropyGrad() 70 template void CalCrossEntropy<int>(const float *logits, int *labels, const int batch_size, const in… [all …]
|
D | sigmoid_cross_entropy_with_logits_impl.cu | 20 __global__ void SigmoidCrossEntropyWithLogitsKernel(const size_t size, const T *logits, const S *la… in SigmoidCrossEntropyWithLogitsKernel() argument 22 const T reverse_factor = static_cast<T>(logits[i] >= 0); in SigmoidCrossEntropyWithLogitsKernel() 24 …log1p(exp(logits[i] - static_cast<T>(2) * reverse_factor * logits[i])) - logits[i] * (labels[i] - … in SigmoidCrossEntropyWithLogitsKernel() 29 void SigmoidCrossEntropyWithLogits(const size_t size, const T *logits, const S *labels, T *outputs, in SigmoidCrossEntropyWithLogits() argument 31 …WithLogitsKernel<<<GET_BLOCKS(size), GET_THREADS, 0, cuda_stream>>>(size, logits, labels, outputs); in SigmoidCrossEntropyWithLogits() 34 template void SigmoidCrossEntropyWithLogits<float, float>(const size_t size, const float *logits, c… 36 template void SigmoidCrossEntropyWithLogits<double, double>(const size_t size, const double *logits,
|
D | sigmoid_cross_entropy_with_logits_grad_impl.cu | 20 __global__ void SigmoidCrossEntropyWithLogitsGradKernel(const size_t size, const T *logits, const S… in SigmoidCrossEntropyWithLogitsGradKernel() argument 23 if (logits[i] >= 0) { in SigmoidCrossEntropyWithLogitsGradKernel() 24 …outputs[i] = (static_cast<T>(1.) / (static_cast<T>(1.) + exp(-logits[i])) - labels[i]) * dout_addr… in SigmoidCrossEntropyWithLogitsGradKernel() 26 const T exp_val = exp(logits[i]); in SigmoidCrossEntropyWithLogitsGradKernel() 33 void SigmoidCrossEntropyWithLogitsGrad(const size_t size, const T *logits, const S *labels, const T… in SigmoidCrossEntropyWithLogitsGrad() argument 35 …ntropyWithLogitsGradKernel<<<GET_BLOCKS(size), GET_THREADS, 0, cuda_stream>>>(size, logits, labels, in SigmoidCrossEntropyWithLogitsGrad() 39 …mplate void SigmoidCrossEntropyWithLogitsGrad<float, float>(const size_t size, const float *logits, 42 …ate void SigmoidCrossEntropyWithLogitsGrad<double, double>(const size_t size, const double *logits,
|
/third_party/mindspore/tests/st/ops/graph_kernel/ |
D | test_sigmoid_cross_entropy_with_logits.py | 31 def construct(self, logits, labels): argument 32 return self.loss(logits, labels) 40 def construct(self, logits, labels, dout): argument 41 return self.sigmoid_cross_entropy_with_logits_grad(logits, labels, dout) 48 logits = Tensor(np.array([[1, 1, 2], 60 result_open_gk = sigmoid_cross_entropy_with_logits(logits, labels) 65 result_close_gk = sigmoid_cross_entropy_with_logits_beta(logits, labels) 74 logits = Tensor(np.array([[1, 1, 2], 87 result_open_gk = sigmoid_cross_entropy_with_logits_grad(logits, labels, dout) 92 result_close_gk = sigmoid_cross_entropy_with_logits_grad_beta(logits, labels, dout)
|
D | test_softmax_cross_entropy_with_logits.py | 30 def construct(self, logits, labels): argument 31 return self.loss(logits, labels) 38 logits = Tensor(np.array([[1, 1, 10], 48 result_open_gk = softmax_cross_entropy_with_logits(logits, labels) 53 result_close_gk = softmax_cross_entropy_with_logits_beta(logits, labels)
|
/third_party/mindspore/mindspore/parallel/nn/ |
D | loss.py | 94 def construct(self, logits, label, input_mask): argument 95 self._check_input(logits, label, input_mask) 98 logits = F.cast(logits, mstype.float32) 100 _, logit_max = self.max(logits) 101 logit_sub = self.sub(logits, logit_max) 111 one_hot_label = self.onehot(label, F.shape(logits)[-1], self.on_value, 127 def _check_input(self, logits, label, input_mask): argument 129 _check_is_tensor('logits', logits, self.cls_name) 132 … _check_input_dtype(F.dtype(logits), "logits", [mstype.float32, mstype.float16], self.cls_name) 135 _check_input_shape(F.shape(logits), "logits", self.cls_name, 2)
|
/third_party/mindspore/mindspore/_extends/graph_kernel/expanders/ |
D | sigmoid_cross_entropy_with_logits.py | 24 logits, labels = self.inputs 30 const_one = graph_builder.value(logits.dtype, 1.0) 31 const_zero = graph_builder.value(logits.dtype, 0.0) 32 max_logits = graph_builder.emit('Maximum', [logits, const_zero]) 33 logits_mul_labels = graph_builder.emit('Mul', [logits, labels]) 34 abs_logits = graph_builder.emit('Abs', [logits])
|
D | softmax_cross_entropy_with_logits.py | 25 logits, label = self.inputs 29 … max_x = graph_builder.emit('ReduceMax', [logits], attrs={'reduce_axis': axis, 'keep_dims': True}) 30 data_sub = graph_builder.emit('Sub', [logits, max_x]) 34 const_eps = graph_builder.value(logits.dtype, 0.000001)
|
/third_party/mindspore/tests/st/networks/models/deeplabv3/src/ |
D | deeplabv3.py | 389 logits = () 393 logits = self.deeplabv3(x) 396 logits = self.deeplabv3(x1) 397 logits = self.sample_common(logits) 398 logits = self.expand_dims(logits, 2) 404 logits = self.concat((logits, logits_i)) 405 logits = self.reduce_mean(logits, 2) 406 return logits 410 logits = self.deeplabv3(x1) 411 logits = self.sample_common(logits) [all …]
|
D | losses.py | 44 def construct(self, logits, labels): argument 45 logits = self.transpose(logits, (0, 2, 3, 1)) 46 logits = self.reshape(logits, (-1, self.num)) 50 losses = self.cross_entropy(logits, one_hot_labels)[0]
|
/third_party/mindspore/mindspore/lite/src/runtime/kernel/arm/fp32_grad/ |
D | sigmoid_cross_entropy_with_logits.cc | 39 auto logits = reinterpret_cast<float *>(in_tensors_.at(0)->MutableData()); in Execute() local 40 CHECK_NULL_RETURN(logits); in Execute() 52 if (logits[i] >= zero) { in Execute() 53 out[i] = log1pf(exp(logits[i] - two * logits[i])) - logits[i] * (labels[i] - one); in Execute() 55 out[i] = log1pf(exp(logits[i])) - logits[i] * labels[i]; in Execute()
|
/third_party/mindspore/tests/st/ops/gpu/ |
D | test_softmax_cross_entropy_with_logits_op.py | 29 def construct(self, logits, labels): argument 30 return self.loss(logits, labels) 37 logits = Tensor(np.array([[1, 1, 10], 47 output = softmax_cross_entropy_with_logits(logits, labels) 54 output = softmax_cross_entropy_with_logits(logits, labels)
|
D | test_sparse_softmax_cross_entropy_with_logits_op.py | 28 def construct(self, logits, labels): argument 29 return self.loss(logits, labels) 36 logits = Tensor(np.array([[1, 1, 10], 44 output = sparse_softmax_cross_entropy_with_logits(logits, labels) 51 output = sparse_softmax_cross_entropy_with_logits(logits, labels)
|
D | test_sigmoid_cross_entropy_with_logits_op.py | 30 def construct(self, logits, labels): argument 31 return self.loss(logits, labels) 35 logits = Tensor(np.array([[1, 1, 2], 49 output = net(logits, labels) 55 output = net(logits, labels)
|
D | test_sigmoid_cross_entropy_with_logits_grad_op.py | 30 def construct(self, logits, labels, dout): argument 31 return self.sigmoid_cross_entropy_with_logits_grad(logits, labels, dout) 35 logits = Tensor(np.array([[1, 1, 2], 51 output = net(logits, labels, dout) 57 output = net(logits, labels, dout)
|
/third_party/mindspore/tests/st/ops/cpu/ |
D | test_softmax_with_cross_entropy_op.py | 32 logits = Tensor(np.array([[1, 1, 10], 35 self.logits = Parameter(initializer(logits, logits.shape), name='logits') 41 return self.SoftmaxWithCrossEntropy(self.logits, self.labels)
|
D | test_softmax_cross_entropy_with_logits_op.py | 29 def construct(self, logits, labels): argument 30 return self.loss(logits, labels) 37 logits = Tensor(np.array([[1, 1, 10], 47 output = softmax_cross_entropy_with_logits(logits, labels)
|
D | test_sigmoid_cross_entropy_with_logits_op.py | 30 def construct(self, logits, labels): argument 31 return self.loss(logits, labels) 38 logits = Tensor(np.array([[1, 1, 2], 52 output = sigmoid_cross_entropy_with_logits(logits, labels)
|
/third_party/mindspore/tests/ut/python/pynative_mode/vm/ |
D | test_vm.py | 249 logits = 2.84806275 * np.ones([1, 10]).astype(np.float32) 250 y = vm.softmax(logits) 254 logits = np.array([[1, 2, 3], [4, 5, 6]]).astype(np.float32) 255 y = vm.softmax(logits, axis=1) 263 …logits = np.array([[1, 2, 3, 4, 2, 1, 0, 2, 1, 1], [1, 2, 4, 1, 0, 5, 0, 2, 1, 3]], dtype=np.float… 265 loss, dx = vm.softmax_cross_entropy_with_logits(logits, labels) 266 print("logits.shape: ", logits.shape) 267 print("logits: ", logits) 268 print("softmax: ", vm.softmax(logits))
|
/third_party/mindspore/tests/ut/cpp/python_input/gtest_input/pipeline/infer/ |
D | primitive_test.py | 39 def get_softmax_cross_entropy_with_logits(logits, labels): argument 40 return softmax_cross_entropy_with_logits(logits, labels) 50 def __call__(self, logits, labels): argument 64 def get_tensor_to_scalar(logits, labels): argument 65 return tensorToScalar(logits, labels)
|
/third_party/mindspore/tests/st/networks/models/bert/src/ |
D | cluener_evaluation.py | 48 logits = [] 50 logits.extend(ele) 51 ids = logits 53 logits = model.predict(input_ids, input_mask, token_type_id, Tensor(1)) 54 ids = logits.asnumpy()
|
/third_party/mindspore/mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/ |
D | softmax_cross_entropy_with_logits_cpu_kernel.cc | 66 void SoftmaxCrossEntropyWithLogitsCPUKernel::ForwardPostExecute(const float *logits, const float *l… in ForwardPostExecute() argument 73 float logit = logf(logits[i * class_num_ + j] <= 0.0 ? epsilon : logits[i * class_num_ + j]); in ForwardPostExecute() 74 output2[i * class_num_ + j] = logits[i * class_num_ + j] - labels[i * class_num_ + j]; in ForwardPostExecute() 101 const auto *logits = reinterpret_cast<float *>(workspace[0]->addr); in Launch() local 104 ForwardPostExecute(logits, labels, output1, output2); in Launch()
|