12 2020 档案
摘要:x = 50000011 s = '${:1.1f}M'.format(x*1e-6) print(s) s = '${:1.0f}K'.format(x * 1e-3) print(s) s = '${:.3f}K'.format(x * 1e-3) print(s) s = '%.3f' % (
阅读全文
摘要:import torch.nn as nn import torch # input = torch.randn(20, 5, 10, 10) # # With Learnable Parameters # m = nn.LayerNorm(input.size()[1:]) # # Without
阅读全文
摘要:import tensorflow as tf print(tf.eye(2)) batch_identity = tf.eye(2, batch_shape=[3]) print(batch_identity) print(tf.eye(2, num_columns=3)) E:\新脚本主文件夹\
阅读全文
摘要:from transformers import pipeline from transformers import AutoTokenizer tokenizer = AutoTokenizer.from_pretrained('bert-base-cased') # encoded_input
阅读全文
摘要:如上
阅读全文
摘要:Xavier在tanh中表现的很好,但在Relu激活函数中表现的很差,所何凯明提出了针对于relu的初始化方法。pytorch默认使用kaiming正态分布初始化卷积层参数。 (1)kaiming均匀分布 U(−bound,bound) (2)kaiming正态分布 N(0,std)
阅读全文
摘要:import numpy as np lis = [1, 5, -9, 3, -6, 8, -7, 5, 5, 5, 4, 4, 4, 6, 6, 6, 6] lis = np.array(lis) lis[lis <= 0] = 100 print(lis) [ 1 5 100 3 100 8 1
阅读全文
摘要:import torch import torchvision import torch.nn as nn import torch.nn.functional as F x = torch.randn(3, 4) print(x) print() sorted, indices = torch.s
阅读全文
摘要:import torch import torchvision import torch.nn as nn import torch.nn.functional as F # x = torch.randn(2, 3) x = torch.randn(2, 3,4) print(x) print()
阅读全文
摘要:hardsigmoid torch.nn.functional.hardsigmoid(input) → Tensor[SOURCE] Applies the element-wise function \text{Hardsigmoid}(x) = \begin{cases} 0 & \text{
阅读全文

浙公网安备 33010602011771号