// Deserialize region Region::Region(const std::string& name, const std::string& nodeType, const Dimensions& dimensions, BundleIO& bundle, Network * network) : name_(name), type_(nodeType), initialized_(false), enabledNodes_(NULL), network_(network) { // Set region info before creating the RegionImpl so that the // Impl has access to the region info in its constructor. RegionImplFactory & factory = RegionImplFactory::getInstance(); spec_ = factory.getSpec(nodeType); // Dimensions start off as unspecified, but if // the RegionImpl only supports a single node, we // can immediately set the dimensions. if (spec_->singleNodeOnly) if (!dimensions.isDontcare() && !dimensions.isUnspecified() && !dimensions.isOnes()) NTA_THROW << "Attempt to deserialize region of type " << nodeType << " with dimensions " << dimensions << " but region supports exactly one node."; dims_ = dimensions; impl_ = factory.deserializeRegionImpl(nodeType, bundle, this); createInputsAndOutputs_(); }
bool Dimensions::operator==(const Dimensions& dims2) const { if ((std::vector<size_t>)(*this) == (std::vector<size_t>)dims2) return true; if (isOnes() && dims2.isOnes()) return true; return false; }