!13599 [MSLITE] fix train issue strideslicegrad bug

From: @zhengjun10
Reviewed-by: @HilbertDavid,@ehaleva,@HilbertDavid
Signed-off-by: @HilbertDavid
This commit is contained in:
mindspore-ci-bot 2021-03-20 10:05:38 +08:00 committed by Gitee
commit cf32e8eeec
2 changed files with 12 additions and 1 deletions

View File

@ -81,7 +81,14 @@ int StridedSliceGradInferShape(const TensorC *const *inputs, size_t inputs_size,
ellipsis_mask_[i] = (bool)(param->ellipsisMask_) & (1 << i);
new_axis_mask_[i] = (bool)(param->newAxisMask_) & (1 << i);
}
param->num_axes_ = in_shape_size;
param->in_shape_length_ = in_shape_size;
for (int i = 0; i < ndim_; ++i) {
param->begins_[i] = begins_[i];
param->ends_[i] = ends_[i];
param->strides_[i] = strides_[i];
}
ShapeSet(param->in_shape_, &in_shape_size, input->shape_, input->shape_size_);
// ApplyNewAxisMask();
for (size_t i = 0; i < ndim_; i++) {
if (new_axis_mask_[i]) {

View File

@ -387,6 +387,10 @@ void TrainSession::CompileOptimizedKernels() {
}
int TrainSession::SetLearningRate(float learning_rate) {
if (learning_rate < 0.0f) {
MS_LOG(ERROR) << "learning rate should more than 0";
return RET_ERROR;
}
for (auto kernel : this->train_kernels_) {
if (IsOptimizer(kernel)) {
auto optimizer = reinterpret_cast<kernel::OptimizerKernel *>(kernel);