Like does this not work? ```cpp Layer::Layer(int size = 0, float bias = 0.0f) { this->neurons =

Like does this not work?
Layer::Layer(int size = 0, float bias = 0.0f) {
this->neurons = vector<Neuron>();
for (int i = 0; i < size; i++) {
this->neurons.push_back(Neuron(bias));
}
}
Layer::Layer(int size = 0, float bias = 0.0f) {
this->neurons = vector<Neuron>();
for (int i = 0; i < size; i++) {
this->neurons.push_back(Neuron(bias));
}
}
12 Replies
keith
keith•2y ago
It does, but the bias is still used if it's 0, as opposed to undefined
Dumb Bird
Dumb BirdOP•2y ago
Then I'm not sure you can really simplify it down But try this and see if it works, I don't actually have access to your code to try and run it but here ya go
Layer::Layer() : neurons(vector<Neuron>()) {}

Layer::Layer(int size) : neurons(vector<Neuron>(size)) {}

Layer::Layer(int size, float bias) : neurons(vector<Neuron>(size, Neuron(bias))) {}
Layer::Layer() : neurons(vector<Neuron>()) {}

Layer::Layer(int size) : neurons(vector<Neuron>(size)) {}

Layer::Layer(int size, float bias) : neurons(vector<Neuron>(size, Neuron(bias))) {}
Makes use of member initialization
keith
keith•2y ago
bro wtf
No description
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
keith
keith•2y ago
well thats the stupid thing its thinking im creating a new array with a size of 0
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
keith
keith•2y ago
i should... let me check there is very much an array already named argv
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
<Tim>
<Tim>•2y ago
huh that's weird 😂 can you send the code for context? 😅
keith
keith•2y ago
ParseResult initialize_options(int argc, char** argv) {
Options options(
std::filesystem::path(argv[0]).filename(),
"A simple hexdump utility\n"
);
ParseResult initialize_options(int argc, char** argv) {
Options options(
std::filesystem::path(argv[0]).filename(),
"A simple hexdump utility\n"
);
the parameters are passed in from the main functino Also, i think its important im compiling with -Wpedantic
<Tim>
<Tim>•2y ago
can't you just do ..path(*argv).filename though? :D
keith
keith•2y ago
i dont think so

Did you find this page helpful?