forked from mindspore-Ecosystem/mindspore
update python version to 3.8
This commit is contained in:
parent
3945bdcabb
commit
f1e05c5fc4
|
@ -2,14 +2,16 @@
|
|||
function(find_required_package pkg_name)
|
||||
find_package(${pkg_name})
|
||||
if(NOT ${pkg_name}_FOUND)
|
||||
message(FATAL_ERROR "Required package ${pkg_name} not found, please install the package and try building MindSpore again.")
|
||||
message(FATAL_ERROR "Required package ${pkg_name} not found, "
|
||||
"please install the package and try building MindSpore again.")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(find_required_program prog_name)
|
||||
find_program(${prog_name}_EXE ${prog_name})
|
||||
if(NOT ${prog_name}_EXE)
|
||||
message(FATAL_ERROR "Required program ${prog_name} not found, please install the package and try building MindSpore again.")
|
||||
message(FATAL_ERROR "Required program ${prog_name} not found, "
|
||||
"please install the package and try building MindSpore again.")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
@ -22,7 +24,7 @@ if (Python3_FOUND)
|
|||
message("Python3 library path: ${Python3_LIBRARY}")
|
||||
message("Python3 interpreter: ${Python3_EXECUTABLE}")
|
||||
elseif(Python3_LIBRARY AND Python3_EXECUTABLE AND
|
||||
${Python3_VERSION} VERSION_GREATER_EQUAL "3.7.0" AND ${Python3_VERSION} VERSION_LESS "3.8.0")
|
||||
${Python3_VERSION} VERSION_GREATER_EQUAL "3.7.0" AND ${Python3_VERSION} VERSION_LESS "3.8.9")
|
||||
message(WARNING "Maybe python3 environment is broken.")
|
||||
message("Python3 library path: ${Python3_LIBRARY}")
|
||||
message("Python3 interpreter: ${Python3_EXECUTABLE}")
|
||||
|
@ -39,7 +41,8 @@ else ()
|
|||
find_package(Patch)
|
||||
endif()
|
||||
if(NOT Patch_FOUND)
|
||||
message(FATAL_ERROR "Patch not found, please set environment variable MS_PATCH_PATH to path where Patch is located, "
|
||||
message(FATAL_ERROR "Patch not found, "
|
||||
"please set environment variable MS_PATCH_PATH to path where Patch is located, "
|
||||
"usually found in GIT_PATH/usr/bin on Windows")
|
||||
endif()
|
||||
message(PATCH_EXECUTABLE = ${Patch_EXECUTABLE})
|
||||
|
|
|
@ -1,9 +1,27 @@
|
|||
set(PYTHON_VERSION ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR})
|
||||
|
||||
if(ENABLE_GITEE)
|
||||
if(PYTHON_VERSION MATCHES "3.8")
|
||||
set(REQ_URL "https://gitee.com/mirrors/pybind11/repository/archive/v2.6.1.tar.gz")
|
||||
set(MD5 "dcbb02cc2da9653ec91860bb0594c91d")
|
||||
elseif(PYTHON_VERSION MATCHES "3.7")
|
||||
set(REQ_URL "https://gitee.com/mirrors/pybind11/repository/archive/v2.4.3.tar.gz")
|
||||
set(MD5 "b473a37987ce456ea8cc7aab3f9486f9")
|
||||
else()
|
||||
message("Could not find 'Python 3.8' or 'Python 3.7'")
|
||||
return()
|
||||
endif()
|
||||
else()
|
||||
if(PYTHON_VERSION MATCHES "3.8")
|
||||
set(REQ_URL "https://github.com/pybind/pybind11/archive/v2.6.1.tar.gz")
|
||||
set(MD5 "32a7811f3db423df4ebfc731a28e5901")
|
||||
elseif(PYTHON_VERSION MATCHES "3.7")
|
||||
set(REQ_URL "https://github.com/pybind/pybind11/archive/v2.4.3.tar.gz")
|
||||
set(MD5 "62254c40f89925bb894be421fe4cdef2")
|
||||
else()
|
||||
message("Could not find 'Python 3.8' or 'Python 3.7'")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
set(pybind11_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
|
||||
set(pybind11_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
|
||||
|
|
|
@ -7,8 +7,8 @@ endif ()
|
|||
set(PYTHON ${Python3_EXECUTABLE})
|
||||
set(PYTHON_VERSION ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR})
|
||||
|
||||
if (NOT PYTHON_VERSION MATCHES "3.7")
|
||||
message(FATAL_ERROR "FIND PYTHON VERSION ${PYTHON_VERSION} BUT CAN NOT MATCH PYTHON VERSION 3.7")
|
||||
if(NOT (PYTHON_VERSION MATCHES "3.8" OR PYTHON_VERSION MATCHES "3.7"))
|
||||
message(FATAL_ERROR "FIND PYTHON VERSION ${PYTHON_VERSION} BUT CAN NOT MATCH PYTHON VERSION 3.8 OR 3.7")
|
||||
endif()
|
||||
|
||||
find_package(Git)
|
||||
|
@ -24,26 +24,32 @@ set(MS_PACK_ROOT_DIR ${MS_ROOT_DIR}/build/package)
|
|||
|
||||
# set package file name
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
if (PYTHON_VERSION MATCHES "3.7")
|
||||
if(PYTHON_VERSION MATCHES "3.8")
|
||||
set(PY_TAGS "cp38-cp38")
|
||||
elseif(PYTHON_VERSION MATCHES "3.7")
|
||||
set(PY_TAGS "cp37-cp37m")
|
||||
else()
|
||||
message("Could not find 'Python 3.7'")
|
||||
message("Could not find 'Python 3.8' or 'Python 3.7'")
|
||||
return()
|
||||
endif()
|
||||
string(TOLOWER linux_${CMAKE_HOST_SYSTEM_PROCESSOR} PLATFORM_TAG)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
if (PYTHON_VERSION MATCHES "3.7")
|
||||
if(PYTHON_VERSION MATCHES "3.8")
|
||||
set(PY_TAGS "py38-none")
|
||||
elseif(PYTHON_VERSION MATCHES "3.7")
|
||||
set(PY_TAGS "py37-none")
|
||||
else()
|
||||
message("Could not find 'Python 3.7'")
|
||||
message("Could not find 'Python 3.8' or 'Python 3.7'")
|
||||
return()
|
||||
endif()
|
||||
set(PLATFORM_TAG "any")
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
if (PYTHON_VERSION MATCHES "3.7")
|
||||
if(PYTHON_VERSION MATCHES "3.8")
|
||||
set(PY_TAGS "cp38-cp38")
|
||||
elseif(PYTHON_VERSION MATCHES "3.7")
|
||||
set(PY_TAGS "cp37-cp37m")
|
||||
else()
|
||||
message("Could not find 'Python 3.7'")
|
||||
message("Could not find 'Python 3.8' or 'Python 3.7'")
|
||||
return()
|
||||
endif()
|
||||
set(PLATFORM_TAG "win_amd64")
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
"""Parameter for cell."""
|
||||
from copy import copy
|
||||
import numbers
|
||||
import numpy as np
|
||||
from .._c_expression import ParamInfo
|
||||
from . import dtype as mstype
|
||||
from .initializer import initializer
|
||||
|
@ -154,12 +155,17 @@ class Parameter(Tensor_):
|
|||
self._cast_type = None
|
||||
self._unique = False
|
||||
self.is_in_parallel = _is_in_parallel_mode()
|
||||
if isinstance(default_input, Tensor):
|
||||
if isinstance(default_input, (Tensor_, Tensor)):
|
||||
Tensor_.__init__(self, default_input.dtype, default_input.shape)
|
||||
elif isinstance(default_input, int):
|
||||
Tensor_.__init__(self, mstype.int64, ())
|
||||
elif isinstance(default_input, float):
|
||||
Tensor_.__init__(self, mstype.float32, ())
|
||||
elif isinstance(default_input, np.ndarray):
|
||||
Tensor_.__init__(self, default_input)
|
||||
else:
|
||||
raise TypeError(f"Parameter input must be [`Tensor`, `Number`]."
|
||||
f"But with type {type(default_input)}.")
|
||||
|
||||
def __deepcopy__(self, memodict):
|
||||
new_obj = Parameter(self)
|
||||
|
|
|
@ -395,7 +395,7 @@ def _clear_handler(logger):
|
|||
logger.removeHandler(handler)
|
||||
|
||||
|
||||
def _find_caller(stack_info=False):
|
||||
def _find_caller(stack_info=False, stacklevel=1):
|
||||
"""
|
||||
Find the stack frame of the caller.
|
||||
|
||||
|
|
Loading…
Reference in New Issue