The
randomize
method is an overridable method and you calling it from the constructor, which is quite dangerous in Java. Methods which you call from the constructor shouldn't be overridable, i.e.:private
orfinal
orstatic
. Check this out Check this out.The precondition in the compute method would throw an exception if the input is
null
, so you can add an additional guard for that:Preconditions.checkNotNull(inputs);
At
#Layer(neurons,prevLayerNeurons)
, you're creating arrays based on the passed arguments. Are sure that the passed arguments are valid as an array length? Why don't you protect it?Preconditions.checkArgument(neurons > 0); Preconditions.checkArgument(prevLayerNeurons > 0);
The
randomize
method is an overridable method and you calling it from the constructor, which is quite dangerous in Java. Methods which you call from the constructor shouldn't be overridable, i.e.:private
orfinal
orstatic
. Check this out.The precondition in the compute method would throw an exception if the input is
null
, so you can add an additional guard for that:Preconditions.checkNotNull(inputs);
At
#Layer(neurons,prevLayerNeurons)
, you're creating arrays based on the passed arguments. Are sure that the passed arguments are valid as an array length? Why don't you protect it?Preconditions.checkArgument(neurons > 0); Preconditions.checkArgument(prevLayerNeurons > 0);
The
randomize
method is an overridable method and you calling it from the constructor, which is quite dangerous in Java. Methods which you call from the constructor shouldn't be overridable, i.e.:private
orfinal
orstatic
. Check this out.The precondition in the compute method would throw an exception if the input is
null
, so you can add an additional guard for that:Preconditions.checkNotNull(inputs);
At
#Layer(neurons,prevLayerNeurons)
, you're creating arrays based on the passed arguments. Are sure that the passed arguments are valid as an array length? Why don't you protect it?Preconditions.checkArgument(neurons > 0); Preconditions.checkArgument(prevLayerNeurons > 0);
The
randomize
method is an overridable method and you calling formit from the constructor, and thatswhich is quite dangerous inJava
Java. Methods which you call from the constructor shouldn't be overridable, iei.e.:private
orfinal
orstatic
. Check this out.The Preconditionprecondition in the compute method would throw an exception if the input is null
null
, so you can add andan additional guard for that.:Preconditions.checkNotNull(inputs);
At
#Layer(neurons,prevLayerNeurons)
, you're creating arrays based on the passed arguments. Are sure that the passed arguments are valid as an array length? Why don't you protect it?Preconditions.checkArgument(neurons > 0); Preconditions.checkArgument(prevLayerNeurons > 0);
At
#Layer(neurons,prevLayerNeurons)
you creating arrays based on the passed arguments, are sure that the passed arguments are valid as an array length?Why don't you protect itPreconditions.checkArgument(neurons > 0); Preconditions.checkArgument(prevLayerNeurons > 0);
randomize
method is an overridable method and you calling form the constructor, and thats quite dangerous inJava
. Methods which you call from the constructor shouldn't be overridable, ie:private
orfinal
orstatic
. Check this out.The Precondition in the compute method would throw an exception if the input is null, you can add and additional guard for that.
Preconditions.checkNotNull(inputs);
At
#Layer(neurons,prevLayerNeurons)
you creating arrays based on the passed arguments, are sure that the passed arguments are valid as an array length?Why don't you protect itPreconditions.checkArgument(neurons > 0); Preconditions.checkArgument(prevLayerNeurons > 0);
The
randomize
method is an overridable method and you calling it from the constructor, which is quite dangerous in Java. Methods which you call from the constructor shouldn't be overridable, i.e.:private
orfinal
orstatic
. Check this out.The precondition in the compute method would throw an exception if the input is
null
, so you can add an additional guard for that:Preconditions.checkNotNull(inputs);
At
#Layer(neurons,prevLayerNeurons)
, you're creating arrays based on the passed arguments. Are sure that the passed arguments are valid as an array length? Why don't you protect it?Preconditions.checkArgument(neurons > 0); Preconditions.checkArgument(prevLayerNeurons > 0);
randomize
method is an overridable method and you calling form the constructor, and thats quite dangerous inJava
. Methods which you call from the constructor shouldn't be overridable, ie:private
orfinal
orstatic
. Check this out.The Precondition in the compute method would throw an exception if the input is null, you can add and additional guard for that.
Preconditions.checkNotNull(inputs);
At
#Layer(neurons,prevLayerNeurons)
you creating arrays based on the passed arguments, are sure that the passed arguments are valid as an array length?Why don't you protect itPreconditions.checkArgument(neurons > 0); Preconditions.checkArgument(prevLayerNeurons > 0);
randomize
method is an overridable method and you calling form the constructor, and thats quite dangerous inJava
. Methods which you call from the constructor shouldn't be overridable, ie:private
orfinal
orstatic
. Check this out.The Precondition in the compute method would throw an exception if the input is null, you can add and additional guard for that.
Preconditions.checkNotNull(inputs);
randomize
method is an overridable method and you calling form the constructor, and thats quite dangerous inJava
. Methods which you call from the constructor shouldn't be overridable, ie:private
orfinal
orstatic
. Check this out.The Precondition in the compute method would throw an exception if the input is null, you can add and additional guard for that.
Preconditions.checkNotNull(inputs);
At
#Layer(neurons,prevLayerNeurons)
you creating arrays based on the passed arguments, are sure that the passed arguments are valid as an array length?Why don't you protect itPreconditions.checkArgument(neurons > 0); Preconditions.checkArgument(prevLayerNeurons > 0);