1 Star 0 Fork 0

wangye707/Test

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
111.py 777 Bytes
一键复制 编辑 原始数据 按行查看 历史
wangye707 提交于 2019-06-14 15:13 +08:00 . Add files via upload
#!D:/workplace/python
# -*- coding: utf-8 -*-
# @File : 111.py
# @Author: WangYe
# @Date : 2019/5/11
# @Software: PyCharm
import numpy as np
def wider(seq, l=5, n=5):
""" Converts a seq into a one-hot tensor. Not LxN but LxLxN"""
key = "HRKDE"
tensor = []
for i in range(l):
d2 = []
for j in range(l):
d1 = [1 if (j < len(seq) and i < len(seq) and key[x] == seq[i] and key[x] == seq[j]) else 0 for x in
range(n)]
d2.append(d1)
tensor.append(d2)
print(tensor)
print(len(tensor[0]))
print(len(tensor[0][0]))
# print(len(tensor[0][0][0]))
# print(tensor[0].shape())
return np.array(tensor)
SS = "HRHRH"
# wider(SS)
A = [1,2,3,4]
print(A[-1])
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/wangye707/Test.git
git@gitee.com:wangye707/Test.git
wangye707
Test
Test
master

搜索帮助