 【PyTorch深度学习-龙龙老师】-测试版202112stddev2)分布的张量。例如,创建均值为 1,标准差为 0.5 的正态分布: In [34]: a = torch.empty(2,3) # 创建 2 行 3 列的未初始化张量 a.normal_(mean=1,std=0.5) # 采用均值为 1,标注差为 0.5 的正态分布初始化 Out[34]: tensor([[1.6049, 1.1765, 0.6371], [1.2312, 函数可以实现张量分割外,PyTorch 还提供了另一个函数 torch.chunk。他的 用法与 torch.split 非常类似,区别在于 chunk 函数的参数 chunks 指定了切割份数,而 split 函数的参数 split_size_or_sections 则是每份长度,本质上两个函数是等价的。例如,将总成 绩册张量在班级维度进行 chunk 操作,等分为 2 份,代码如下: In [11]: randn([10,35,8]) a,b = torch.chunk(x, chunks=2, dim=0) # 等分为 2 份 a.shape, b.shape Out[11]: (torch.Size([5, 35, 8]), torch.Size([5, 35, 8])) 将总成绩册张量在班级维度进行 chunk 操作,等分为 10 份,代码如下: In [12]:0 码力 | 439 页 | 29.91 MB | 1 年前3 【PyTorch深度学习-龙龙老师】-测试版202112stddev2)分布的张量。例如,创建均值为 1,标准差为 0.5 的正态分布: In [34]: a = torch.empty(2,3) # 创建 2 行 3 列的未初始化张量 a.normal_(mean=1,std=0.5) # 采用均值为 1,标注差为 0.5 的正态分布初始化 Out[34]: tensor([[1.6049, 1.1765, 0.6371], [1.2312, 函数可以实现张量分割外,PyTorch 还提供了另一个函数 torch.chunk。他的 用法与 torch.split 非常类似,区别在于 chunk 函数的参数 chunks 指定了切割份数,而 split 函数的参数 split_size_or_sections 则是每份长度,本质上两个函数是等价的。例如,将总成 绩册张量在班级维度进行 chunk 操作,等分为 2 份,代码如下: In [11]: randn([10,35,8]) a,b = torch.chunk(x, chunks=2, dim=0) # 等分为 2 份 a.shape, b.shape Out[11]: (torch.Size([5, 35, 8]), torch.Size([5, 35, 8])) 将总成绩册张量在班级维度进行 chunk 操作,等分为 10 份,代码如下: In [12]:0 码力 | 439 页 | 29.91 MB | 1 年前3
 AI大模型千问 qwen 中文文档also choose bge-large or bge-small as the embedding model or modify the context window size or text chunk size depending on your computing resources. Qwen 1.5 model families support a maximum of 32K context model_name = "BAAI/bge-base-en-v1.5" ) # Set the size of the text chunk for retrieval Settings.transformations = [SentenceSplitter(chunk_size=1024)] 1.15.3 现在,我们可以设置语言模型和向量模型。Qwen1.5-Chat 支持包括英语和中文 在内的多种语言对话。您可以使用 lists.append(ls1) ls1 = [ls[i]] lists.append(ls1) return lists class FAISSWrapper(FAISS): chunk_size = 250 chunk_conent = True score_threshold = 0 def similarity_search_with_score_by_vector( self, embedding:0 码力 | 56 页 | 835.78 KB | 1 年前3 AI大模型千问 qwen 中文文档also choose bge-large or bge-small as the embedding model or modify the context window size or text chunk size depending on your computing resources. Qwen 1.5 model families support a maximum of 32K context model_name = "BAAI/bge-base-en-v1.5" ) # Set the size of the text chunk for retrieval Settings.transformations = [SentenceSplitter(chunk_size=1024)] 1.15.3 现在,我们可以设置语言模型和向量模型。Qwen1.5-Chat 支持包括英语和中文 在内的多种语言对话。您可以使用 lists.append(ls1) ls1 = [ls[i]] lists.append(ls1) return lists class FAISSWrapper(FAISS): chunk_size = 250 chunk_conent = True score_threshold = 0 def similarity_search_with_score_by_vector( self, embedding:0 码力 | 56 页 | 835.78 KB | 1 年前3
 深度学习与PyTorch入门实战 - 11. 合并与分割主讲人:龙良曲 Merge or split https://blog.openai.com/generative-models/ ▪ Cat ▪ Stack ▪ Split ▪ Chunk cat ▪ Statistics about scores ▪ [class1-4, students, scores] ▪ [class5-9, students, scores] Along Along distinct dim/axis ▪ Dim=d for example stack create new dim Cat v.s. stack Split: by len Chunk: by num Thank You.0 码力 | 10 页 | 974.80 KB | 1 年前3 深度学习与PyTorch入门实战 - 11. 合并与分割主讲人:龙良曲 Merge or split https://blog.openai.com/generative-models/ ▪ Cat ▪ Stack ▪ Split ▪ Chunk cat ▪ Statistics about scores ▪ [class1-4, students, scores] ▪ [class5-9, students, scores] Along Along distinct dim/axis ▪ Dim=d for example stack create new dim Cat v.s. stack Split: by len Chunk: by num Thank You.0 码力 | 10 页 | 974.80 KB | 1 年前3
 Keras: 基于 Python 的深度学习库ImageDataGenerator(featurewise_center=False, samplewise_center=False, featurewise_std_normalization=False, samplewise_std_normalization=False, zca_whitening=False, zca_epsilon=1e-06, rotation_range=0 布尔值。将输入数据的均值设置为 0,逐特征进行。 • samplewise_center: 布尔值。将每个样本的均值设置为 0。 • featurewise_std_normalization: Boolean. 布尔值。将输入除以数据标准差,逐特征进行。 • samplewise_std_normalization: 布尔值。将每个输入除以其标准差。 • zca_epsilon: ZCA 白化的 epsilon 值,默认为 to_categorical(y_test, num_classes) datagen = ImageDataGenerator( featurewise_center=True, featurewise_std_normalization=True, rotation_range=20, width_shift_range=0.2, height_shift_range=0.2, horizontal_flip=True)0 码力 | 257 页 | 1.19 MB | 1 年前3 Keras: 基于 Python 的深度学习库ImageDataGenerator(featurewise_center=False, samplewise_center=False, featurewise_std_normalization=False, samplewise_std_normalization=False, zca_whitening=False, zca_epsilon=1e-06, rotation_range=0 布尔值。将输入数据的均值设置为 0,逐特征进行。 • samplewise_center: 布尔值。将每个样本的均值设置为 0。 • featurewise_std_normalization: Boolean. 布尔值。将输入除以数据标准差,逐特征进行。 • samplewise_std_normalization: 布尔值。将每个输入除以其标准差。 • zca_epsilon: ZCA 白化的 epsilon 值,默认为 to_categorical(y_test, num_classes) datagen = ImageDataGenerator( featurewise_center=True, featurewise_std_normalization=True, rotation_range=20, width_shift_range=0.2, height_shift_range=0.2, horizontal_flip=True)0 码力 | 257 页 | 1.19 MB | 1 年前3
 《Efficient Deep Learning Book》[EDL] Chapter 7 - Automationreward) self.optimizer.apply_gradients( zip(grads, controller.rnn.trainable_variables) ) The next chunk of code puts everything together and runs the search for 150 episodes. controller = Controller()0 码力 | 33 页 | 2.48 MB | 1 年前3 《Efficient Deep Learning Book》[EDL] Chapter 7 - Automationreward) self.optimizer.apply_gradients( zip(grads, controller.rnn.trainable_variables) ) The next chunk of code puts everything together and runs the search for 150 episodes. controller = Controller()0 码力 | 33 页 | 2.48 MB | 1 年前3
 《Efficient Deep Learning Book》[EDL] Chapter 4 - Efficient Architecturesmechanisms. These ideas tackle the quadratic complexity at various levels. The simplest idea is to chunk the input sequence of length n into blocks of length b where b <<< n. The resulting score matrices0 码力 | 53 页 | 3.92 MB | 1 年前3 《Efficient Deep Learning Book》[EDL] Chapter 4 - Efficient Architecturesmechanisms. These ideas tackle the quadratic complexity at various levels. The simplest idea is to chunk the input sequence of length n into blocks of length b where b <<< n. The resulting score matrices0 码力 | 53 页 | 3.92 MB | 1 年前3
 动手学深度学习 v2.0sigma) for mu, sigma in params], xlabel='x', ylabel='p(x)', figsize=(4.5, 2.5), legend=[f'mean {mu}, std {sigma}' for mu, sigma in params]) 3.1. 线性回归 91 就像我们所看到的,改变均值会产生沿x轴的偏移,增加方差将会分散分布、降低其峰值。 均方误差损失 Flatten(), nn.Linear(784, 10)) def init_weights(m): if type(m) == nn.Linear: nn.init.normal_(m.weight, std=0.01) net.apply(init_weights); 3.7.2 重新审视Softmax的实现 在前面 3.6节的例子中,我们计算了模型的输出,然后将此输出送入交叉熵损失。从数学上讲,这是一件完全 ReLU(), nn.Linear(256, 10)) def init_weights(m): if type(m) == nn.Linear: nn.init.normal_(m.weight, std=0.01) net.apply(init_weights); 训练过程的实现与我们实现softmax回归时完全相同,这种模块化设计使我们能够将与模型架构有关的内容 独立出来。 batch_size0 码力 | 797 页 | 29.45 MB | 1 年前3 动手学深度学习 v2.0sigma) for mu, sigma in params], xlabel='x', ylabel='p(x)', figsize=(4.5, 2.5), legend=[f'mean {mu}, std {sigma}' for mu, sigma in params]) 3.1. 线性回归 91 就像我们所看到的,改变均值会产生沿x轴的偏移,增加方差将会分散分布、降低其峰值。 均方误差损失 Flatten(), nn.Linear(784, 10)) def init_weights(m): if type(m) == nn.Linear: nn.init.normal_(m.weight, std=0.01) net.apply(init_weights); 3.7.2 重新审视Softmax的实现 在前面 3.6节的例子中,我们计算了模型的输出,然后将此输出送入交叉熵损失。从数学上讲,这是一件完全 ReLU(), nn.Linear(256, 10)) def init_weights(m): if type(m) == nn.Linear: nn.init.normal_(m.weight, std=0.01) net.apply(init_weights); 训练过程的实现与我们实现softmax回归时完全相同,这种模块化设计使我们能够将与模型架构有关的内容 独立出来。 batch_size0 码力 | 797 页 | 29.45 MB | 1 年前3
 深度学习与PyTorch入门实战 - 07. 创建Tensordefault type rand/rand_like, randint ▪ [0, 1] ▪ [min, max) ▪ *_like randn ▪ N(0, 1) ▪ N(u, std) full arange/range linspace/logspace Ones/zeros/eye Ones/zeros/eye randperm ▪ random.shuffle0 码力 | 16 页 | 1.43 MB | 1 年前3 深度学习与PyTorch入门实战 - 07. 创建Tensordefault type rand/rand_like, randint ▪ [0, 1] ▪ [min, max) ▪ *_like randn ▪ N(0, 1) ▪ N(u, std) full arange/range linspace/logspace Ones/zeros/eye Ones/zeros/eye randperm ▪ random.shuffle0 码力 | 16 页 | 1.43 MB | 1 年前3
 深度学习与PyTorch入门实战 - 63. 迁移学习-自定义数据集实战Image Resize ▪ 224x224 for ResNet18 ▪ Data Argumentation ▪ Rotate ▪ Crop ▪ Normalize ▪ Mean, std ▪ ToTensor Step2.build model ▪ Inherit from base class ▪ Define forward graph Step3.Train and0 码力 | 16 页 | 719.15 KB | 1 年前3 深度学习与PyTorch入门实战 - 63. 迁移学习-自定义数据集实战Image Resize ▪ 224x224 for ResNet18 ▪ Data Argumentation ▪ Rotate ▪ Crop ▪ Normalize ▪ Mean, std ▪ ToTensor Step2.build model ▪ Inherit from base class ▪ Define forward graph Step3.Train and0 码力 | 16 页 | 719.15 KB | 1 年前3
 机器学习课程-温州大学-05深度学习-深度学习实践随机旋转 transforms.ToTensor(), # 转换为Tensor类型 transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) # 标准化 ]) # 加载图像数据 img = Image.open('image.jpg').convert('RGB') # 对图像进行数据增强0 码力 | 19 页 | 1.09 MB | 1 年前3 机器学习课程-温州大学-05深度学习-深度学习实践随机旋转 transforms.ToTensor(), # 转换为Tensor类型 transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) # 标准化 ]) # 加载图像数据 img = Image.open('image.jpg').convert('RGB') # 对图像进行数据增强0 码力 | 19 页 | 1.09 MB | 1 年前3
共 14 条
- 1
- 2













