本文整理汇总了C++中Outputs类的典型用法代码示例。如果您正苦于以下问题:C++ Outputs类的具体用法?C++ Outputs怎么用?C++ Outputs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Outputs类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void PrepareDeferred::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs) {
auto args = renderContext->args;
auto primaryFramebuffer = inputs.get0();
auto lightingModel = inputs.get1();
if (!_deferredFramebuffer) {
_deferredFramebuffer = std::make_shared<DeferredFramebuffer>();
}
_deferredFramebuffer->updatePrimaryDepth(primaryFramebuffer->getDepthStencilBuffer());
outputs.edit0() = _deferredFramebuffer;
outputs.edit1() = _deferredFramebuffer->getLightingFramebuffer();
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setViewportTransform(args->_viewport);
batch.setStateScissorRect(args->_viewport);
// Clear deferred
auto deferredFbo = _deferredFramebuffer->getDeferredFramebuffer();
batch.setFramebuffer(deferredFbo);
// Clear Color, Depth and Stencil for deferred buffer
batch.clearFramebuffer(
gpu::Framebuffer::BUFFER_COLOR0 | gpu::Framebuffer::BUFFER_COLOR1 | gpu::Framebuffer::BUFFER_COLOR2 | gpu::Framebuffer::BUFFER_COLOR3 |
gpu::Framebuffer::BUFFER_DEPTH |
gpu::Framebuffer::BUFFER_STENCIL,
vec4(vec3(0), 0), 1.0, 0.0, true);
// For the rest of the rendering, bind the lighting model
batch.setUniformBuffer(LIGHTING_MODEL_BUFFER_SLOT, lightingModel->getParametersBuffer());
});
}
示例2: test_arrange_names
void OutputsTest::test_arrange_names(void) {
message += "test_arrange_names\n";
Outputs o;
Vector<std::string> names = o.arrange_names();
assert_true(names.size() == 0, LOG);
}
示例3: test_arrange_descriptions
void OutputsTest::test_arrange_descriptions(void) {
message += "test_arrange_descriptions\n";
Outputs o;
Vector<std::string> descriptions = o.arrange_descriptions();
assert_true(descriptions.size() == 0, LOG);
}
示例4: TIMER32_0_IRQHandler
extern "C" void TIMER32_0_IRQHandler(void)
{
digitalWrite(PIO3_3, ! digitalRead(PIO3_3)); // Run LED
if (timer32_0.flags () & 0x01)
{ // handle SET ports
relays.setOutputs();
}
if (timer32_0.flags () & 0x02)
{ // handle CLR ports
relays.clrOutputs();
}
timer32_0.resetFlags();
}
示例5: test_get_outputs_number
void OutputsTest::test_get_outputs_number(void) {
message += "test_get_outputs_number\n";
Outputs o;
// Test
o.set();
assert_true(o.get_outputs_number() == 0, LOG);
// Test
o.set(2);
assert_true(o.get_outputs_number() == 2, LOG);
}
示例6: test_from_XML
void OutputsTest::test_from_XML(void) {
message += "test_from_XML\n";
Outputs o;
tinyxml2::XMLDocument* document;
// Test
document = o.to_XML();
o.from_XML(*document);
delete document;
}
示例7: test_to_XML
void OutputsTest::test_to_XML(void) {
message += "test_to_XML\n";
Outputs o;
tinyxml2::XMLDocument* document;
// Test
document = o.to_XML();
assert_true(document != NULL, LOG);
delete document;
}
示例8: run
void ResolveNewFramebuffer::run(const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs) {
RenderArgs* args = renderContext->args;
auto srcFbo = inputs;
outputs.reset();
// Check valid src
if (!srcFbo) {
return;
}
// Check valid size for sr and dest
auto frameSize(srcFbo->getSize());
// Resizing framebuffers instead of re-building them seems to cause issues with threaded rendering
if (_outputFramebuffer && _outputFramebuffer->getSize() != frameSize) {
_outputFramebuffer.reset();
}
if (!_outputFramebuffer) {
_outputFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("resolvedNew.out"));
auto colorFormat = gpu::Element::COLOR_SRGBA_32;
auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR);
auto colorTexture = gpu::Texture::createRenderBuffer(colorFormat, frameSize.x, frameSize.y, gpu::Texture::SINGLE_MIP, defaultSampler);
_outputFramebuffer->setRenderBuffer(0, colorTexture);
}
gpu::Vec4i rectSrc;
rectSrc.z = frameSize.x;
rectSrc.w = frameSize.y;
gpu::doInBatch("ResolveNew", args->_context, [&](gpu::Batch& batch) { batch.blit(srcFbo, rectSrc, _outputFramebuffer, rectSrc); });
outputs = _outputFramebuffer;
}
示例9: addCalculation
void XNodeDefinition::addCalculation( CalculationFunction func,
const Inputs &in,
const Outputs &out )
{
Calculation calc;
calc.func = func;
calc.inputIDs = in;
calc.outputIDs = out;
XVector<InputID> inVec(in.toVector());
XVector<OutputID> outVec(out.toVector());
foreach(const InputID &input, inVec)
{
_inputMap[input] << outVec;
}
foreach(const OutputID &output, outVec)
{
_outputMap[output] << inVec;
}
_calculations << calc;
}
示例10: main
int main(void)
{
try
{
std::cout << "OpenNN. Yacht Resistance Design Application." << std::endl;
srand((unsigned)time(NULL));
// Data set
DataSet data_set;
data_set.set_data_file_name("../data/yachtresistance.dat");
data_set.load_data();
// Variables
Variables* variables_pointer = data_set.get_variables_pointer();
variables_pointer->set_name(0, "longitudinal_center_buoyancy");
variables_pointer->set_name(1, "prismatic_coefficient");
variables_pointer->set_name(2, "length_displacement_ratio");
variables_pointer->set_name(3, "beam_draught_ratio");
variables_pointer->set_name(4, "length_beam_ratio");
variables_pointer->set_name(5, "froude_number");
variables_pointer->set_name(6, "residuary_resistance");
const Matrix<std::string> inputs_information = variables_pointer->arrange_inputs_information();
const Matrix<std::string> targets_information = variables_pointer->arrange_targets_information();
// Instances
Instances* instances_pointer = data_set.get_instances_pointer();
instances_pointer->split_random_indices();
const Vector< Statistics<double> > inputs_statistics = data_set.scale_inputs_minimum_maximum();
const Vector< Statistics<double> > targets_statistics = data_set.scale_targets_minimum_maximum();
// Neural network
const size_t inputs_number = data_set.get_variables().count_inputs_number();
const size_t hidden_neurons_number = 30;
const size_t outputs_number = data_set.get_variables().count_targets_number();
NeuralNetwork neural_network(inputs_number, hidden_neurons_number, outputs_number);
Inputs* inputs = neural_network.get_inputs_pointer();
inputs->set_information(inputs_information);
Outputs* outputs = neural_network.get_outputs_pointer();
outputs->set_information(targets_information);
neural_network.construct_scaling_layer();
ScalingLayer* scaling_layer_pointer = neural_network.get_scaling_layer_pointer();
scaling_layer_pointer->set_statistics(inputs_statistics);
scaling_layer_pointer->set_scaling_method(ScalingLayer::NoScaling);
neural_network.construct_unscaling_layer();
UnscalingLayer* unscaling_layer_pointer = neural_network.get_unscaling_layer_pointer();
unscaling_layer_pointer->set_statistics(targets_statistics);
unscaling_layer_pointer->set_unscaling_method(UnscalingLayer::NoUnscaling);
// Performance functional
PerformanceFunctional performance_functional(&neural_network, &data_set);
// Training strategy
TrainingStrategy training_strategy(&performance_functional);
QuasiNewtonMethod* quasi_Newton_method_pointer = training_strategy.get_quasi_Newton_method_pointer();
quasi_Newton_method_pointer->set_maximum_iterations_number(1000);
quasi_Newton_method_pointer->set_reserve_performance_history(true);
quasi_Newton_method_pointer->set_display_period(100);
TrainingStrategy::Results training_strategy_results = training_strategy.perform_training();
// Testing analysis
TestingAnalysis testing_analysis(&neural_network, &data_set);
TestingAnalysis::LinearRegressionResults linear_regression_results = testing_analysis.perform_linear_regression_analysis();
// Save results
scaling_layer_pointer->set_scaling_method(ScalingLayer::MinimumMaximum);
unscaling_layer_pointer->set_unscaling_method(UnscalingLayer::MinimumMaximum);
//.........这里部分代码省略.........
示例11: main
int main(void)
{
try
{
std::cout << "OpenNN. Airfoil Self-Noise Application." << std::endl;
srand((unsigned)time(NULL));
// Data set
DataSet data_set;
#ifdef __APPLE__
data_set.set_data_file_name("../../../../data/airfoil_self_noise.dat");
#else
data_set.set_data_file_name("../data/airfoil_self_noise.dat");
#endif
data_set.set_separator("Tab");
data_set.load_data();
// Variables
Variables* variables_pointer = data_set.get_variables_pointer();
Vector< Variables::Item > variables_items(6);
variables_items[0].name = "frequency";
variables_items[0].units = "hertzs";
variables_items[0].use = Variables::Input;
variables_items[1].name = "angle_of_attack";
variables_items[1].units = "degrees";
variables_items[1].use = Variables::Input;
variables_items[2].name = "chord_length";
variables_items[2].units = "meters";
variables_items[2].use = Variables::Input;
variables_items[3].name = "free_stream_velocity";
variables_items[3].units = "meters per second";
variables_items[3].use = Variables::Input;
variables_items[4].name = "suction_side_displacement_thickness";
variables_items[4].units = "meters";
variables_items[4].use = Variables::Input;
variables_items[5].name = "scaled_sound_pressure_level";
variables_items[5].units = "decibels";
variables_items[5].use = Variables::Target;
variables_pointer->set_items(variables_items);
const Matrix<std::string> inputs_information = variables_pointer->arrange_inputs_information();
const Matrix<std::string> targets_information = variables_pointer->arrange_targets_information();
// Instances
Instances* instances_pointer = data_set.get_instances_pointer();
instances_pointer->split_random_indices();
const Vector< Statistics<double> > inputs_statistics = data_set.scale_inputs_minimum_maximum();
const Vector< Statistics<double> > targets_statistics = data_set.scale_targets_minimum_maximum();
// Neural network
const size_t inputs_number = variables_pointer->count_inputs_number();
const size_t hidden_perceptrons_number = 9;
const size_t outputs_number = variables_pointer->count_targets_number();
NeuralNetwork neural_network(inputs_number, hidden_perceptrons_number, outputs_number);
Inputs* inputs = neural_network.get_inputs_pointer();
inputs->set_information(inputs_information);
Outputs* outputs = neural_network.get_outputs_pointer();
outputs->set_information(targets_information);
neural_network.construct_scaling_layer();
ScalingLayer* scaling_layer_pointer = neural_network.get_scaling_layer_pointer();
scaling_layer_pointer->set_statistics(inputs_statistics);
scaling_layer_pointer->set_scaling_method(ScalingLayer::NoScaling);
neural_network.construct_unscaling_layer();
UnscalingLayer* unscaling_layer_pointer = neural_network.get_unscaling_layer_pointer();
unscaling_layer_pointer->set_statistics(targets_statistics);
unscaling_layer_pointer->set_unscaling_method(UnscalingLayer::NoUnscaling);
// Performance functional
//.........这里部分代码省略.........
示例12: main
int main(void)
{
try
{
int rank = 0;
#ifdef __OPENNN_MPI__
int size = 1;
MPI_Init(NULL,NULL);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
#endif
if(rank == 0)
{
std::cout << "OpenNN. Yacht Resistance Design Application." << std::endl;
}
srand((unsigned)time(NULL));
// Global variables
DataSet data_set;
NeuralNetwork neural_network;
LossIndex loss_index;
TrainingStrategy training_strategy;
// Local variables
DataSet local_data_set;
NeuralNetwork local_neural_network;
LossIndex local_loss_index;
TrainingStrategy local_training_strategy;
if(rank == 0)
{
// Data set
data_set.set_data_file_name("../data/yachtresistance.dat");
data_set.load_data();
// Variables
Variables* variables_pointer = data_set.get_variables_pointer();
variables_pointer->set_name(0, "longitudinal_center_buoyancy");
variables_pointer->set_name(1, "prismatic_coefficient");
variables_pointer->set_name(2, "length_displacement_ratio");
variables_pointer->set_name(3, "beam_draught_ratio");
variables_pointer->set_name(4, "length_beam_ratio");
variables_pointer->set_name(5, "froude_number");
variables_pointer->set_name(6, "residuary_resistance");
const Matrix<std::string> inputs_information = variables_pointer->arrange_inputs_information();
const Matrix<std::string> targets_information = variables_pointer->arrange_targets_information();
// Instances
Instances* instances_pointer = data_set.get_instances_pointer();
instances_pointer->split_random_indices();
const Vector< Statistics<double> > inputs_statistics = data_set.scale_inputs_minimum_maximum();
const Vector< Statistics<double> > targets_statistics = data_set.scale_targets_minimum_maximum();
// Neural network
const size_t inputs_number = data_set.get_variables().count_inputs_number();
const size_t hidden_neurons_number = 30;
const size_t outputs_number = data_set.get_variables().count_targets_number();
neural_network.set(inputs_number, hidden_neurons_number, outputs_number);
Inputs* inputs = neural_network.get_inputs_pointer();
inputs->set_information(inputs_information);
Outputs* outputs = neural_network.get_outputs_pointer();
outputs->set_information(targets_information);
neural_network.construct_scaling_layer();
ScalingLayer* scaling_layer_pointer = neural_network.get_scaling_layer_pointer();
scaling_layer_pointer->set_statistics(inputs_statistics);
scaling_layer_pointer->set_scaling_method(ScalingLayer::NoScaling);
//.........这里部分代码省略.........
示例13:
extern "C" void PIOINT0_IRQHandler (void)
{
LPC_GPIO_TypeDef* port = gpioPorts[0];
port->IC = 1<<5; // clear the interrupt
relays.zeroDetectHandler();
}