提交 4840a1f6 authored 作者: Benjamin Scellier's avatar Benjamin Scellier

remove definition of new API for older numpy

上级 bb429155
...@@ -2130,23 +2130,10 @@ class GCC_compiler(Compiler): ...@@ -2130,23 +2130,10 @@ class GCC_compiler(Compiler):
if march_flags and GCC_compiler.march_flags: if march_flags and GCC_compiler.march_flags:
cxxflags.extend(GCC_compiler.march_flags) cxxflags.extend(GCC_compiler.march_flags)
# NumPy 1.7 Deprecate the old API. I updated most of the places # NumPy 1.7 Deprecate the old API.
# to use the new API, but not everywhere. When finished, enable # The following macro asserts that we don't bring new code
# the following macro to assert that we don't bring new code
# that use the old API. # that use the old API.
cxxflags.append("-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION") cxxflags.append("-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION")
numpy_ver = [int(n) for n in numpy.__version__.split('.')[:2]]
# numpy 1.7 deprecated the following macro but the new one didn't
# existed in the past
if bool(numpy_ver < [1, 7]):
cxxflags.append("-DNPY_ARRAY_ENSUREARRAY=NPY_ENSUREARRAY")
cxxflags.append("-DNPY_ARRAY_ENSURECOPY=NPY_ENSURECOPY")
cxxflags.append("-DNPY_ARRAY_ALIGNED=NPY_ALIGNED")
cxxflags.append("-DNPY_ARRAY_WRITEABLE=NPY_WRITEABLE")
cxxflags.append("-DNPY_ARRAY_UPDATE_ALL=NPY_UPDATE_ALL")
cxxflags.append("-DNPY_ARRAY_C_CONTIGUOUS=NPY_C_CONTIGUOUS")
cxxflags.append("-DNPY_ARRAY_F_CONTIGUOUS=NPY_F_CONTIGUOUS")
# Platform-specific flags. # Platform-specific flags.
# We put them here, rather than in compile_str(), so they en up # We put them here, rather than in compile_str(), so they en up
......
...@@ -95,23 +95,11 @@ class NVCC_compiler(Compiler): ...@@ -95,23 +95,11 @@ class NVCC_compiler(Compiler):
os.path.join(os.path.split(__file__)[0], 'cuda_ndarray.cuh')) os.path.join(os.path.split(__file__)[0], 'cuda_ndarray.cuh'))
flags.append('-DCUDA_NDARRAY_CUH=' + cuda_ndarray_cuh_hash) flags.append('-DCUDA_NDARRAY_CUH=' + cuda_ndarray_cuh_hash)
# NumPy 1.7 Deprecate the old API. I updated most of the places # NumPy 1.7 Deprecate the old API.
# to use the new API, but not everywhere. When finished, enable # The following macro asserts that we don't bring new code
# the following macro to assert that we don't bring new code
# that use the old API. # that use the old API.
flags.append("-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION") flags.append("-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION")
# numpy 1.7 deprecated the following macro but the didn't
# existed in the past
numpy_ver = [int(n) for n in numpy.__version__.split('.')[:2]]
if bool(numpy_ver < [1, 7]):
flags.append("-DNPY_ARRAY_ENSURECOPY=NPY_ENSURECOPY")
flags.append("-DNPY_ARRAY_ALIGNED=NPY_ALIGNED")
flags.append("-DNPY_ARRAY_WRITEABLE=NPY_WRITEABLE")
flags.append("-DNPY_ARRAY_UPDATE_ALL=NPY_UPDATE_ALL")
flags.append("-DNPY_ARRAY_C_CONTIGUOUS=NPY_C_CONTIGUOUS")
flags.append("-DNPY_ARRAY_F_CONTIGUOUS=NPY_F_CONTIGUOUS")
# If the user didn't specify architecture flags add them # If the user didn't specify architecture flags add them
if not any(['-arch=sm_' in f for f in flags]): if not any(['-arch=sm_' in f for f in flags]):
# We compile cuda_ndarray.cu during import. # We compile cuda_ndarray.cu during import.
......
...@@ -4680,7 +4680,7 @@ class Reshape(Op): ...@@ -4680,7 +4680,7 @@ class Reshape(Op):
for i in xrange(self.ndim)])] for i in xrange(self.ndim)])]
def c_code_cache_version(self): def c_code_cache_version(self):
return (6,) return (7,)
def c_code(self, node, name, inputs, outputs, sub): def c_code(self, node, name, inputs, outputs, sub):
if isinstance(node.inputs[0], TensorVariable): if isinstance(node.inputs[0], TensorVariable):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论