摘要: 在OOP程序设计中,当我们定义一个class的时候,可以从某个现有的class继承,新的class称为子类(Subclass),而被继承的class称为基类、父类或超类(Base class、Super class)。class Animal(object)... 阅读全文
posted @ 2018-10-06 21:37 luoganttcc 阅读(87) 评论(0) 推荐(0) 编辑
摘要: 如果要让内部属性不被外部访问,可以把属性的名称前加上两个下划线__,在Python中,实例的变量名如果以__开头,就变成了一个私有变量(private),只有内部可以访问,外部不能访问class Student(object): def __init_... 阅读全文
posted @ 2018-10-06 21:28 luoganttcc 阅读(93) 评论(0) 推荐(0) 编辑
摘要: class Student(object): def __init__(self, name, score): self.name = name self.score = score def print_score(s... 阅读全文
posted @ 2018-10-06 21:20 luoganttcc 阅读(181) 评论(0) 推荐(0) 编辑
摘要: import torchimport torch.nn as nnimport torchvision.datasets as normal_datasetsimport torchvision.transforms as transformsfrom to... 阅读全文
posted @ 2018-10-06 20:46 luoganttcc 阅读(215) 评论(0) 推荐(0) 编辑
摘要: import torchfrom torch.autograd import *from torch import nn,optimfrom torch.utils.data import DataLoaderfrom torchvision imp... 阅读全文
posted @ 2018-10-06 19:16 luoganttcc 阅读(360) 评论(0) 推荐(0) 编辑