Browse Source

!27463 fix complie and st on mac

Merge pull request !27463 from xulei/fix_mac_dataset
tags/v1.6.0
i-robot Gitee 4 years ago
parent
commit
df82abf9b3
6 changed files with 1166 additions and 1167 deletions
  1. +1
    -1
      mindspore/ccsrc/debug/anf_ir_dump.h
  2. +4
    -0
      mindspore/ccsrc/minddata/dataset/audio/kernels/audio_utils.cc
  3. +1
    -7
      mindspore/ccsrc/pipeline/pynative/pynative_execute.cc
  4. +1157
    -1157
      mindspore/dataset/audio/transforms.py
  5. +1
    -0
      mindspore/dataset/audio/utils.py
  6. +2
    -2
      mindspore/dataset/engine/datasets.py

+ 1
- 1
mindspore/ccsrc/debug/anf_ir_dump.h View File

@@ -30,7 +30,7 @@ auto constexpr kDumpConfigLineLevel1 = "LINE_LEVEL1";
auto constexpr kDumpConfigLineLevel2 = "LINE_LEVEL2";
auto constexpr kDumpConfigDisableBackend = "DISABLE_BACKEND";
auto constexpr kDumpConfigEnablePassIR = "ENABLE_PASS_IR";
typedef struct {
typedef struct DumpConfig {
LocDumpMode dump_line_level = kInValid;
bool disable_backend_dump = false;
bool enable_dump_pass_ir = false;


+ 4
- 0
mindspore/ccsrc/minddata/dataset/audio/kernels/audio_utils.cc View File

@@ -1206,6 +1206,9 @@ Status Hann(std::shared_ptr<Tensor> *output, int len) {
}

Status Kaiser(std::shared_ptr<Tensor> *output, int len, float beta = 12.0) {
#ifdef __APPLE__
return Status(StatusCode::kMDNotImplementedYet, "For macOS, Kaiser window is not supported.");
#else
CHECK_FAIL_RETURN_UNEXPECTED(len != 0, "Kaiser: len can not be zero.");
RETURN_IF_NOT_OK(Tensor::CreateEmpty(TensorShape({len}), DataType(DataType::DE_FLOAT32), output));
// Kaiser window function.
@@ -1216,6 +1219,7 @@ Status Kaiser(std::shared_ptr<Tensor> *output, int len, float beta = 12.0) {
std::cyl_bessel_i(0, beta * std::sqrt(1 - std::pow(i * twice / (len)-1.0, TWO))) / std::cyl_bessel_i(0, beta);
}
return Status::OK();
#endif
}

Status Window(std::shared_ptr<Tensor> *output, WindowType window_type, int len) {


+ 1
- 7
mindspore/ccsrc/pipeline/pynative/pynative_execute.cc View File

@@ -910,12 +910,6 @@ bool IsPyObjTypeInvalid(const py::object &obj) {
!py::isinstance<py::int_>(obj) && !py::isinstance<py::float_>(obj);
}

inline bool IsNopPrim(const std::string &op_name) {
static std::set<std::string> nop_prim = {prim::kPrimReshape->name(), kExpandDimsOpName, prim::kPrimSqueeze->name(),
prim::kPrimFlatten->name(), kFlattenGradOpName, prim::kPrimReformat->name()};
return nop_prim.find(op_name) != nop_prim.end();
}

// Shallow Copy Value and change shape
ValuePtr ShallowCopyValue(const OpExecInfoPtr &op_exec_info, const ValuePtr &value) {
MS_EXCEPTION_IF_NULL(op_exec_info);
@@ -1053,7 +1047,7 @@ OpExecInfoPtr ForwardExecutor::GenerateOpExecInfo(const py::args &args) {
const auto &op_exec_info = std::make_shared<OpExecInfo>();
const auto &op_name = py::cast<std::string>(args[PY_NAME]);
op_exec_info->op_name = op_name;
op_exec_info->is_nop_prim = false; // IsNopPrim(op_exec_info->op_name);
op_exec_info->is_nop_prim = false;

const auto &adapter = py::cast<PrimitivePyAdapterPtr>(args[PY_PRIM]);
MS_EXCEPTION_IF_NULL(adapter);


+ 1157
- 1157
mindspore/dataset/audio/transforms.py
File diff suppressed because it is too large
View File


+ 1
- 0
mindspore/dataset/audio/utils.py View File

@@ -174,6 +174,7 @@ class WindowType(str, Enum):
- WindowType.HAMMING: means the type of window function is hamming.
- WindowType.HANN: means the type of window function is hann.
- WindowType.KAISER: means the type of window function is kaiser.
Currently kaiser window is not supported on macOS.
"""
BARTLETT: str = "bartlett"
BLACKMAN: str = "blackman"


+ 2
- 2
mindspore/dataset/engine/datasets.py View File

@@ -84,8 +84,8 @@ try:
except ModuleNotFoundError:
context = None

if platform.system().lower() == "darwin":
multiprocessing.set_start_method("fork")
if platform.system().lower() == "darwin" and multiprocessing.get_start_method() != "fork":
multiprocessing.set_start_method("fork", True)

class Shuffle(str, Enum):
GLOBAL: str = "global"


Loading…
Cancel
Save