“NameError:名称'images_train'未定义”,但已定义

时间:2018-05-12 12:59:12

标签: python tensorflow

这是我的代码:

new Ferrari()

该文件是带有形状的npz格式(64,112,112,3) 使用args.batch_size = 64可以正确执行代码,但args.batch_size = 32会出现错误,如下所示

def get_parser():
    parser.add_argument('--batch_size', default=64, help='batch size to train network')
    return args
while True:
    try:
        images_train = np.load(path + str(batch_idx)+'images.npy')
        labels_train = np.load(path + str(batch_idx)+'labels.npy')
        break
    except:
        batch_idx = sorted(os.listdir(path))
        try:
            batch_idx = int(batch_idx[0].split('images.npy')[0])
        except:
            batch_idx = int(batch_idx[0].split('labels.npy')[0])
        batch_idx += 400 
batch_idx += 1
feed_dict = {images: images_train[0:args.batch_size], 
             labels: labels_train[0:args.batch_size], trainable: True}

0 个答案:

没有答案