AzSortedFeat_Sparse & operator =(const AzSortedFeat_Sparse &inp) { /* never tested */ if (this == &inp) return *this; ia_zero.reset(&inp.ia_zero); ia_index.reset(&inp.ia_index); v_value.set(&inp.v_value); _shouldDoBackward = inp._shouldDoBackward; data_num = inp.data_num; return *this; }
void reset() { a_dense.free(&arrd); a_sparse.free(&arrs); f_num = 0; ia_isActive.reset(); active_num = 0; }
virtual void reset(const int *arr, int len) { ia_sz.reset(arr, len); }
virtual void reset(const AzIntArr *ia) { ia_sz.reset(ia); }
virtual void reset(const AzxD *inp) { ia_sz.reset(&inp->ia_sz); }
virtual void reset(int dim=0) { /* generate a unit size region */ ia_sz.reset(); if (dim == 0) return; ia_sz.reset(dim, 1); }
AzxD(const AzxD *inp) { ia_sz.reset(&inp->ia_sz); }
/*------------------------------------------------------------*/ void AzpCNet3_multi::insert_connectors(AzIntArr &ia_order, /* inout */ AzDataArr<AzIntArr> &aia_below, /* inout */ AzDataArr<AzIntArr> &aia_above, /* inout */ AzDataArr<AzpLayerConn> &conn) const { const char *eyec = "AzpCNet3_multi::insert_connectors"; int layer_num = ia_order.size(); /*--- count connectors to be inserted ---*/ int conn_num = 0; for (int lx = 0; lx < layer_num; ++lx) { if (aia_below[lx]->size() > 1) ++conn_num; if (aia_above[lx]->size() > 1) ++conn_num; } /*--- copy the current edges ---*/ AzDataArr<AzIntArr> aia_b(layer_num + conn_num); AzDataArr<AzIntArr> aia_a(layer_num + conn_num); conn.reset(layer_num + conn_num); for (int lx = 0; lx < layer_num; ++lx) { aia_b(lx)->reset(aia_below[lx]); aia_a(lx)->reset(aia_above[lx]); } /*--- insert connection where multiple input/output ---*/ AzIntArr ia_o; int cx = layer_num; for (int ix = 0; ix < ia_order.size(); ++ix) { int lx = ia_order.get(ix); if (aia_b[lx]->size() > 1) { /* multiple inputs */ aia_b(cx)->reset(aia_b[lx]); aia_a(cx)->put(lx); for (int ix = 0; ix < aia_b[cx]->size(); ++ix) { int below = aia_b[cx]->get(ix); int count = aia_a(below)->replace(lx, cx); AzX::throw_if((count != 1), eyec, "something is wrong"); } aia_b(lx)->reset(); aia_b(lx)->put(cx); ia_o.put(cx); ++cx; } ia_o.put(lx); if (aia_above[lx]->size() > 1) { aia_b(cx)->put(lx); aia_a(cx)->reset(aia_above[lx]); for (int ix = 0; ix < aia_a[cx]->size(); ++ix) { int above = aia_a[cx]->get(ix); int count = aia_b(above)->replace(lx, cx); AzX::throw_if((count != 1), eyec, "something is wrong-2"); } aia_a(lx)->reset(); aia_a(lx)->put(cx); ia_o.put(cx); ++cx; } } /*--- output ---*/ aia_below.reset(&aia_b); aia_above.reset(&aia_a); ia_order.reset(&ia_o); }
AzSortedFeat_Dense & operator =(const AzSortedFeat_Dense &inp) { /* never tested */ if (this == &inp) return *this; ia_index.reset(&inp.ia_index); v_dx2v = inp.v_dx2v; return *this; }