第二章测试
1.a=tf.constant(5)的默认类型是( )。
A:tf.double64
B:tf.float32
C:tf.int16
D:tf.int32

答案:D
2.

TensorFlow2.0中,所有张量都可以通过( )方法得到对应的数组。


A:dtype()
B:shape()
C:numpy()
D:其余都不是
3.可以创建元素值相同的张量的函数是( )。
A:tf.zeros()
B:tf.cast()
C:tf.fill()
D:tf.ones()
4.以下对函数功能的描述中,错误的是( )
A:tf.transpose(),交换维度
B:tf.cast(),增加维度
C:tf.squeeze(),删除维度
D:tf.reshape(),更改维度
5.

以下程序执行后,b的内容是()。
  a=tf.range(12)
  b=a[2:5:1]
  print(b.numpy())  


A:[2 3 4]
B:[2 4 6]
C:[2 3 4 5]
D:其余都不对
6.

以下程序执行后,运行结果是()。
  a=tf.reshape( tf.range(10,22) , [3,4] )
  b=a[0 ,0:2]
  print(b.numpy()) 


A:[10 11 12]
B:其余都不对
C:[10 11]
D:[14 15]
7.

以下描述中,错误的是( )。


A:tf.sqrt(3): 计算3的平方根
B:tf.square(x):对x逐个元素计算平方
C:tf. pow(2 , x ) :计算2的x次方
D:tf. exp(1.):计算e的1.0次方
8.

以下程序段的运行结果是()。
import numpy as np
a=tf.constant(np.arange(6),shape=(2,3))
b=tf.constant(np.arange(6),shape=(3,2))
c=a@b
print(c.numpy()) 


A:[ [10 13 15] [28 40 50] ]
B:[ [1 2 3] [4 5 6] ]
C:不能运算
D:[ [10 13] [28 40] ]
9.

有语句:

import tensorflow as tf

a=tf.constant( [[1,2],[3,4]] ) 

以下描述错误的是()。


A:执行语句tf.reduce_mean(a)后,值为2.5
B:执行语句tf.reduce_max(a,axis=0)后,值为[3 4]
C:执行语句tf.reduce_sum(a,axis=1)后,值为[3 7]
D:执行语句tf.reduce_min(a)后,值为1

温馨提示支付 ¥3.00 元后可查看付费内容,请先翻页预览!
点赞(118) dxwkbang
返回
顶部