Commit 7a569557 authored by Jaikrishnan Menon's avatar Jaikrishnan Menon

WIP

parent 8f8da2d6
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://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
// ----------------------------------------------------------------------------
#include <typeindex>
#include <typeinfo>
#include <unordered_set>
#include "ngraph/node.hpp"
#include "ngraph/ops/avg_pool.hpp"
#include "ngraph/ops/convolution.hpp"
#include "ngraph/ops/max_pool.hpp"
#include "mkldnn_utils.hpp"
namespace ngraph
{
namespace runtime
{
namespace cpu
{
namespace MKLDNN
{
#define TI(x) std::type_index(typeid(x))
const std::unordered_set<std::type_index> OpRegistry{
TI(ngraph::op::Convolution),
TI(ngraph::op::AvgPool),
TI(ngraph::op::MaxPool),
};
bool IsMKLDNNOp(ngraph::Node& op)
{
return (OpRegistry.find(TI(op)) != OpRegistry.end());
}
mkldnn::memory::format CreateNativeDataFormat(const ngraph::runtime::cpu::LayoutDescriptor& layout)
{
switch(layout.get_shape().size())
{
case 1:
return mkldnn::memory::format::x;
case 2:
return mkldnn::memory::format::nc;
case 4:
return mkldnn::memory::format::nchw;
default:
return mkldnn::memory::format::format_undef;
}
}
}
}
}
}
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://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
// ----------------------------------------------------------------------------
#pragma once
#include <typeindex>
#include <typeinfo>
#include <unordered_set>
#include <mkldnn.hpp>
#include "ngraph/node.hpp"
#include "ngraph/runtime/cpu/cpu_layout_descriptor.hpp"
namespace ngraph
{
namespace runtime
{
namespace cpu
{
namespace MKLDNN
{
bool IsMKLDNNOp(ngraph::Node& op);
mkldnn::memory::format CreateNativeDataFormat(const ngraph::runtime::cpu::LayoutDescriptor& layout);
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment