// ConsoleApplication5.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。//#define_CRTDBG_MAP_ALLOC#include<stdlib.h>#include<crtdbg.h>#include<iostream>usingnamespace std;//抽象类classShape{protected://数据成员:价格和面积double price;double area;public://构造函数Shape():price(100),area(0){}//虚析构函数virtual~Shape(){printf("%s\n","Delete shape");}//纯虚函数:获取图形描述和获取价格virtualvoidgetDescription()=0;virtualvoidgetPrice()=0;};//接口classDraw{public://虚析构函数virtual~Draw(){printf("%s\n","Delete Draw");}//纯虚函数:输出图形周长virtualvoiddrawLen()=0;};//具体类classCircle:publicShape,publicDraw{private:double radius;public:Circle(double r):radius(r){ area =3.14* radius * radius; price =100+ area *6;}~Circle(){printf("%s%f\n","Delete circle with radius ",radius);}voidgetDescription(){printf("%s%f\n","Circle with radius ",radius);}voidgetPrice(){printf("%s%f%s%f\n","Circle with area ", area," price ",price);}voiddrawLen(){printf("%s%f\n","Circle with len ",2*3.14* radius);}};intmain(){Circle c(5.0);Shape* s =&c;//基类(Shape)指针指向子类(Circle)对象s->getDescription();s->getPrice();Draw* d =&c;//基类(Draw)指针指向子类(Circle)对象d->drawLen();_CrtDumpMemoryLeaks();return0;}
AlexNet神经网络 代码实现: 代码实现: import torch
from torch import nn
from d2l import torch as d2lnet nn.Sequential(# 采用了11*11的卷积核来捕捉对象,因为原始输入数据比较大#步幅为4 ,可减少输出的高度核宽度。#输出通…