神经网络单元测试 1 ~14单元

第1讲 单元测试

‌1. 被誉为“人工智能之父”的科学家是__图灵_。

2
‌下面说法中,正确的是___我们现在实现的几乎都是弱人工智能_____。

3
‎AI的英文缩写是___ Artificial Intelligence_____。

4
‍研究人工智能的目的是让机器___模拟、延伸和扩展人的智能_____。

5
‎自然语言理解是人工智能的重要应用领域,下面列举的___科学计算的精度更高,速度更快____不是它要实现的目标。

第2讲 单元测验

1
‏下面的Anaconda工具中,___ Anaconda Navigator____ 不能直接用来编辑和运行源代码。

2
‎以下说法中,正确的是:使用 Python语言进行编程,不一定要安装Anaconda
3
‍下面安装包的命令中,错误的是:___ pip install tensorflow=2.4.0 alpha___。

4
‏__包管理___不仅可以方便地安装、更新、卸载工具包,而且安装时能自动安装相应的依赖包。

5
建立文件add.py,写入以下代码:

print( “the first number is:)
print(30+50)
print(“the second number is:)
30*50

保存并运行脚本文件,输出结果为:
‎ the first number is:
80
the second number is:

第3讲 单元测试

1
‏下面说法中错误的是_______。
Python语言的执行速度高于C语言
2
‌接收用户输入信息,并使用用户输入的姓名和年龄,向用户打招呼,下面______程序段是正确的。

name = input(“Please input your name:”)
age=int(input(“Please input your age:”))
print(‘Hello!%s,I know your age is %d.’%(name,age))
3
‍下面_______是Python合法的标识符。

test
4
‎下列_______语句在Python中是非法的。

max = x >y ? x : y
5
‎执行以下程序后,假设用户输入123,则输出结果为
______。

n=int(input('请输入一个三位正整数:'))
a=n//100
b=(n//10)%10
c=n%10
print(a,end=',')
print(b,end=',')
print(c)


1,2,3

6
‍以下不能实现将变量a的值增加1的是_______。
a+1

7
‍已知x=2,y=3,复合赋值语句x*=y+5执行后,x变量中的值是_______。
16

8
‏执行下列程序段,输出结果是_______。

‏a = 30
‏b = 1if a >=10:
‏    a = 20elif a>=20:
‏    a = 30elif a>=30:
‏    b = a
‏else:
‏    b = 0print('a=%d, b=%d'%(a,b))


a=20, b=1
9
‌下面代码的输出结果是_______。

for i in range(10):if i%2==0:continueelse:print(i, end=",")

1,3,5,7,9,
10
‍以下程序的输出结果是:_______。

sum=1for i in range(1,5):sum *= i
‍print(sum)


24

第4讲 单元测试

1
‎下列选项中,正确定义了一个字典的是_______。
dic={‘a’:1,‘b’:2,‘c’:3}
2
‏下列关于列表和元组的定义,错误的是_______。

tup=(1)
3
‌假设文件不存在,如果使用open方法打开文件会报错,那么该文件的打开方式是下列_______模式。
‘r’
4
‍下列程序的执行结果是_______。

‍str=“HelloWorld”

‍print(str[5:])

‍print(str[-5:])

World
World
5
执行下面代码,结果正确的是_______。

class MyClass:

a = 10

b = 100

x = MyClass()

print(x.b)

print(x.a)

100
程序报错
6
‍下面程序的运行结果是
___。

‍def mul(a=1,b=4,c):

‍ return abc

‍print(mul(2,3,2))

运行出错
7
‎若文本文件a.txt中的内容如下:

‎abcdef

‎123456

‎则下列程序的执行结果是_______。

‎f=open(“a.txt”,“r”)

‎s=f.readline()

‎s1=list(s)

‎print(s1)

[‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, ‘\n’]
8
‌下面程序的运行结果是_______。

‌lst_demo=[10,23,66,26,35,1,76,88,58]

‌lst_demo.reverse()

‌print(lst_demo[3])

‌lst_demo.sort()

‌print(lst_demo[3])
‎ 1
26
9
‏执行以下程序段,输出的结果为_______。

‏class Person:

‏ def del(self):

‏ print(“–del–”)

‏person = Person()

‏del person

‏print(“–end–”)
–del–
–end–
10
‎若文本文件hello.txt中的内容如下:

‎Hello,Python!

‎则下列程序的执行结果是_______。

‎with open(“hello.txt”) as f:

‎ print(f.read())

‎print(f.read())

首先输出Hello,Python!然后提示出现I/O操作异常

第5讲 单元测试

1
下列说法中,错误的是 。

二维数组[[0,1],[2,3],[4,5]]的形状是(2,3)
2
下列关于Numpy的说法,错误的是_______。

Numpy在完成数组和矩阵运算时,需要配合循环操作
3
‍执行下列程序段后,得到的结果是_______。

‍import numpy as np

‍b = np.array([[[0,1,2],[3,4,5]],[[6,7,8],[9,10,11]]])

‍b[1,1,2]

11
4
‎下面程序的执行结果为_______。

‎a=np.array([4,3,2,1])

‎print(a[1:3])

[3 2]
5
执行下列程序段后,得到的结果是_______。

import numpy as np

a = np.array([[[4,3,2,1],[1,2,3,4]],[[7,8,9,10],[10,9,8,7]]])

print(a.ndim)

print(a.shape)

print(a.size)

3
(2, 2, 4)
16
6
二维数组a=np.array([[1, 2, 3],[4, 5, 6],[7, 8, 9]]),不能取出第1,2行所有元素的语句是_______。
a[0:1, 0:2]
7
‏下面程序的执行结果为_______。
‏import numpy as np
‏a = np.arange(0, 8, 2, dtype=‘int32’)
‏print(a)
[0 2 4 6]
8
‍执行下列函数后,得到的结果是_______。
‍import numpy as np
‍a = np.linspace(0,10,num = 3)
‍b = np.logspace(1,7,4,base=2)
‍print(a)
‍print(b)
[ 0. 5. 10.]
[ 2. 8. 32. 128.]
9
‌执行下列程序段后,得到的结果是_______。

‌a=[1,2,3]

‌b=np.array(a)

‌type(b)

numpy.ndarray
10
‌执行如下操作以后,输出结果正确的是_______。

‌import numpy as np

‌a = np.array([0, 1, 2, 3])

‌print(a)

[0 1 2 3]
11
‏下面程序段的执行结果为_______。

‏import numpy as np

‏t = np.arange(120).reshape(3,4,5,2)

‏t0=np.sum(t,axis=1)

‏print(t0.shape)

(3,5,2)
12
‌下面程序段的执行结果为_______。

‌arr = np.arange(12).reshape(2,2,3)

‌np.sum(arr, axis=0)

array([[6,8,10], [12,14,16]])
13
‎定义如下矩阵a,b,则选项中输出结果与b矩阵相同的是_______。

‎a = np.mat([[0,1],[2,3]])

‎b = np.mat([[1,0],[0,1]])

a.I*a
14
‎下列函数中,返回值不是浮点数的是_______。

np.random.randint()
15
下面的程序执行结果为_______。

a = np.array([5.5, 6.2, 8.7])

b = np.array([3, 4, 5])

c = a - b

c.dtype

dtype(‘float64’)

第6讲 单元测试

1
关于figure()函数,错误的描述是______。

figure( num,figsize,dpi,facecolor,edgecolor,frameon )


num表示子图的个数
2
对于以下程序段的输出结果,描述错误的是______。

import matplotlib.pyplot as plt

fig = plt.figure(facecolor=“g”)

plt.subplot(252)

plt.subplot(257)

plt.subplot(2,5,10)

plt.show()


生成的3个子图位于不同的列上
3
‏下列______函数用于绘制散点图。

scatter()
4
下列说法中,错误的是______。

使用bar()函数绘制柱状图时,只有height参数不可省略
5
‌下列______参数用来设置折线图中数据点的大小。

markersize
6
‌如果使用tight_layout(rect=[])函数将子图向上压缩(即将子图下方空出),可以考虑修改rect中的参数为______。

rect[0 , 0.1 , 1 , 1]
7
下载波士顿房价数据集,将训练集放入train_x中,则执行______语句可以获得其中的前5行数据。

print(train_x[0:5])
8
下面程序段的执行结果为______。

import tensorflow as tf

boston_housing= tf.keras.datasets.boston_housing

(train_x,train_y),(test_x,test_y)= boston_housing.load_data(test_split=0.1)

print(“Training set:”, len(train_x))

print(“Testing set:”, len(test_x))


Training set: 455
Testing set: 51

9
‏在波士顿数据集中,访问测试集test_x中,所有样本的的ZN和INDUS属性(第2、3列元素),可以通过______语句实现。

test_x[:, 1:3]
10
执行下列程序段后,x=4处的数据点是______。

import numpy as np

import matplotlib.pyplot as plt

x = np.arange(8)

y = np.arange(8)

dot_color = [1, 2, 0, 2, 1, 0, 0, 2]

plt.scatter(x,y, c = dot_color,cmap = ‘brg’)

plt.show()

红色

第7讲 单元测试

1
‍下列描述中,错误的是_______。

灰度图像的位深度为256位
2
‍下列描述中,正确的是_______。
MINST数据集中默认60000条为训练数据,10000条为测试数据
3
‎存储512×512像素的灰度图像,会占用_______内存空间。

256KB
4
‎下面_______是一种无损压缩的图像格式,且适合于有规律渐变色彩的图像。
PNG
5
单选(2分)
将600×600的图像lena.tiff保存在当前路径下,执行下面程序段对图像进行裁剪,其中_______ 点在裁剪区域中。
import matplotlib.pyplot as plt
from PIL import Image
image = Iamge.open(“Lena.tiff”)
img_region = img.crop((100,300,300,500))
plt.imshow(img_region)
plt.show()
(220,460)
6
‌下面程序段中,_______ 可以将图片lena.bmp保存为JPEG格式。

image = Image.open(“lena.bmp”)
image.save(“lena.jpg”)

7
‌下列Pillow库的函数中,直接对原图像进行缩放操作的是_______。
thumbnail()
8
lena.jpg为灰度图像,执行下列程序段后,mylena.jpg为_______。

import matplotlib.pyplot as plt

from PIL import Image

img = Image.open(“lena.jpg”)

img = img.convert(“1”)

img.save(“mylena.jpg”)


二值图像
9
在MINST数据集中,访问训练集train_y中的第6个样本的标签值,可以通过_______语句实现。

train_y[5]
10
将256×256的RGB彩色图像转换为数组,其形状为_______。
(256, 256, 3)
11
执行下面代码段,对其输出结果描述正确的是_______。

import tensorflow as tf

mnist = tf.keras.datasets.mnist

(train_x, train_y), (test_x, test_y) = mnist.load_data()

print(“training set:”, train_x.shape)

print(“testing set:”, len(test_x))


training set: (60000, 28, 28)
testing set: 10000

12
执行下面代码段,对其输出结果描述错误的是_______。

import tensorflow as tf

import numpy as np

import matplotlib.pyplot as plt

mnist = tf.keras.datasets.mnist

(train_x, train_y), (test_x, test_y) = mnist.load_data()

for i in range(9):

num = np.random.randint(1,60000)

plt.subplot(3, 3, i+1)

plt.axis(“off”)

plt.imshow(train_x[num], cmap=‘gray’)

plt.title(train_y[num])

plt.show()



该代码段的功能为随机显示8幅数字图片
13
‏将1000张尺寸为28×32的彩色图片存储在多维数组pic中,pic的形状为____,对pic进行切片操作“pic[0]”之后,得到的数组是____。

(1000,28,32,3) 三维数组
14
‎将5000张尺寸为28×32的彩色图片存储在多维数组pic中,要提取出pic中索引值为9—19(索引从0开始)的图片的G通道,应使用______。

pic [9 : 20 , : , : , 1]

第8讲 单元测试

1
‍下列说法中,错误的是 。

Python列表非常适合用来做数值计算
2
‌下列关于TensorFlow的说法中,错误的是 。

Tensorflow2.0中默认采用动态图机制,其执行效率要高于静态图机制
3
‏下列关于TensorFlow张量的说法中,错误的是 。

对张量进行分割或拼接后,张量的存储顺序会发生改变
4
‍执行下面程序段,对运行结果描述正确的是 。
‍import tensorflow as tf
‍a = tf.constant(1234567, dtype=tf.float32)
‍tf.cast(a, tf.float64)
<tf.Tensor: id=11, shape=(), dtype=float64, numpy=1234567.0>
5


‍执行下列程序段后,得到的结果是 。

‍import tensorflow as tf

‍import numpy as np

‍a = np.arange(9).reshape(3,3)

‍b = tf.convert_to_tensor(a)

‍print(tf.is_tensor(a))

‍isinstance(b,tf.Tensor)

False
True
6
‌执行下列程序段,对其结果描述错误的是 。

‌import tensorflow as tf

‌tf.random.truncated_normal(shape=(2, 2), mean=0.0, stddev=2.0)

生成的张量中可能出现[-4,4]以外的点
7
‏下列说法中,正确的是 。

使用tf.split()函数分割张量后,其维度不变
8
‏下列关于张量运算的说法中,错误的是 。

两个不同维度的张量相加,其最后一个维度的长度可以不相等
9
‏执行下面程序段后,正确的结果是 。

‏import tensorflow as tf

‏a = tf.range(8, delta=2)

‏a1 = tf.reshape(a, [-1,2])

‏b = tf.range(1, 9,delta=2)

‏b1 = tf.reshape(b, [2,-1])

‏c = tf.stack((a1, b1),axis=0)

‏print(“shape:\n”,c.shape)

‏print(“value:\n”,c.numpy())

shape:
(2, 2, 2)
value:
[[[0 2]
[4 6]]
[[1 3]
[5 7]]]

‍10.运行下面程序段,结果正确的是 。
‍import tensorflow as tf
‍t1 = tf.constant([[1, 2, 3], [4, 5, 6]])
‍t2 = tf.constant([[7, 8, 9], [10, 11, 12]])
‍t = tf.stack((t1, t2), axis=-1)
‍print(t.shape)

(2, 3, 2)
11
‍下面程序段的执行结果为 。

‍import tensorflow as tf

‍a = tf.range(6)

‍a1 = tf.reshape(a, [2, 3])

‍b = tf.constant([[7, 8, 9], [10, 11, 12]])

‍b1 = tf.gather(b, axis=1, indices=[1, 2, 0])

‍c = a1*b1

‍print(c.numpy())

[[ 0 9 14] [33 48 50]]
12
‍对下列程序段的执行结果,描述错误的是 。

‍import tensorflow as tf

‍x = tf.constant([1., 4., 9., 16.])

‍pow(x, 0.5)

输出张量的shape为(1,)
13
‎下列程序段的执行结果为 。

‎import tensorflow as tf

‎a = tf.range(24)

‎b = tf.reshape(a,[4,6])

‎c = tf.gather_nd(b,[[0,0],[1,1],[2,2]])

‎print(c.numpy())

[ 0 7 14]
14
‌执行下列程序段后,得到的结果是 。

‌import tensorflow as tf

‌import numpy as np

‌a = tf.constant(np.arange(48).reshape(3,2,4,2))

‌b =tf.random.shuffle(a)

‌c = tf.constant(np.arange(8).reshape(2,4))

‌d = a@c

‌print(d.shape)

(3, 2, 4, 4)
15
‍下列程序段的执行结果为 。
‍import tensorflow as tf
‍import numpy as np
‍a = tf.constant([[1., 2., 3.],[4., 5., 6.]])
‍b = tf.random.shuffle(a)
‍c = tf.constant(np.arange(6), shape=(3,2) ,dtype=tf.float32)
‍d = tf.reduce_mean(b@c, axis=0)
‍e = tf.argmin(d,axis=0)
‍print(“d_value:”,d.numpy())
‍print(“e_value:”,e.numpy())
d_value: [25. 35.5]
e_value: 0
16
‌下列描述错误的是______。
CPU比GPU拥有更高的浮点计算能力
17
‎下列描述错误的是______。

在默认情况下,TensorFlow优先将运算分配给CPU执行

第9讲 单元测试

1
‏下列说法中错误的是_____。

在一元线性回归中包含两个或者两个以上的自变量
2
下列说法中错误的是_____。

监督学习包括对有标签和无标签样本的学习
3
‌下列说法中错误的是_____。

最佳拟合直线应该经过每一个样本点
4
‌下列程序的执行结果为_____。
‌import tensorflow as tf
‌a = tf.constant([1, 3, 5])
‌b = 2
‌c = tf.reduce_sum(a+b)
‌c.numpy()
15
5
‎执行下列代码后,得到的结果是_____。

‎X=1/3

‎print(round(X, 2))

0.33
6
执行下列函数后,得到的结果是_____。

import numpy as np

X0=np.ones(3)

X1=np.zeros(3)

X2=np.array([1,2,3])

X=np.stack((X0,X1,X2), axis=1)

print(X)

[[1,0,1],[1,0,2],[1,0,3]]
7
运行下列程序,关于a,b,c,d,e的数据类型,以下中正确的是_____。
import numpy as np
import tensorflow as tf
a=np.array([1,2,3])
b=2
c=a+b
d=tf.add(a,1)
e=c+d
a,b,c,d,e中有2个TensorFlow张量
8
‎执行下面的程序段后,数组c的形状是:



‎import numpy as np

‎a=np.arange(5).reshape(-1,1)

‎b=a+1

‎c=b.reshape(-1)

‎c.shape

(5, )
9
‍下列程序段的运行结果为


import numpy as np

A = np.array([[2, 3], [2, 1]])

B = np.array([[2, 0], [1, 2]])

X = A * B

Y = np.matmul(A, B)

print(“X:\n”, X)

print(“Y:\n”, Y)

X:
[[4 0]
[2 2]]
Y:
[[7 6]
[5 2]]
10
判断(2分)
‎解析解是指通过严格的公式推到和计算所求得的解。

第10讲 单元测试

1
‌下列说法不正确的是______。

Variable对象是不能被自动训练的变量
2
‎下列关于数组x的说法,错误的是______。

‎w = tf.Variable(np.random.randn(3, 1))

w中元素的类型是float32
3
‍下列程序段的执行结果为______。

‍x = []

‍for i in range(5):

‍ i += 1

‍ x.append(i)

‍print(x[2:4])

[3, 4]
4
执行下列代码后,得到的结果是______。

import tensorflow as tf

a = tf.constant(3)

x = tf.Variable(a)

print(isinstance(a, tf.Tensor), isinstance(a, tf.Variable))

print(isinstance(x, tf.Tensor), isinstance(x, tf.Variable))

True False
False True
5
‌执行下列代码后,得到的结果是______。

‌import tensorflow as tf

‌x = tf.Variable([1., 2.])

‌y = tf.Variable([3., 4.])

‌with tf.GradientTape() as tape:

‌ f = tf.square(x) + 2*tf.square(y) + 1

‌df_dx, df_dy = tape.gradient(f, [x, y])

‌print(“df_dx:”, df_dx.numpy())

‌print(“df_dy:”, df_dy.numpy())

df_dx: [2. 4.]
df_dy: [12. 16.]
6
‍执行下面程序段,运行结果是______。
‍import tensorflow as tf
‍x = tf.Variable(4.)
‍with tf.GradientTape() as tape:
‍ y = tf.square(x)
‍dy_dx = tape.gradient(y, x)
‍print(y.numpy(),dy_dx.numpy())
16.0 8.0
7
‏下列说法中错误的是______。

过拟合就是学习过度,在训练集上表现很差,而且在新样本上泛化误差也很大
8
‏以下程序段中,能够实现对数组x按列归一化。

‏import numpy as np

‏x = np.array([[4., 30, 200],

‏ [1., 30, 100],

‏ [2., 40, 300],

‏ [5., 30, 400]])

a=(x.max(axis=0)-x.min(axis=0))
(x-x.min(axis=0)) / a
9
‎对下列程序段的执行结果描述正确的是


‎import numpy as np

‎x0 = np.array([[3., 10, 500],

‎ [1., 30, 100],

‎ [2., 40, 300]])

‎x1 = np.ones(len(x0)).reshape(-1,1)

‎x = tf.cast(tf.concat([x0, x1], axis=1), tf.float64)

‎print(x.dtype, x.shape)

float64 (3, 4)

第11讲 单元测试

1
运行下面程序,结果正确的是______。

import tensorflow as tf

import pandas as pd

TRAIN_URL = “https://download.tensorflow.org/data/iris_training.csv”

train_path = tf.keras.utils.get_file(TRAIN_URL.split(‘/’)[-1], TRAIN_URL)

df_iris = pd.read_csv(train_path, header=0)

iris = np.array(df_iris)

train_x = iris[:,0:2]

print(train_x.shape)

(120, 2)
2
‎下面选项中,可以用来填充分区的是______。

plt.contourf()
3
‎运行下面程序,结果正确的是______。

‎import numpy as np

‎test = np.arange(0,5,1)

‎a = np.max(test)

‎b = np.argmax(test)

‎print(a,b)

4 4
4
‍下面关于Softmax函数的说法错误的是______。
Softmax函数不属于广义线性回归
5
‏下列说法中,错误的是______。

三维空间中的线性可分数据集,可以被一条直线分为两类
6
执行下列代码后,得到的结果是______。
pred = np.array([0.1, 0.2, 0.6, 0.8])
a = np.array([1,2,3,4])
b = np.array([10,20,30,40])
tf.where(pred<0.5, a, b)
([1,2,30,40])
7
‎执行函数tf.round(0.5)后得到的结果是______。

0.0
8
100个样本,分3类的问题,下列选项中正确的表达式是______。

9
‌以下代码段中,获取鸢尾花花瓣长度和宽度,正确的表达______。

‌import tensorflow as tf

‌import numpy as np

‌impor pandas as pd

‌TRAIN_URL = “https://download.tensorflow.org/data/iris_trainning.csv”

‌train_path = tf.keras.utils.get_file(TRAIN_URL.split(‘/’)[-1], TRAIN_URL)

‌df_iris_train = pd.read_csv(train_path, header=0)

‌iris_train = np.array(df_iris_train)


x_train = iris_train[:, 2:4]
10
‏一个好的模型,应该使用到数据集中的所有属性。


11
交叉熵越小,两个概率分布就越接近。

第12讲 单元测试

1
下列说法中错误的是______。
在实现神经网络时一般根据训练得到超参数的值
2
‍下列说法中错误的是______。

在网络训练中使用梯度下降法计算梯度,通过误差反向传播算法训练模型参数
3
下列关于超参数和数据集,说法错误的是______。

隐含层的层数和误差值都不是超参数
4
‍_____最合适作为多分类任务中输出层的激活函数。

softmax函数
5
‌下列关于激活函数的说法中,错误的是______。

使用Tanh函数来代替logistic函数,可以避免梯度消失问题
6
‏下列程序的执行结果为______。

‏import tensorflow as tf

‏a = tf.Variable([1., 1.])

‏b = tf.Variable([2., 2.])

‏with tf.GradientTape() as tape:

‏ y = tf.square(a) + 2tf.square(b) + 1

‏grads= tape.gradient(y, [a,b])

‏a.assign_sub(grads[0]
b)

‏print(a.numpy())

[-3. -3.]
7
单选(2分)
‏关于单层神经网络与多层神经网络的说法中,错误的是______。

单层神经网络只可以有一个隐藏层

第13讲 单元测试

1
训练大规模数据集时,首选的梯度下降算法是______。
小批量梯度下降法
2
‏下列关于梯度下降算法的说法中,错误的是______。
随机梯度下降算法计算速度快,可以使模型快速收敛
3
‎影响小批量梯度下降法效率的主要因素包括______。

‎①小批量样本的选择②批量大小③学习率④梯度

①②③④
4
‎下列说法中错误的是______。

使用越先进的梯度下降法优化算法,神经网络训练结果一定越好
5
下列说法错误的是______。

Keras作为前端工具,可离开后端计算引擎,独立工作
6
‍下列关于Sequential的描述,错误的是______。

Sequential只能实现全连接神经网络
7
‍下列关于损失函数的描述,错误的是______。

多分类任务中,可以使用binary_crossentropy损失函数
8
使用神经网络实现鸢尾花分类任务,输出层使用softmax激活函数,若标签值和预测值分别采用数值和独热编码形式表示时,通常使用______模型性能评估函数。

tf.keras.metrics.SparseCategoricalAccuracy()
9
使用下面语句训练Mnist手写数字识别网络,其中说法正确的是____。

model.fit(x_train, y_train, batchsize=64, epochs=5, validation_split=0, verbose=2)

共有60000条数据参与模型训练
10
‏使用下列代码建立神经网络模型,说法正确的是______。

‏import tensorflow as tf

‏model = tf.keras.Sequential()

‏model.add(tf.keras.layers.Dense(8, activation=“relu”, input_shape=(4, )))

‏model.add(tf.keras.layers.Dense(4, activation=“relu”))

‏model.add(tf.keras.layers.Dense(3, activation=“softmax”))

‏model.summary()

该模型的可训练参数个数共有91个
11
‎创建模型model,下列关于模型保存和加载的方法,描述错误的是______。

使用tf.keras.models.load_model()方法仅能够加载模型的结构信息
12
使用以下程序段创建神经网络模型,下列说法中错误的是______。

import tensorflow as tf

model = tf.keras.Sequential()

model.add(tf.keras.layers.Flatten(input_shape=(5, 5)))

model.add(tf.keras.layers.Dense(5, activation=“relu”))

model.add(tf.keras.layers.Dense(3, activation=“softmax”))

model.summary()

这个神经网络中含有2个隐含层

13
‏创建模型model,使用如下语句保存模型信息,错误的说法是______。
‏model.save(“test”, include_optimizer=True, save_format=“tf”)
模型文件保存为HDF5格式

第14讲 单元测试

1
‍下列说法中错误的是______。

传统的机器学习能够自动从数据中学习与任务相关的特征
2
‏下列说法错误的是______。
对图像边界不填充,卷积运算后的图像与原图像大小相同
3
下列说法中错误的是______。

与高斯模糊相比,均值模糊在平滑图像时能较好的保护物体边缘
4
‍若未在图像边界处填充数字,对一个15×15大小的图像,使用3×3的卷积核,进行一轮步长为3的卷积后,结果图像的大小为______。

5×5
5
‏下列说法中错误的是______。
卷积神经网络是一种反馈型神经网络
6
‏下列说法中错误的是______。

池化操作的作用是在增大数据处理量的同时,去除无用的信息

猜你喜欢

转载自blog.csdn.net/qq_53869058/article/details/131094473
今日推荐