动手学深度学习 v2.0reserved_tokens = [] # 按出现频率排序 counter = count_corpus(tokens) self._token_freqs = sorted(counter.items(), key=lambda x: x[1], reverse=True) # 未知词元的索引为0 self.idx_to_token = [''] + reserved_tokens (continues tention pooling)将选择引导至 感官输入(sensory inputs,例如中间特征表示)。在注意力机制中,这些感官输入被称为值(value)。更通 俗的解释,每个值都与一个键(key)配对,这可以想象为感官输入的非自主提示。如 图10.1.3所示,可以通 过设计注意力汇聚的方式,便于给定的查询(自主性提示)与键(非自主性提示)进行匹配,这将引导得出 最匹配的值(感官输入)。 sharex=True, sharey=True, squeeze=False) for i, (row_axes, row_matrices) in enumerate(zip(axes, matrices)): for j, (ax, matrix) in enumerate(zip(row_axes, row_matrices)): pcm = ax.imshow(matrix.detach() 0 码力 | 797 页 | 29.45 MB | 1 年前3
《Efficient Deep Learning Book》[EDL] Chapter 4 - Efficient Architecturesassigns a unique index to the words. This process is called vectorization. An embedding table with a row for each word is initialized in the third step. Finally, in the fourth step, we train a model which Table Initialization Our embedding table is a floating-point tensor of shape ( , ), where the -th row is an embedding corresponding to the the -th word in the vocabulary. To start off, we initialize The shape of the word2vec_embeddings would be (vocabulary_size, 250), # since we are embedding each row in the vocabulary and the size of the # word2vec embeddings is 250 dimensions. print('Vocabulary Size:'0 码力 | 53 页 | 3.92 MB | 1 年前3
《Efficient Deep Learning Book》[EDL] Chapter 3 - Learning Techniquesimage anticlockwise. The following code rotates an image 10° clockwise (leftmost image in the middle row in figure 3-6). # Rotate 10 degrees in a clockwise direction transform_and_show(image_path, theta=10) operation flips an image along the horizontal or the vertical axis. The rightmost image in the middle row in figure 3-6 is a horizontally flipped version of the central image. # Horizontal Flip transfor respective axis. A shift parameter, s, controls the slide amount in pixels. The middle image in the top row in figure 3-6 is a 50px upshifted image generated by below code. # Horizontal Shift transform_and_show(image_path0 码力 | 56 页 | 18.93 MB | 1 年前3
机器学习课程-温州大学-01机器学习-引言),其中()内可以是列表、字典或字符串,因为字符串是以列表的形式存储的 ⚫字典(dict) 字典dict也叫做关联数组,用大括号{ }括起来,在其他语言中也称为map,使用键-值( key-value)存储,具有极快的查找速度,其中key不能重复。 56 Python控制流 ⚫顺序结构 ⚫分支结构 ⚫循环结构 ⚫break、continue和pass ⚫列表生成式 57 Python函数 ⚫调用函数 Python模块-Pandas ⚫ 数据索引 df[5:10] 通过切片方式选取多行 df[col_label] or df.col_label 选取列 df.loc[row_label, col_label] 通过标签选取行/列 df.iloc[row_loc, col_loc] 通过位置(自然数)选取行/列 65 Python模块-Pandas ⚫ 数据合并 pd.merge(left, right)0 码力 | 78 页 | 3.69 MB | 1 年前3
机器学习课程-温州大学-01深度学习-引言),其中()内可以是列表、字典或字符串,因为字符串是以列表的形式存储的 ⚫字典(dict) 字典dict也叫做关联数组,用大括号{ }括起来,在其他语言中也称为map,使用键-值( key-value)存储,具有极快的查找速度,其中key不能重复。 57 Python控制流 ⚫顺序结构 ⚫分支结构 ⚫循环结构 ⚫break、continue和pass ⚫列表生成式 58 Python函数 ⚫调用函数 Python模块-Pandas ⚫ 数据索引 df[5:10] 通过切片方式选取多行 df[col_label] or df.col_label 选取列 df.loc[row_label, col_label] 通过标签选取行/列 df.iloc[row_loc, col_loc] 通过位置(自然数)选取行/列 66 Python模块-Pandas ⚫ 数据合并 pd.merge(left, right)0 码力 | 80 页 | 5.38 MB | 1 年前3
《Efficient Deep Learning Book》[EDL] Chapter 5 - Advanced Compression Techniquesremoving a few weights. However, when pruning a large number of weights, say 60%, we risk the removal of key weights. Hence, a more measured approach to select removal candidates is required. If we assign saliency is a result of pruning the first row of the weight matrix. By pruning all 6 weights from one neuron, instead of pruning 6 arbitrary weights, we can ignore the first row in the weight matrix. If the input0 码力 | 34 页 | 3.18 MB | 1 年前3
《Efficient Deep Learning Book》[EDL] Chapter 7 - AutomationThese child networks were smaller and more efficient than the human designed models. However, the key contribution of NASNet was the focus on predicting the components of child networks which enabled the 1)] def make_child(self, config): """ Arguments: config: It is an array of shape [2, 5, 5] Each row represents a cell: [Normal, Reduction] Each cell contains 5 blocks. Each block contains 5 operations0 码力 | 33 页 | 2.48 MB | 1 年前3
Keras: 基于 Python 的深度学习库_first’,返回 5D 张量,尺寸为:(samples, time, filters, output_row, output_col)。 • 如果 data_format=’channels_last’,返回 5D 张量,尺寸为:(samples, time, output_row, output_col, filters)。 • 否则, • 如 果 data_format =’channels_first’, 回 4D 张 量, 尺 寸 为:(samples, filters, output_row, output_col)。 • 如果 data_format=’channels_last’,返回 4D 张量,尺寸为:(samples, output_row, output_col, filters)。o_row 和 o_col 依赖于过滤器的尺寸和填充。 异常 • ValueError: 无效的构造参数。 kernel_size: 2 个整数的元组,指定 2D 卷积窗口的宽度和高度。 • strides: 2 个整数的元组,指定 2D 卷积沿宽度和高度方向的步长。 • output_shape: 元组 (output_row, output_col) 。 • data_format: 数据格式,channels_first 或 channels_last。 返回 一个 4D 张量。 • 如果 data_form0 码力 | 257 页 | 1.19 MB | 1 年前3
【PyTorch深度学习-龙龙老师】-测试版202112格、粗细等丰富的样式,使得数据集的分布与真实的手写数字图片的分布尽可能地接近, 从而保证了模型的泛化能力。 图 3.2 MNIST 数据集样例图片 现在来讨论图片的表示方法。一张图片包含了ℎ行(Height/Row),?列(Width/Column), 每个位置保存了像素(Pixel)值,像素值一般使用 0~255 的整形数值来表达颜色强度信息, 例如 0 表示强度最低,255 表示强度最高。如果是彩色图片,则每个像素点包含了 '', 'the', ',', '.', 'and', 'a', 'of', 'to', 'is'] word2num of book: 285 TEXT.vocab.stoi 为字典对象,key 为单词,value 为单词数字编码 ID,可以看到”book”对应 的数字编码为 285。TEXT.vocab.itos 为列表对象,从 0 到 10001 分别代表了对应的单词, 例如”the”的数字编码为 f: reader = csv.reader(f) for row in reader: # 'pokemon\\bulbasaur\\00000000.png', 0 img, label = row label = int(label) images 0 码力 | 439 页 | 29.91 MB | 1 年前3
微博在线机器学习和深度学习实践-黄波提升3-5倍 • 分区优化:支持多种分区策略(RANGE/HASH/MOD),解决数据倾斜导致的流量热点瓶颈问题,性能提升2-5倍 • 存储优化:自定义存储方式(ByRow&ByKey),基于row进行矩阵压缩存储,参数内存占用减少90% 3 在线机器学习-参数服务器 模型验证 离线训练 实时训练 模型训练 模型部署 在线服务 离线验证 在线发布 在线验证 在线一致性/ 模型稳定性/…0 码力 | 36 页 | 16.69 MB | 1 年前3
共 21 条
- 1
- 2
- 3













