如何解决 Python 中的错误(“NoneType”对象不可订阅)(colab)

问题描述 投票:0回答:0

我是编程新手,最近一直在尝试通过(cross-sim)来计算ANN。但是我上周因以下错误问题而陷入困境。谁能帮我解决这个问题?

`> ---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-15-11c5a8b78c5d> in <cell line: 556>()
    574 
    575   ##### small images
--> 576   train_net.train(filename="/content/cross-sim/stp/output/0.01/small_images_lookup.txt", dataset="small", params=params, n_epochs=epochs)
    577   #train_net.plot_training([outdir+"small_images_lookup.txt"], dataset="small",plot_linear=False)
    578 

2 frames
<ipython-input-15-11c5a8b78c5d> in train(self, filename, dataset, params, scale_weights, params2, plot_weight_hist, n_epochs, seed, wtmodel)
    384         bp.indata = testdata
    385         bp.answers = testresult
--> 386         count, frac = bp.classify(n=ncset)
    387         print("%d %g %g %g" % (0, 0.0, 0.0, frac))
    388 

/content/cross-sim/cross_sim/cross_sim/backprop/backprop.py in classify(self, n, debug, count_interval, randomSampling, topk, time_interval, profiling_folder, profiling_settings)
    748 
    749             ex = (one if not randomSampling else inds_rand[one])
--> 750             result = self.classify_one(ex, branch, debug=debug,topk=topk,profile_in_backprop=profile_in_backprop)
    751 
    752             if type(topk) is int:

/content/cross-sim/cross_sim/cross_sim/backprop/backprop.py in classify_one(self, one, branch, debug, profile_in_backprop, topk, debug_graph)
    879             if m == 0:
    880                 ivec = indata[one].copy()
--> 881                 flattened = (ivec.shape[0] == 1 and ivec.shape[1] == 1) or self.layerTypes[0] == "dense"
    882             elif not branch:
    883                 ivec = output_vec.copy()

TypeError: 'NoneType' object is not subscriptable``


> I was compiling the program throgh cross-sim and while executing the program its shows error.                            

python-3.x artificial-intelligence google-colaboratory backpropagation
© www.soinside.com 2019 - 2024. All rights reserved.