text stringlengths 0 2.2M |
|---|
if (runtime_kind == runtime_kind::sycl)
|
return sycl::get_engine_factory(kind);
|
#endif
|
return nullptr;
|
}
|
} // namespace impl
|
} // namespace dnnl
|
using namespace dnnl::impl;
|
using namespace dnnl::impl::status;
|
using namespace dnnl::impl::utils;
|
size_t dnnl_engine_get_count(engine_kind_t kind) {
|
auto ef = get_engine_factory(kind, get_default_runtime(kind));
|
return ef != nullptr ? ef->count() : 0;
|
}
|
status_t dnnl_engine_create(
|
engine_t **engine, engine_kind_t kind, size_t index) {
|
if (engine == nullptr) return invalid_arguments;
|
auto ef = get_engine_factory(kind, get_default_runtime(kind));
|
if (ef == nullptr || index >= ef->count()) return invalid_arguments;
|
return ef->engine_create(engine, index);
|
}
|
status_t dnnl_engine_get_kind(engine_t *engine, engine_kind_t *kind) {
|
if (engine == nullptr) return invalid_arguments;
|
*kind = engine->kind();
|
return success;
|
}
|
status_t dnnl_engine_destroy(engine_t *engine) {
|
#ifdef DNNL_USE_RT_OBJECTS_IN_PRIMITIVE_CACHE
|
if (engine != nullptr) engine->release();
|
#else
|
delete engine;
|
#endif
|
return success;
|
}
|
// vim: et ts=4 sw=4 cindent cino+=l0,\:4,N-s
|
/*
|
* Copyright (c) Facebook, Inc. and its affiliates. * All rights reserved.
|
*
|
* This source code is licensed under the MIT-style license found in the
|
* LICENSE file in the root directory of this source tree.
|
*/
|
#include "flashlight/pkg/vision/models/Resnet50Backbone.h"
|
namespace fl {
|
namespace pkg {
|
namespace vision {
|
Resnet50Backbone::Resnet50Backbone()
|
: backbone_(std::make_shared<Sequential>()),
|
tail_(std::make_shared<Sequential>()) {
|
backbone_->add(ConvFrozenBatchNormActivation(3, 64, 7, 7, 2, 2));
|
// maxpool -> 112x122x64 -> 56x56x64
|
backbone_->add(Pool2D(3, 3, 2, 2, -1, -1, PoolingMode::MAX));
|
// conv2_x -> 56x56x64 -> 56x56x64
|
backbone_->add(ResNetBottleneckStageFrozenBatchNorm(64, 64, 3, 1));
|
// conv3_x -> 56x56x64 -> 28x28x128
|
backbone_->add(ResNetBottleneckStageFrozenBatchNorm(64 * 4, 128, 4, 2));
|
// conv4_x -> 28x28x128 -> 14x14x256
|
backbone_->add(ResNetBottleneckStageFrozenBatchNorm(128 * 4, 256, 6, 2));
|
// conv5_x -> 14x14x256 -> 7x7x256
|
backbone_->add(ResNetBottleneckStageFrozenBatchNorm(256 * 4, 512, 3, 2));
|
tail_->add(Pool2D(7, 7, 1, 1, 0, 0, fl::PoolingMode::AVG_EXCLUDE_PADDING));
|
tail_->add(
|
ConvFrozenBatchNormActivation(512 * 4, 1000, 1, 1, 1, 1, false, false));
|
tail_->add(View({1000, -1}));
|
tail_->add(LogSoftmax());
|
add(backbone_);
|
add(tail_);
|
}
|
std::vector<Variable> Resnet50Backbone::forward(
|
const std::vector<Variable>& input) {
|
const auto& features = module(0)->forward(input);
|
const auto& output = module(1)->forward(features);
|
return {output[0], features[0]};
|
}
|
std::string Resnet50Backbone::prettyString() const {
|
return "Resnet50Backbone";
|
}
|
} // namespace vision
|
} // namespace pkg
|
} // namespace fl
|
#include "PrecompiledHeaders.h"
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.