Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
a computer's friend
Chinese-Text-Classification-Pytorch
提交
1b155e02
C
Chinese-Text-Classification-Pytorch
项目概览
a computer's friend
/
Chinese-Text-Classification-Pytorch
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Chinese-Text-Classification-Pytorch
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
1b155e02
编写于
7月 11, 2019
作者:
滴水无痕0801
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
''
上级
468b5ed3
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
0 addition
and
59 deletion
+0
-59
qq.py
qq.py
+0
-59
未找到文件。
qq.py
已删除
100644 → 0
浏览文件 @
468b5ed3
import
torch
import
torch.nn
as
nn
import
torch.nn.functional
as
F
import
math
import
numpy
as
np
# x = np.load('./THUCNews/data/vocab.embedding.sougou.npz')["embeddings"]
# print(x[0])
# print(len(x))
# print(len(x[0]))
# lis = []
# f = open('./THUCNews/data/sgns.sogou.char', encoding='UTF-8')
# for i, line in enumerate(f.readlines()):
# if i == 0:
# continue
# lin = line.split(' ')[0]
# lis.append(lin)
# f.close()
# print(lis)
# if '<PAD>' in lis:
# print('yes')
# if '<UNK>' in lis:
# print('yyyes')
# import argparse
# parser = argparse.ArgumentParser(description='TextCNN text classifier')
# # learning
# parser.add_argument('-lr', type=str, default='ppp', help='fff')
# parser.add_argument('-oo', type=str, default=lr+'ooo', help='fff')
# args = parser.parse_args()
# print(args.oo)
# dataset = 'THUCNews'
# embedding = 'embedding_SougouNews.npz' # random
# embedding_pretrained = torch.tensor(np.load(dataset + '/data/' + embedding)["embeddings"].astype('float32'))
# print(embedding_pretrained.size(1))
# mode_name = 'models.TextCNN'
# from models.+ mode_name import Config, TextCNN
# w = torch.randn(256)
# H = torch.randn(128, 32, 256)
# M = F.tanh(H)
# out = torch.matmul(M, w)
# print(out.size())
x
=
torch
.
randn
(
128
,
32
,
256
)
y
=
torch
.
randn
(
256
)
z
=
torch
.
matmul
(
x
,
y
)
print
(
z
.
size
())
xx
=
torch
.
tensor
([[
2
,
3
],[
3
,
4
]])
yy
=
xx
.
unsqueeze
(
-
1
)
print
(
xx
)
print
(
yy
)
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录