cavis/libnd4j/tests_cpu/layers_tests/OpTrackerTests.cpp

70 lines
2.0 KiB
C++
Raw Normal View History

2019-06-06 14:21:15 +02:00
/*******************************************************************************
* Copyright (c) 2015-2018 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://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.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
//
// Created by raver119 on 15.12.17.
//
#include "testlayers.h"
#include <graph/Graph.h>
2019-06-06 14:21:15 +02:00
#include <chrono>
#include <graph/Node.h>
2019-06-06 14:21:15 +02:00
#include <helpers/OpTracker.h>
#include <ops/declarable/CustomOperations.h>
using namespace sd;
using namespace sd::ops;
using namespace sd::graph;
2019-06-06 14:21:15 +02:00
class OpTrackerTests : public testing::Test {
public:
int numIterations = 10;
int poolSize = 10;
OpTrackerTests() {
printf("\n");
fflush(stdout);
}
};
TEST_F(OpTrackerTests, Test_Existence_1) {
sd::_loader loader;
2019-06-06 14:21:15 +02:00
// nd4j_printf("Groups: %i; Operations: %i\n", OpTracker::getInstance()->totalGroups(), OpTracker::getInstance()->totalOperations());
ASSERT_TRUE(OpTracker::getInstance()->totalGroups() > 0);
ASSERT_TRUE(OpTracker::getInstance()->totalOperations() > 0);
OpTracker::getInstance()->exportOperations();
}
TEST_F(OpTrackerTests, Test_Ops_List_1) {
sd::ops::less op;
2019-06-06 14:21:15 +02:00
auto vec = OpRegistrator::getInstance()->getAllHashes();
// nd4j_printf("Total ops: %lld\n", vec.size());
// nd4j_printf("Less hash: %lld\n", op.getOpHash());
for (const auto &v: vec) {
if (v == 5484196977525668316L) {
auto op = OpRegistrator::getInstance()->getOperation(v);
// nd4j_printf("OpName: %s\n", op->getOpName()->c_str());
}
}
}