Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Microsoft/CNTK into tix_f…
Browse files Browse the repository at this point in the history
…ixRestoredTestFailures
  • Loading branch information
TJ committed Jun 26, 2018
2 parents 52101bf + 38dc974 commit ede74e8
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 2 deletions.
20 changes: 20 additions & 0 deletions Source/CNTKv2LibraryDll/proto/onnx/ONNXToCNTK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2699,6 +2699,26 @@ FunctionPtr ONNXToCNTKHelper::CreateFunction(const Node *node, const std::vector
FunctionPtr cntkFunction = Alias(inputs[0], ToWString(node->Name()));
return cntkFunction;
}
else if (onnxOpName == "Sin")
{
FunctionPtr cntkFunction = Sin(inputs[0], ToWString(node->Name()));
return cntkFunction;
}
else if (onnxOpName == "Asin")
{
FunctionPtr cntkFunction = Asin(inputs[0], ToWString(node->Name()));
return cntkFunction;
}
else if (onnxOpName == "Cos")
{
FunctionPtr cntkFunction = Cos(inputs[0], ToWString(node->Name()));
return cntkFunction;
}
else if (onnxOpName == "Acos")
{
FunctionPtr cntkFunction = Acos(inputs[0], ToWString(node->Name()));
return cntkFunction;
}
else
{
LogicError("ONNX (%s) is not supported in CNTK", onnxOpName.c_str());
Expand Down
14 changes: 13 additions & 1 deletion Source/CNTKv2LibraryDll/proto/onnx/Operators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,18 @@ namespace ONNX
{ L"axis ", "axis" },
{ L"broadcast", "broadcast" },
} } },
{ L"Cos",{ {
{ L"Cos", "Cos" },
} } },
{ L"Sin",{ {
{ L"Sin", "Sin" },
} } },
{ L"Acos",{ {
{ L"Acos", "Acos" },
} } },
{ L"Asin",{ {
{ L"Asin", "Asin" },
} } },

// From reduction
{ L"ReduceElements", { {
Expand Down Expand Up @@ -385,7 +397,7 @@ namespace ONNX
} } },
{ L"Alias",{ {
{ L"Alias", "Identity" },
} } },
} } },
};

// given a cntkOpName and cntk attribute OpName which is saved in CNTK::Function's attribute,
Expand Down
5 changes: 5 additions & 0 deletions Tests/EndToEndTests/TestDriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,8 @@ def runCommand(args):
sys.stdout.write("Running test {0} ({1} {2}{3}) - ".format(test.fullName, flavor, device, pyTestLabel));
if args.dry_run:
print("[SKIPPED] (dry-run)")
continue

# in verbose mode, terminate the line, since there will be a lot of output
if args.verbose:
sys.stdout.write("\n");
Expand Down Expand Up @@ -803,6 +805,9 @@ def runCommand(args):
if not result.succeeded and not args.verbose and result.logFile:
print(" See log file for details: " + result.logFile)

if args.dry_run:
sys.exit(1)

if args.update_baseline:
print("{0}/{1} baselines updated, {2} failed".format(succeededCount, totalCount, totalCount - succeededCount))
else:
Expand Down
29 changes: 28 additions & 1 deletion bindings/python/cntk/tests/onnx_op_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,6 @@ def test_Sub(tmpdir, dtype):
verify_no_input(model, tmpdir, 'Sub_0')

#Tanh

@pytest.mark.parametrize("dtype", DType_Config)
def test_Tanh(tmpdir, dtype):
with C.default_options(dtype = dtype):
Expand Down Expand Up @@ -1195,3 +1194,31 @@ def test_Select(flag, if_true, if_false, tmpdir):

model = C.element_select(flag, if_true, if_false_var)
verify_one_input(model, if_false, tmpdir, 'Select_1_if_false')

# Cos
@pytest.mark.parametrize("dtype", DType_Config)
def test_Cos(tmpdir, dtype):
data = np.asarray([0.0, -0.5, 0.5, 10, 20], dtype)
model = C.cos(data)
verify_no_input(model, tmpdir, 'Cos_0')

# Sin
@pytest.mark.parametrize("dtype", DType_Config)
def test_Sin(tmpdir, dtype):
data = np.asarray([0.0, -0.5, 0.5, 10, 20], dtype)
model = C.sin(data)
verify_no_input(model, tmpdir, 'Sin_0')

# Acos
@pytest.mark.parametrize("dtype", DType_Config)
def test_Arccos(tmpdir, dtype):
data = np.asarray([0.0, -0.5, 0.5, 1, -1], dtype)
model = C.acos(data)
verify_no_input(model, tmpdir, 'Acos_0')

# Asin
@pytest.mark.parametrize("dtype", DType_Config)
def test_Sin(tmpdir, dtype):
data = np.asarray([0.0, -0.5, 0.5, 1, -1], dtype)
model = C.asin(data)
verify_no_input(model, tmpdir, 'Asin_0')

0 comments on commit ede74e8

Please sign in to comment.