Exemple #1
0
 void fp_compute() override {
   if (m_value == EvalType(0)) {
     El::Zero(get_activations());
   } else {
     El::Fill(get_activations(), m_value);
   }
 }
bool t_spectra::is_candidate (const t_candidate & candidate,
                              const t_spectra_filter * filter) const {
    t_spectra_iterator it(get_component_count(),
                          get_transaction_count(),
                          filter);


    while (it.transaction.next()) {
        bool hit = false;

        if (!is_error(it.transaction.get())) // TODO: Improve performance by maintaining a filter of all failing transactions

            continue;

        BOOST_FOREACH(t_component_id c, candidate) {
            if (get_activations(c, it.transaction.get())) {
                hit = true;
                break;
            }
        }

        if (!hit)
            return false;
    }

    return true;
}
Exemple #3
0
  void fp_compute() override {

    // Get input and output dimensions
    auto input_dims = get_input_dims();
    auto output_dims = get_output_dims();
    while (input_dims.size() < 3) { input_dims.insert(input_dims.begin(), 1); }
    while (output_dims.size() < 3) { output_dims.insert(output_dims.begin(), 1); }

    // Get input and output data
    auto& output = get_activations();
    const auto& input = get_prev_activations();
    m_input_v->Empty(false);
    m_input_v->AlignWith(output);
    if (m_input_v->DistData() == input.DistData()) {
      El::LockedView(*m_input_v, input);
    } else {
      El::Copy(input, *m_input_v);
    }
    const auto& local_input = m_input_v->LockedMatrix();

    // Apply tessellation
    /// @todo Support >3 dimensions
    if (input_dims.size() > 3) {
      LBANN_ERROR("tessellate layer currently only supports 3D tensors");
    }
    fp_compute_3d(input_dims, output_dims, local_input, output);

  }
Exemple #4
0
std::ostream & t_count_spectra::print (std::ostream & out,
                                       const t_spectra_filter * filter) const {
    if (filter) {
        assert(filter->get_last_component() <= get_component_count());
        assert(filter->get_last_transaction() <= get_transaction_count());
    }

    t_spectra_iterator it(get_component_count(),
                          get_transaction_count(),
                          filter);
    out << "Tr |";

    while (it.next_component())
        out << std::setw(3) << it.get_component() << "|";

    out << "|Err (q)\n";

    while (it.next_transaction()) {
        out << std::setw(3) << it.get_transaction() << "|";

        while (it.next_component())
            out << std::setw(3) << get_activations(it.get_component(), it.get_transaction()) << "|";

        out << "| " << is_error(it.get_transaction()) << "(" << get_error(it.get_transaction()) << ")\n";
    }

    return out;
}
Exemple #5
0
std::ostream & t_count_spectra::write (std::ostream & out,
                                       const t_spectra_filter * filter) const {
    if (filter) {
        assert(filter->get_last_component() <= get_component_count());
        assert(filter->get_last_transaction() <= get_transaction_count());
    }

    t_spectra_iterator it(get_component_count(),
                          get_transaction_count(),
                          filter);
    out << get_component_count(filter) << " " << get_transaction_count(filter) << "\n";

    while (it.next_transaction()) {
        while (it.next_component())
            out << get_activations(it.get_component(), it.get_transaction()) << " ";

        out << " " << get_error(it.get_transaction()) << "\n";
    }

    return out;
}
bool t_spectra::is_active (t_component_id component,
                           t_transaction_id transaction) const {
    return get_activations(component, transaction) > 0;
}