Browse Source

!1413 adapte Second order optimization ops

Merge pull request !1413 from jjfeing/master
tags/v0.5.0-beta
mindspore-ci-bot Gitee 6 years ago
parent
commit
fcb33834d2
3 changed files with 22 additions and 1 deletions
  1. +1
    -0
      mindspore/ops/_op_impl/__init__.py
  2. +16
    -0
      mindspore/ops/_op_impl/_custom_op/__init__.py
  3. +5
    -1
      mindspore/ops/op_info_register.py

+ 1
- 0
mindspore/ops/_op_impl/__init__.py View File

@@ -19,5 +19,6 @@ from .aicpu import *
if "Windows" not in platform.system():
from .akg.gpu import *
from .tbe import *
from ._custom_op import *

__all__ = []

+ 16
- 0
mindspore/ops/_op_impl/_custom_op/__init__.py View File

@@ -0,0 +1,16 @@
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================

"""custom ops"""

+ 5
- 1
mindspore/ops/op_info_register.py View File

@@ -23,6 +23,7 @@ from mindspore._checkparam import Validator as validator

# path of built-in op info register.
BUILT_IN_OPS_REGISTER_PATH = "mindspore/ops/_op_impl"
BUILT_IN_CUSTOM_OPS_REGISTER_PATH = "mindspore/ops/_op_impl/_custom_op"


def op_info_register(op_info):
@@ -47,7 +48,10 @@ def op_info_register(op_info):
op_lib = Oplib()
file_path = os.path.realpath(inspect.getfile(func))
# keep the path custom ops implementation.
imply_path = "" if BUILT_IN_OPS_REGISTER_PATH in file_path else file_path
if BUILT_IN_CUSTOM_OPS_REGISTER_PATH in file_path:
imply_path = file_path
else:
imply_path = "" if BUILT_IN_OPS_REGISTER_PATH in file_path else file_path
if not op_lib.reg_op(op_info_real, imply_path):
raise ValueError('Invalid op info {}:\n{}\n'.format(file_path, op_info_real))



Loading…
Cancel
Save