0

構成ファイルのパラメーター化されたコンストラクターを持つクラス Feedforward があります。

public Feedforward(String cfg) throws Exception {

    super(cfg);
    String tempstr = "";
    int currNeuronNum = 0;
    int currEdgeNum = 0;
    int currLayerID = 0;
    int count = 0;

    if (!(type).equals("feedforward")) {
       throw new Exception("cfgError: specify proper type")
    //more code
    }

ここで、super(cfg) は Network クラスのコンストラクターを呼び出します。ここで、ファイルの解析とユニバーサル フィールドの格納を処理します。

protected Network(String cfgPath) throws IOException, Exception {

      String type;
      String activationFunction;
      double bias;
      /*file reading stuff; checked with print statements and during 
        the creation of a Feedforward class, successfully prints 
        "feedforward" after reading type from file
      */       
}

テストを実行すると、NullPointerException がスローされます。Feedforward の型変数には、cfgPath/cfg のファイルに保存されている値が割り当てられていないため、例外です。コンストラクター チェーンがこれを行わないのはなぜですか。

4

1 に答える 1