13 practical features you must know about PyTorch

1. DatasetFolder When learning PyTorch, one of the first things people need to do is to implement some kind of Dataset. This is a low-level mistake. There is no need to waste time writing such things. Typically, a Dataset is either a data list (or a numpy array) or a file on disk. Therefore, organizing data on disk is better than writing a cus ...

Added by fitzbean on Thu, 10 Mar 2022 15:33:35 +0200

python -- parameters of function

1. For the caller of a function, it is enough to know how to pass the correct parameters and what value the function will return. The complex logic inside the function is encapsulated and the caller does not need to know. 2. How to calculate x3? You can define another power3 function, but what if you want to calculate x4, x5? It is impossible t ...

Added by saariko on Thu, 10 Mar 2022 15:23:06 +0200

c + + correct singleton mode

1. Singleton mode Singleton mode is the most common mode. It is often used in the development process. The purpose is: There is only one instance. This instance can only hold one globally shared data, or only hold a pile of interfaces, etc. many singleton modes can be used. Recently, I found some common errors / problems in the process of rev ...

Added by glc650 on Thu, 10 Mar 2022 15:18:33 +0200

How to design a secure external interface, the old programmer summarized these points

Source: blog.csdn.net/xiaolizh/article/details/83011031 Bloggers have previously worked in the collection and payment system of Hengfeng Bank (equivalent to payment interface), including the current OLTP API transaction interface and the external data interface of virtual business. In short, when you have done a lot of projects and written a l ...

Added by Mikester on Thu, 10 Mar 2022 15:14:44 +0200

[data structure and algorithm] program internal skill Part 4 - stack

1, Principle of stack Stack is a linear table (commonly known as stack) that is restricted to insert and delete operations at one end The end at which operations are allowed is called the "top of the stack" The other fixed end is called "stack bottom" When there are no elements in the stack, it is c ...

Added by MNS on Thu, 10 Mar 2022 15:07:56 +0200

Self defined scheduling based on K8s scheduler

That is to write code according to the agreement, which is the same as when I first wrote mysql UDF and hive custom functions. Multiple schedulers are officially configured: https://kubernetes.io/zh/docs/tasks/extend-kubernetes/configure-multiple-schedulers/   Background: in order to realize the scheduling function of database service based on ...

Added by mattock on Thu, 10 Mar 2022 15:01:56 +0200

A Redis production accident cost the company millions

1, Antecedents There is a core project of the company. The client of redis has always used jedis. Later, the technical director asked to replace the jedis client with a more efficient lettuce client, and use the RedisTemplate class of spring framework to operate redis. However, the world is unpredictable. It is such a simple demand that makes ...

Added by HAVOCWIZARD on Thu, 10 Mar 2022 14:48:00 +0200

Design pattern - creation pattern - factory pattern (simple factory, factory method, abstract factory)

Factory Pattern provides the best way to create objects. We don't have to care about the creation details of objects, we just need to obtain different products according to different situations 1. Factory simple mode In the simple factory pattern, the method used to create instances is usually static, also known as static factory pattern. It ...

Added by wompas.dub on Thu, 10 Mar 2022 14:34:34 +0200

JS of front-end three piece set -- JavaScript built-in method

1,Number 1-1 properties MAX_VALUE JS is the largest number that can be representedMIN_VALUE JS is the smallest number that can be represented 1-2 method toFixed(length) specifies the decimal of the reserved lengthtoExponential() is represented by scientific countingtoPrecision(length) requires the number to display integer + decimal acc ...

Added by cty on Thu, 10 Mar 2022 14:28:18 +0200

Summary of common Linux commands

1, Document management 1. ls command – displays the content and attribute information under the specified working directory Options and parameters: -a: All files are listed together with hidden files (files starting with). Commonly used)-d: List only the directory itself, not the file data in the directory (common)-l: Long data s ...

Added by campsoup1988 on Thu, 10 Mar 2022 14:20:20 +0200