/images/avatar.png

vllbc

GPT

GPT 预训练(从左到右的 Transformer 语言模型) GPT 是一种基于 Transformer 的从左到右的语言模型。该架构是一个 12 层的 Transformer 解码器(没有解码器-编码器)。 ## 模型架构 就是12层的

最长回文子串

最长回文子串 题目: ​ https://leetcode-cn.com/problems/longest-palindromic-substring/ 思路: ​ 一开始暴力解法,比较好想,结果超时了哎,后来看见了标签是动态规划,才知道不能暴力 class Solution: def longestPalindrome(self, s: str) -> str: if len(s) <= 1: return s maxs

有效的数独

有效的数独 https://leetcode-cn.com/problems/valid-sudoku/ #有效的数独 难点在将3*3里的数取出来 class Solution: def isValidSudoku(board) -> bool: for line1,line2 in zip(board,zip(*board)): #行列 for n1,n2 in zip(line1,line2): if (n1 != '.' and line1.count(n1) > 1) or (n2!='.' and line2.count(n2) >1): return False pal = [[board[i+m][j+n] for m in range(3) for n in range(3) if board[i+m][j+n]

start

开始! 用import torch导入pytorch库 不要打成import pytorch哦~ 下面是我的学习记录: import torch#导入模块 x = tor

旋转图像

旋转图像 https://leetcode-cn.com/problems/rotate-image/ 没难度的中等题,这方法很python class Solution: def rotate(self, matrix: List[List[int]]) -> None: """ Do not return anything, modify matrix in-place instead. """ n = len(matrix) for i in list(map(list,map(reversed,zip(*matrix)))): matrix.append(i) del matrix[:n]