摘要: 链接:https://ac.nowcoder.com/acm/contest/73202/B 来源:牛客网 问题描述 有三种数量无限的砝码和一个天平,天平的一端有一个质量为\(m\)的物品,问能否通过放置砝码使得天平平衡? 输入描述: 第一行包含一个整数 \(T \ (1 \leq T \leq 1 阅读全文
posted @ 2024-01-17 16:33 哎呦哎(iui) 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 链接:https://ac.nowcoder.com/acm/contest/66943/B 来源:牛客网 对于一个小写字母而言,游游可以通过一次操作把这个字母变成相邻的字母。'a'和'b'相邻,'b'和'c'相邻,以此类推。特殊的,'a'和'z'也是相邻的。可以认为,小写字母的相邻规则为一个环。 阅读全文
posted @ 2023-10-26 17:44 哎呦哎(iui) 阅读(45) 评论(1) 推荐(0) 编辑
摘要: 链接:https://ac.nowcoder.com/acm/contest/64384/C 来源:牛客网 超市里一共有 \(n\) 个货架,\(m\) 个商品,一开始商品的位置是被打乱的,小Why需要将商品全部归位。 小Why在给货架编号后,实现了每个商品所在货架必然在其应在货架之前。 小Why决 阅读全文
posted @ 2023-09-20 17:34 哎呦哎(iui) 阅读(50) 评论(0) 推荐(0) 编辑
摘要: # 1 标量的导数 ![image](https://img2023.cnblogs.com/blog/1914163/202308/1914163-20230801204951013-651864837.png) # 2 亚导数 比如说$y=|x|$这个函数在x=0的时候时不可导的。当x>0,其到 阅读全文
posted @ 2023-08-02 23:29 哎呦哎(iui) 阅读(72) 评论(0) 推荐(0) 编辑
摘要: Tensor advanced operation ▪ Where ▪ Gather # where 返回的最终的tensor中的每一个值有可能来着A,也有可能来自B。 >torch.where(condition,A,B)->tensor 满足condition条件则该位置为A[..],否则为B[ 阅读全文
posted @ 2023-07-31 23:15 哎呦哎(iui) 阅读(5) 评论(0) 推荐(0) 编辑
摘要: statistics ▪ norm (范数) ▪ mean,sum (平均值,求和) ▪ prod (累乘) ▪ max, min, argmin, argmax ▪ kthvalue, topk(第k大) # norm(范式) 这里面有一范式和二范式。 一范式: $$||x||_1=\sum_k| 阅读全文
posted @ 2023-07-31 21:47 哎呦哎(iui) 阅读(104) 评论(0) 推荐(0) 编辑
摘要: Merge or split ▪ Cat(合并) ▪ Stack(合并) ▪ Split(拆分) ▪ Chunk(拆分) # 合并 ## cat 这个就是合并两个tensor 比如说有两个班级的成绩单,一个是1-4班的,一个是5-9班的,我们现在需要合并这两份成绩单。 ▪ Statistics ab 阅读全文
posted @ 2023-07-31 10:10 哎呦哎(iui) 阅读(54) 评论(0) 推荐(0) 编辑
摘要: ▪ View/reshape(这个是维度的变化) ▪ Squeeze/unsqueeze(维度的增加/减少) ▪ Transpose/t/permute(维度交换) ▪ Expand/repeat(维度的扩展) # view/reshape 这两个API,都是通用的a.reshape()和a.vie 阅读全文
posted @ 2023-07-30 19:02 哎呦哎(iui) 阅读(28) 评论(0) 推荐(0) 编辑
摘要: # indexing ``` a=torch.randn(4,3,28,28) a[0].shape # torch.Size([3, 28, 28]) a[0,0].shape # torch.Size([28, 28]) a[0,0,2,4] # tensor(0.6574) ``` # sel 阅读全文
posted @ 2023-07-30 16:15 哎呦哎(iui) 阅读(12) 评论(0) 推荐(0) 编辑
摘要: # Import from numpy >torch.from_numpy(data) ``` a=np.array([2,3.3]) a #array([2. , 3.3]) torch.from_numpy(a) #tensor([2.0000, 3.3000], dtype=torch.flo 阅读全文
posted @ 2023-07-30 10:52 哎呦哎(iui) 阅读(16) 评论(0) 推荐(0) 编辑