 《Efficient Deep Learning Book》[EDL] Chapter 5 - Advanced Compression Techniquescentroids. distances = tf.subtract(tf.reshape(x_var, (-1, 1)), centroids_var) ** 2 best_distances = tf.math.reduce_min(distances, axis=1) return tf.reduce_mean(best_distances) Now we can implement the method (-1, 1)), centroids) ** 2 # Now compute the distance to the closest centroid. best_distances = tf.math.reduce_min(distances, axis=1) # Create an indicator variable matrix, where 1.0 at index [i][j] denotes reshape(best_distances, (-1, 1))), dtype=tf.float64) # Now lookup the centroid indices. encoded_x_flattened = tf.math.argmax(is_closest, axis=1) # Finally, reshape the array to the original shape. return tf.reshap0 码力 | 34 页 | 3.18 MB | 1 年前3 《Efficient Deep Learning Book》[EDL] Chapter 5 - Advanced Compression Techniquescentroids. distances = tf.subtract(tf.reshape(x_var, (-1, 1)), centroids_var) ** 2 best_distances = tf.math.reduce_min(distances, axis=1) return tf.reduce_mean(best_distances) Now we can implement the method (-1, 1)), centroids) ** 2 # Now compute the distance to the closest centroid. best_distances = tf.math.reduce_min(distances, axis=1) # Create an indicator variable matrix, where 1.0 at index [i][j] denotes reshape(best_distances, (-1, 1))), dtype=tf.float64) # Now lookup the centroid indices. encoded_x_flattened = tf.math.argmax(is_closest, axis=1) # Finally, reshape the array to the original shape. return tf.reshap0 码力 | 34 页 | 3.18 MB | 1 年前3
 动手学深度学习 v2.0中提供了这 些函数和类的详细描述。d2l软件包是轻量级的,仅需要以下软件包和模块作为依赖项: #@save import collections import hashlib import math import os import random import re import shutil import sys import tarfile import time import 在训练我们的模型时,我们经常希望能够同时处理整个小批量的样本。为了实现这一点,需要我们对计算进 行矢量化,从而利用线性代数库,而不是在Python中编写开销高昂的for循环。 %matplotlib inline import math import time import numpy as np import torch from d2l import torch as d2l 为了说明矢量化为什么如此重要,我们考虑 1 2σ2 (x − µ)2 � . (3.1.11) 下面我们定义一个Python函数来计算正态分布。 def normal(x, mu, sigma): p = 1 / math.sqrt(2 * math.pi * sigma**2) return p * np.exp(-0.5 / sigma**2 * (x - mu)**2) 我们现在可视化正态分布。 # 再次使用numpy进行可视化0 码力 | 797 页 | 29.45 MB | 1 年前3 动手学深度学习 v2.0中提供了这 些函数和类的详细描述。d2l软件包是轻量级的,仅需要以下软件包和模块作为依赖项: #@save import collections import hashlib import math import os import random import re import shutil import sys import tarfile import time import 在训练我们的模型时,我们经常希望能够同时处理整个小批量的样本。为了实现这一点,需要我们对计算进 行矢量化,从而利用线性代数库,而不是在Python中编写开销高昂的for循环。 %matplotlib inline import math import time import numpy as np import torch from d2l import torch as d2l 为了说明矢量化为什么如此重要,我们考虑 1 2σ2 (x − µ)2 � . (3.1.11) 下面我们定义一个Python函数来计算正态分布。 def normal(x, mu, sigma): p = 1 / math.sqrt(2 * math.pi * sigma**2) return p * np.exp(-0.5 / sigma**2 * (x - mu)**2) 我们现在可视化正态分布。 # 再次使用numpy进行可视化0 码力 | 797 页 | 29.45 MB | 1 年前3
 机器学习课程-温州大学-numpy使用总结42787610e-01, 9.84807753e-01, . . . . . , -2.44929360e-16]) 值得注意的是,对于同等长度的ndarray,np.sin()比math.sin()快 但是对于单个数值,math.sin()的速度则更快。 25 四则运算 NumPy提供了许多ufunc函数,它们和相应的运算符运算结果相同。 > a = np.arange(0, 4) > b =0 码力 | 49 页 | 1.52 MB | 1 年前3 机器学习课程-温州大学-numpy使用总结42787610e-01, 9.84807753e-01, . . . . . , -2.44929360e-16]) 值得注意的是,对于同等长度的ndarray,np.sin()比math.sin()快 但是对于单个数值,math.sin()的速度则更快。 25 四则运算 NumPy提供了许多ufunc函数,它们和相应的运算符运算结果相同。 > a = np.arange(0, 4) > b =0 码力 | 49 页 | 1.52 MB | 1 年前3
 《Efficient Deep Learning Book》[EDL] Chapter 7 - Automationiteration in range(2000): with tf.GradientTape() as tape: output = model(X) loss = tf.reduce_mean(tf.math.square(Y - output)) grads = tape.gradient(loss, model.trainable_variables) opt.apply_gradients(zip(grads import layers, optimizers from collections import deque from matplotlib.ticker import MaxNLocator from math import pow SEED = 111 tf.random.set_seed(SEED) np.random.seed(SEED) random.seed(SEED) We will need0 码力 | 33 页 | 2.48 MB | 1 年前3 《Efficient Deep Learning Book》[EDL] Chapter 7 - Automationiteration in range(2000): with tf.GradientTape() as tape: output = model(X) loss = tf.reduce_mean(tf.math.square(Y - output)) grads = tape.gradient(loss, model.trainable_variables) opt.apply_gradients(zip(grads import layers, optimizers from collections import deque from matplotlib.ticker import MaxNLocator from math import pow SEED = 111 tf.random.set_seed(SEED) np.random.seed(SEED) random.seed(SEED) We will need0 码力 | 33 页 | 2.48 MB | 1 年前3
 《Efficient Deep Learning Book》[EDL] Chapter 4 - Efficient Architectures[(None, None)] 0 embedding_10 (Embedding) (None, None, 250) 1250000 tf.math.reduce_mean_8 (TFOp (None, 250) 0 Lambda) dense_28 (Dense) (None, 512) [(None, None)] 0 embedding_11 (Embedding) (None, None, 250) 1250000 tf.math.reduce_mean_9 (TFOp (None, 250) 0 Lambda) dense_31 (Dense) (None, 512)0 码力 | 53 页 | 3.92 MB | 1 年前3 《Efficient Deep Learning Book》[EDL] Chapter 4 - Efficient Architectures[(None, None)] 0 embedding_10 (Embedding) (None, None, 250) 1250000 tf.math.reduce_mean_8 (TFOp (None, 250) 0 Lambda) dense_28 (Dense) (None, 512) [(None, None)] 0 embedding_11 (Embedding) (None, None, 250) 1250000 tf.math.reduce_mean_9 (TFOp (None, 250) 0 Lambda) dense_31 (Dense) (None, 512)0 码力 | 53 页 | 3.92 MB | 1 年前3
 【PyTorch深度学习-龙龙老师】-测试版2021120,因此熵?(?)总是大于等于 0。当熵取得最小值 0 时, 不确定性为 0。分类问题的 One-hot 编码的分布就是熵为 0 的典型例子。在 TensorFlow 中 间,我们可以利用 tf.math.log 来计算熵。 在介绍完熵的概念后,我们基于熵引出交叉熵(Cross Entropy)的定义: ?(?||?) ≜ − ∑ ?(?) log2 ?(?) ? 通过变换,交叉熵可以分解为 深度融合,且只能基于 TensorFlow 后端运算,并对 TensorFlow 的支持更完美。对于使用 TensorFlow 的开发者来说,tf.keras 可以理解为一个普 通的子模块,与其他子模块,如 tf.math,tf.data 等并没有什么差别。下文如无特别说明, Keras 均指代 tf.keras,而不是标准的 Keras 库。 8.1 常见功能模块 Keras 提供了一系列高层的神经 深度融合,且只能基于 TensorFlow 后端运算,并对 TensorFlow 的支持更完美。对于使用 TensorFlow 的开发者来说,tf.keras 可以理解为一个普 通的子模块,与其他子模块,如 tf.math,tf.data 等并没有什么差别。下文如无特别说明, Keras 均指代 tf.keras,而不是标准的 Keras 库。 8.1 常见功能模块 Keras 提供了一系列高层的神经0 码力 | 439 页 | 29.91 MB | 1 年前3 【PyTorch深度学习-龙龙老师】-测试版2021120,因此熵?(?)总是大于等于 0。当熵取得最小值 0 时, 不确定性为 0。分类问题的 One-hot 编码的分布就是熵为 0 的典型例子。在 TensorFlow 中 间,我们可以利用 tf.math.log 来计算熵。 在介绍完熵的概念后,我们基于熵引出交叉熵(Cross Entropy)的定义: ?(?||?) ≜ − ∑ ?(?) log2 ?(?) ? 通过变换,交叉熵可以分解为 深度融合,且只能基于 TensorFlow 后端运算,并对 TensorFlow 的支持更完美。对于使用 TensorFlow 的开发者来说,tf.keras 可以理解为一个普 通的子模块,与其他子模块,如 tf.math,tf.data 等并没有什么差别。下文如无特别说明, Keras 均指代 tf.keras,而不是标准的 Keras 库。 8.1 常见功能模块 Keras 提供了一系列高层的神经 深度融合,且只能基于 TensorFlow 后端运算,并对 TensorFlow 的支持更完美。对于使用 TensorFlow 的开发者来说,tf.keras 可以理解为一个普 通的子模块,与其他子模块,如 tf.math,tf.data 等并没有什么差别。下文如无特别说明, Keras 均指代 tf.keras,而不是标准的 Keras 库。 8.1 常见功能模块 Keras 提供了一系列高层的神经0 码力 | 439 页 | 29.91 MB | 1 年前3
 深度学习与PyTorch入门实战 - 12. 数学运算基本运算 主讲人:龙良曲 Math operation https://blog.openai.com/generative-models/ ▪ Add/minus/multiply/divide ▪ Matmul ▪ Pow ▪ Sqrt/rsqrt ▪ Round basic matmul ▪ Torch.mm ▪ only for 2d ▪ Torch.matmul0 码力 | 11 页 | 1015.16 KB | 1 年前3 深度学习与PyTorch入门实战 - 12. 数学运算基本运算 主讲人:龙良曲 Math operation https://blog.openai.com/generative-models/ ▪ Add/minus/multiply/divide ▪ Matmul ▪ Pow ▪ Sqrt/rsqrt ▪ Round basic matmul ▪ Torch.mm ▪ only for 2d ▪ Torch.matmul0 码力 | 11 页 | 1015.16 KB | 1 年前3
 深度学习与PyTorch入门实战 - 16. 什么是梯度ResNet-56 https://github.com/tomgoldstein/loss-landscape Saddle point https://www.khanacademy.org/math/multivariable-calculus/applications-of- multivariable-derivatives/optimizing-multivariable-functi0 码力 | 17 页 | 1.49 MB | 1 年前3 深度学习与PyTorch入门实战 - 16. 什么是梯度ResNet-56 https://github.com/tomgoldstein/loss-landscape Saddle point https://www.khanacademy.org/math/multivariable-calculus/applications-of- multivariable-derivatives/optimizing-multivariable-functi0 码力 | 17 页 | 1.49 MB | 1 年前3
 《Efficient Deep Learning Book》[EDL] Chapter 2 - Compression Techniquesquantized networks, we need to quantize their activations as well. It means that we will perform the math operations in the layers (including intermediate layers and the output layer) using the fixed-point0 码力 | 33 页 | 1.96 MB | 1 年前3 《Efficient Deep Learning Book》[EDL] Chapter 2 - Compression Techniquesquantized networks, we need to quantize their activations as well. It means that we will perform the math operations in the layers (including intermediate layers and the output layer) using the fixed-point0 码力 | 33 页 | 1.96 MB | 1 年前3
 keras tutorialpython library used for fast numerical computation tasks. TensorFlow is the most famous symbolic math library used for creating neural networks and deep learning models. TensorFlow is very flexible and0 码力 | 98 页 | 1.57 MB | 1 年前3 keras tutorialpython library used for fast numerical computation tasks. TensorFlow is the most famous symbolic math library used for creating neural networks and deep learning models. TensorFlow is very flexible and0 码力 | 98 页 | 1.57 MB | 1 年前3
共 12 条
- 1
- 2













