TypeError: ‘int‘ object is not callable

在做训练时,突然报错

TypeError: 'int' object is not callable

对应部分代码如下

test_loss_list = []

total_step = len(train_data_loader)   # 就时这句话错了

开始很懵逼,因为之前都还是对的,搜索之后发现,在前面定义变量时,不小心写了个

len = pp.shape[1]

python在执行语句时,误以为len(train_data_loader)是从上面的变量来的。
修改变量名为lens 即可

你可能感兴趣的:(python,python,深度学习,开发语言)