Keras: 基于 Python 的深度学习库fit(self, x=None, y=None, batch_size=None, epochs=1, verbose=1, callbacks=None, validation_split=0.0, validation_data=None, shuffle=True, class_weight=None, sample_weight=None, initial_epoch=0, steps_per_epoch=None fit(self, x=None, y=None, batch_size=None, epochs=1, verbose=1, callbacks=None, validation_split=0.0, validation_data=None, shuffle=True, class_weight=None, sample_weight=None, initial_epoch=0, steps_per_epoch=None TensorFlow 时,自动推理得到)。 5.2.10 ActivityRegularization [source] keras.layers.ActivityRegularization(l1=0.0, l2=0.0) 网络层,对基于代价函数的输入活动应用一个更新。 参数 • l1: L1 正则化因子 (正数浮点型)。 关于 KERAS 网络层 65 • l2: L2 正则化因子 (正数浮点型)。0 码力 | 257 页 | 1.19 MB | 1 年前3
《Efficient Deep Learning Book》[EDL] Chapter 5 - Advanced Compression Techniquessparsity_rate) # Set the respective indices to zero. w_1d[w_1d_sorted_indices[:num_elements_to_zero]] = 0.0 w = np.reshape(w_1d, w.shape) return w def compress(w): # Compress the weights matrix using gzip format(block.name, sparsity, total)) Output Block: conv_block_0 Sparsity: 0.0% Total Weights: 864 Block: conv_block_1 Sparsity: 0.0% Total Weights: 18432 Block: conv_block_2 Sparsity: 50.0% Total Weights: conv_transpose_block_13 Sparsity: 0.0% Total Weights: 4718592 Block: conv_transpose_block_14 Sparsity: 0.0% Total Weights: 1179648 Block: conv_transpose_block_15 Sparsity: 0.0% Total Weights: 294912 Block:0 码力 | 34 页 | 3.18 MB | 1 年前3
《Efficient Deep Learning Book》[EDL] Chapter 2 - Compression Techniques6.jpeg Solution: First, we will interpret the image in the form of a 2D matrix having values in [0.0, 1.0]. %matplotlib inline import matplotlib.pyplot as plt import matplotlib.image as mpimg img dequantize() methods from the previous exercises. However, in this case, the image data values lie in range [0.0, 1.0]. Take a look at the simulate_transmission() method below which uses this range to call quantize() def simulate_transmission(img, b): transmitted_image = quantize(img, 0.0, 1.0, b) decoded_image = dequantize(transmitted_image, 0.0, 1.0, b) plt.axis('off') plt.imshow(decoded_image) Figure 2-7 shows0 码力 | 33 页 | 1.96 MB | 1 年前3
keras tutorialimport Activation, Dense from keras import initializers my_init = initializers.RandomNormal(mean=0.0, stddev=0.05, seed=None) model.add(Dense(512, activation='relu', input_shape=(784,), kernel_initializer=my_init)) import Activation, Dense from keras import initializers my_init = initializers.TruncatedNormal(mean=0.0, stddev=0.05, seed=None) Keras 30 model.add(Dense(512, activation='relu', input_shape=(784 Activation, Dense from keras import constraints my_constrain = constraints.MinMaxNorm(min_value=0.0, max_value=1.0, rate=1.0, axis=0) model = Sequential() model.add(Dense(512, activation='relu', input_shape=(7840 码力 | 98 页 | 1.57 MB | 1 年前3
《Efficient Deep Learning Book》[EDL] Chapter 4 - Efficient Architecturesand represent each animal using two features, say cute and dangerous. We can assign values between 0.0 and 1.0 to these two features for different animals. The higher the value, the more that particular the various animals, using two features (cute and dangerous), each of which can take a value between 0.0 and 1.0. We manually picked these values for illustration. Going through table 4-1, cat and dog have closer to 1.0), and the output probabilities of a few other random classes (which should be close to 0.0). 8 Solving Skipgram is going to be identical, and is left as an exercise to the reader! We always0 码力 | 53 页 | 3.92 MB | 1 年前3
动手学深度学习 v2.0def __init__(self, n): self.data = [0.0] * n def add(self, *args): self.data = [a + float(b) for a, b in zip(self.data, args)] def reset(self): self.data = [0.0] * len(self.data) def __getitem__(self 通过 图6.2.1的输入张量X和卷积核张量K,我们来验证上述二维互相关运算的输出。 X = torch.tensor([[0.0, 1.0, 2.0], [3.0, 4.0, 5.0], [6.0, 7.0, 8.0]]) K = torch.tensor([[0.0, 1.0], [2.0, 3.0]]) corr2d(X, K) tensor([[19., 25.], [37., 43 1中的值相对应的输入张量X和核张量K,以验证互相关运算的输出。 X = torch.tensor([[[0.0, 1.0, 2.0], [3.0, 4.0, 5.0], [6.0, 7.0, 8.0]], [[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]]]) K = torch.tensor([[[0.0, 1.0], [2.0, 3.0]], [[1.0, 2.0], [30 码力 | 797 页 | 29.45 MB | 1 年前3
全连接神经网络实战. pytorch 版without the prior written permission of the publisher. Art. No 0 ISBN 000–00–0000–00–0 Edition 0.0 Cover design by Dezeming Family Published by Dezeming Printed in China 目录 0.1 本书前言 5 1 准备章节 ) transf orm 是对数据的转换,ToTensor() 函数将 PIL 图像或者 NumPy 的 ndarray 转换为 FloatTensor 类型的,并且把图像的每个像素值压缩到 [0.0,1.0] 之间。 target_transf orm 10 1.2. 导入样本数据 是标签的转换,分类中我们需要将标签表示为向量的形式,例如一共有三类,则表示为: [1 0 0] (1.20 码力 | 29 页 | 1.40 MB | 1 年前3
【PyTorch深度学习-龙龙老师】-测试版202112ax.xaxis.set_pane_color((1.0, 1.0, 1.0, 0.0)) ax.yaxis.set_pane_color((1.0, 1.0, 1.0, 0.0)) ax.zaxis.set_pane_color((1.0, 1.0, 1.0, 0.0)) # 绘制权值矩阵范围 surf = ax.plot_surface(X # 使用改进的策略与环境交互 s_prime, r, done, info = env.step(a) done_mask = 0.0 if done else 1.0 # 结束标志掩码 # 保存 5 元组 memory.put((s, a, r / 100.0, s_prime worker_idx = idx # 线程 id self.env = gym.make('CartPole-v0').unwrapped self.ep_loss = 0.0 在线程运行阶段,每个线程最多与环境交互 400 个回合,在回合开始,利用 client 网 络采样动作与环境进行交互,并保存至 Memory 对象。在回合结束,训练 Actor 网络和 Critic0 码力 | 439 页 | 29.91 MB | 1 年前3
《Efficient Deep Learning Book》[EDL] Chapter 6 - Advanced Learning Techniques - Technical Reviewprobabilistic dropping: Here is a bernoulli random variable, which is 1.0 with a probability and, 0.0 with a probability . Thus, during training the -th block will act as an identity function with probability0 码力 | 31 页 | 4.03 MB | 1 年前3
《Efficient Deep Learning Book》[EDL] Chapter 3 - Learning Techniquesproduced by the teacher model. This might be helpful when the model assigns probabilities very close to 0.0 or 1.0, which makes it almost identical to the regular ground-truth labels. In this case, we use the0 码力 | 56 页 | 18.93 MB | 1 年前3
共 10 条
- 1













