摘要:
不要去下载开源项目的最新版本,应当优先考虑稳定的版本!!!!!!!!!!!!!!!!!!
阅读全文
posted @ 2025-03-11 21:10
凯申物流——
阅读(42)
推荐(0)
摘要:
不要使用2.4.1版本的pytorch,使用2.3.1+cu121版本
阅读全文
posted @ 2024-10-22 21:15
凯申物流——
阅读(48)
推荐(0)
摘要:
点击查看代码 # -*- coding: utf-8 -*- # @Author : 钱力 # @Time : 2024/7/27 8:48 import torch # 标量求导 x = torch.tensor(-2.0, requires_grad=True) # x需要被求导 b = tor
阅读全文
posted @ 2024-07-27 10:00
凯申物流——
阅读(18)
推荐(0)
摘要:
点击查看代码 # -*- coding: utf-8 -*- # @Author : 钱力 # @Time : 2024/7/26 14:24 import torch # 合并操作 A = torch.arange(0, 16).view(2, 8) B = 10 * A C = torch.ca
阅读全文
posted @ 2024-07-26 15:58
凯申物流——
阅读(16)
推荐(0)
摘要:
点击查看代码 # -*- coding: utf-8 -*- # @Author : 钱力 # @Time : 2024/7/26 10:36 import torch a = torch.arange(5) b = a[2:] # 截取a的部分值 print('a', a) print('b',
阅读全文
posted @ 2024-07-26 14:24
凯申物流——
阅读(26)
推荐(0)
摘要:
通过list生成 tensor生成及存储方式 # 张量生成从pyhton中的list生成 x = torch.tensor([1, 2, 3]) print(x) print(x.dtype) # 半精度 x = torch.tensor([1, 2, 3]).to(torch.float16) p
阅读全文
posted @ 2024-07-26 10:36
凯申物流——
阅读(27)
推荐(0)
摘要:
Encoder #导入包 import torch from torch import nn import torch.nn.functional as f import math class PositionwiseFeedForward(nn.Module): def __init__(self
阅读全文
posted @ 2024-07-23 20:00
凯申物流——
阅读(33)
推荐(0)
摘要:
Layer Normalization #导入包 import torch from torch import nn import torch.nn.functional as f import math from math import sqrt class LayerNormal(nn.Modu
阅读全文
posted @ 2024-07-23 16:45
凯申物流——
阅读(16)
推荐(0)
摘要:
Muti Head Attention Muti Head Attention #导入包 import torch from torch import nn import torch.nn.functional as f import math x = torch.rand(128,32,512)
阅读全文
posted @ 2024-07-23 16:45
凯申物流——
阅读(30)
推荐(0)
摘要:
导包 #导入包 import torch from torch import nn import torch.nn.functional as f import math TokenEmbedding #首先定义token embadding from torch import Tensor """
阅读全文
posted @ 2024-07-23 16:45
凯申物流——
阅读(82)
推荐(0)