最近在读《代码之髓》,里面讲解了很多编程语言中的concepts是为何产生的。本篇笔记主要参考了书中的第7章:名字与作用域。

转自:米游社@战小医仙

阅读全文 »

This is an automatically translated post by LLM. The original post is in Chinese. If you find any translation errors, please leave a comment to help me improve the translation. Thanks!

Recently, I have been reading "The Essence of Code", which explains the concepts behind many programming languages. This note mainly refers to Chapter 7 of the book: Names and Scopes.

转自:米游社@战小医仙
阅读全文 »

在使用WSL2时,系统有空余内存的情况下,Linux子系统在运行时会不断分配系统内存。随着其不断运行,占据的内存越来越大,甚至会将Windows系统内存占满。因此,在运行WSL时要限制其内存的使用。

阅读全文 »

This is an automatically translated post by LLM. The original post is in Chinese. If you find any translation errors, please leave a comment to help me improve the translation. Thanks!

When using WSL2, the Linux subsystem will continuously allocate system memory while running, as long as there is available memory in the system. As it continues to run, it will occupy more and more memory, and may even fill up the memory of the Windows system. Therefore, it is necessary to limit its memory usage when running WSL.

The operation process is as follows:

  1. Create a .wslconfig configuration file in the user directory.

    • Open the command line.
    • Enter the command notepad .wslconfig to create and edit the configuration file.
  2. Write the WSL configuration:

    1
    2
    3
    4
    [wsl2]
    memory=2GB
    swap=8GB
    localhostForwarding=true

  3. Restart WSL using wsl --shutdown.

关于网络的parameters

Pytorch中,每一个网络继承于nn.Module类,当实例化之后,是通过维护一下8个字典来实现各种网络功能的:

1
2
3
4
5
6
7
8
_parameters
_buffers
_backward_hooks
_forward_hooks
_forward_pre_hooks
_state_dict_hooks
_load_state_dict_pre_hooks
_modules
阅读全文 »

This is an automatically translated post by LLM. The original post is in Chinese. If you find any translation errors, please leave a comment to help me improve the translation. Thanks!

About Network Parameters

In Pytorch, each network inherits from the nn.Module class and implements various network functions by maintaining the following eight dictionaries after instantiation:

1
2
3
4
5
6
7
8
_parameters
_buffers
_backward_hooks
_forward_hooks
_forward_pre_hooks
_state_dict_hooks
_load_state_dict_pre_hooks
_modules
阅读全文 »

Day 0

硕士研究生时期,需要参与一项社会实践。遂与好友相约前往云南施甸县支教。原本的安排是县里中学一所,村里中学一所以及山里中学一所。起初计划前往山里中学实行采蘑菇计划,然天有不测风云,支教团计划变更,改为前往施甸二中和施甸三中支教。我们二人被安排在施甸二中。

去程,西安途径昆明转机到保山,校方从保山机场接我们到学校。途中经过秦岭山脉,云贵高原。从北方到南方,从平原到山地再到高原。无论是空中的气候,还是地貌,均变化多样。

(摄影师: 蔡育倍)
阅读全文 »

This is an automatically translated post by LLM. The original post is in Chinese. If you find any translation errors, please leave a comment to help me improve the translation. Thanks!

Day 0

During my master's studies, I needed to participate in a social practice. So I made an appointment with a friend to go to Shidian County, Yunnan Province to teach. The original plan was to go to a middle school in the county, a middle school in the village, and a middle school in the mountains. Initially, we planned to go to the mountain middle school to implement the mushroom picking plan. However, due to unforeseen circumstances, the teaching support team's plan changed, and we were assigned to Shidian No. 2 Middle School.

On the way there, we flew from Xi'an to Kunming and then transferred to Baoshan. The school arranged for us to be picked up from Baoshan Airport and taken to the school. Along the way, we passed through the Qinling Mountains and the Yungui Plateau. From the north to the south, from the plains to the mountains, and then to the plateau, both the climate and the topography changed diversely.

During the descent of the plane, I looked down from the air and found that the architectural style in Yunnan cities is basically the same as the standard style in China. On the way to the school, the architecture in the county and the countryside was no different from that in the county and countryside of Shaanxi where I was located. When we arrived at the school, everything, including the school gate, beds, and architectural style, was in a classic style. This is the result of industrialization, where various materials can be standardized to reduce costs and allow more people to use them. It is also the result of China's system, where good models are promoted nationwide, benefiting more people. However, such uniformity can make people feel a bit lonely. China is a country spanning more than 5,000 kilometers, with various landforms and climates, as well as various dialects and customs. However, with the advancement of modernization and urbanization, our cities and rural areas have gradually become uniform. This makes me wonder, is there an inevitable conflict between modernization, urbanization, socialist characteristics, and regional individuality?

First of all, modernization (industrialization) allows standardized goods to be mass-produced at very low costs, providing a material basis for the convergence of regional individuality. However, industrialization alone is not enough, because China is vast and has a large population. The process of industrialization can be developed asynchronously in different places, so that each city in the country has its corresponding industrial characteristics.

Urbanization is closely related to industrialization and brings not only material abundance but also changes in thinking. Relatively speaking, rural people have a better understanding of and attach more importance to local traditional customs, and have a higher level of mastery of dialects. On the other hand, urban people have more communication and interaction with the outside world, and have a higher level of mastery of the common language. Therefore, relatively speaking, rural people have more regional characteristics, while urban people have more universality. Urbanization has a certain impact on people's thinking. However, it is undeniable that cities are developed based on the foundation of rural areas, and their development generally has a certain continuity. Therefore, it is difficult to conclude that urbanization erases regional individuality.

Finally, there is China's unique system. The dual driving forces of modernization and urbanization, both economically and ideologically, have brought about industrial social standards and universal concepts. The unified decision-making at the national level undoubtedly further expands the advantages brought by industrialization, namely, low cost. If all industrial products in the country are produced and purchased together, compared with each place developing its own industry, the cost of industrial products in each professional category can be further reduced, thereby reducing the overall industrial production cost in the country. This is its remarkable advantage and the reason why some products developed in China can be sold at very low prices after they are developed (a huge demand market + e-commerce has eliminated regional characteristics). It must be said that in the early stages of China's industrial development, this method can be said to be the best solution. That is, to seek the fastest development at the lowest cost. However, now, with the sluggish growth of China's economy and the urgent need for industrial transformation, perhaps we should turn our attention to regional individuality. On the 9.6 million square kilometers of land, there should not be only one type of dormitory bed.

When I entered Shidian No. 2 Middle School today, I saw a stone with the words "China University of Geosciences Aid Construction" written on it. After entering the campus and looking at the various facilities in the school, I couldn't help but feel emotional. A university is called a university not only because of its great achievements, but also because it should shoulder the great responsibility of society and contribute to social progress and development. As university students, we should also take on more social responsibilities and strive to make this society better.

Day 1

It's the first day at Shidian No. 2 Middle School. The main task is to coordinate with the corresponding substitute teachers. The teacher who will be guiding me is Mr. Chang, the physics teacher of the Grade 9 teaching and research group. The course I will be teaching is Grade 9 physics. During the discussion, Mr. Chang mentioned that they are currently studying internal energy, and the next two weeks will focus on the topic of heat engines. Today, I assigned a set of exercises on internal energy, and the students will complete them during the two-day break. When they come back, we will start with the exercises.

I am responsible for three classes: Class 205, Class 206, and Class 207. Coincidentally, Class 207 has a physics class in the afternoon. I took this opportunity to get to know the students quickly. The preparation for this class was rushed, mainly focusing on the origin, development, and application of physics, as well as its future development. In the evening, I also attended a class in Wang Weitao's class.

Overall, these students have left a deep impression on me with their thirst for knowledge. When I ask questions or talk about new knowledge, students from the front row to the back row listen attentively. The same goes for when I listen to classes in other classes. Another impression is their youth. Youth represents unlimited possibilities. Looking at these young students, I always want to share more with them in my limited time and have a positive impact on them.

In the afternoon, a high school teacher told me that it is very difficult to provide summer classes for senior high school students here. Some students report the school for providing summer classes, some parents help their children take leave to avoid summer classes and the college entrance examination, and some parents come to the school to demand summer classes when the school does not provide them. The situation is quite complicated. In addition, classes here have a two-day weekend (starting on Friday afternoon, which should actually be two and a half days), while some schools in the city only have one day off per month. As a result, high school education here faces significant challenges.

Day 2

Today, we went to 707 Town, which is named after its distance of 707 kilometers from Kunming. We had mushroom hot pot for lunch.

In the afternoon, we went to Shidian County to taste the hand-grabbed rice.

In the evening, we had a small barbecue party with roasted pig skin, snail meat, chicken gizzards, intestines, and ribs.

Good night.

Day 3

We woke up at 6 a.m. and went to Baoshan City. We passed through 707 Town, which is named after its distance of 707 kilometers from Kunming. In Baoshan City, we had mushroom hot pot for lunch.

In the afternoon, we went to Shidian County to taste the hand-grabbed rice.

In the evening, we had a small barbecue party with roasted pig skin, snail meat, chicken gizzards, intestines, and ribs.

Good night.

Day 4

  • Nothing to do.

Day 5

Today is the first official day of teaching. Last week, Mr. Chang assigned a physics exercise to Classes 205, 206, and 207. The main task today is to explain this exercise. The first class was Class 206, and I was the one teaching, while Mr. Chang sat at the back and listened.

After class, Mr. Chang gave me some suggestions:

  • The way of explanation can be more specific. For example, when analyzing questions related to specific heat capacity, I can use water and sand as examples to explain, instead of using abstract concepts like substance A and substance B, which may cause difficulties for students to understand.
  • The pace of the class needs to be adjusted. Some simple and repetitive conceptual questions can be explained more quickly. More time can be allocated to calculation questions that students are prone to make mistakes in.
  • Some time can be allocated for students to do exercises during class. Normally, students don't do homework after class.

It was the first time I taught formal teaching content, and there were still many shortcomings due to my lack of understanding of the students' situation and lack of experience. The teaching curriculum in middle school is different from university courses, speeches, and sharing sessions. It is mainly designed with the goal of getting students to answer questions correctly, and guiding interest and knowledge expansion is very rare.

Day 6

The self-study class here is divided into two sessions. The first session is from 7:00 p.m. to 7:50 p.m., lasting for 50 minutes, which is similar to a regular middle school class. The second session is from 8:00 p.m. to 10:00 p.m., with a 20-minute break from 8:50 p.m. to 9:10 p.m. During this break, students usually go to the cafeteria and supermarket for additional meals.

Today is the self-study class for Classes 205 and 206. This class includes three activities:

  • "Game of Game Theory Course at Stanford University"

    A small game introduced in the Game Theory course at Stanford University: Each student writes down a number between 0 and 100, and the student whose number is closest to two-thirds of the average of all the numbers wins the prize prepared for the game.

  • Book distribution: "Fascinating Materials"

    This book is one of the recommended books in the 100 Must-Read Classics of Xi'an Jiaotong University. It introduces ten common materials in life. Suitable for all ages.

  • Q&A session

    An idea proposed by Teacher Sun from the teaching support team. Considering that some students may be reluctant to raise their hands to ask questions directly, they are asked to write down their questions on paper and then collect them for on-the-spot answers.

The final results of the three classes were approximately 26, 30, and 30. Following the results of this game, I introduced the field of game theory to the students. At the same time, I also shared a bit about my life as a graduate student.

During the Q&A session, the students asked questions mainly focused on emotions, learning, and family. Some of the questions that left a deep impression on me were:

  • How to balance friendship, love, study, and life?
  • What should we do if our parents and teachers don't understand us?
  • Why do we have to study?
  • Which is more important, suitability or feelings?

After answering the questions one by one, I organized the questions they wrote and took them back to Xi'an. Later, I plan to scan them and keep a copy.

In Class 205, the last question asked was, "Teacher, can you show us a movie?" Coincidentally, I showed them a micro-movie I had filmed beforewhich took up ten minutes of the class break.

Finally, I also left them my contact information. After thinking about it, leaving an email address is the most appropriate.

In the evening, I heard from a high school teacher that it is very difficult to provide summer classes for senior high school students here. Some students report the school for providing summer classes, some parents help their children take leave to avoid summer classes and the college entrance examination, and some parents come to the school to demand summer classes when the school does not provide them. The situation is quite complicated. In addition, classes here have a two-day weekend (starting on Friday afternoon, which should actually be two and a half days), while some schools in the city only have one day off per month. As a result, high school education here faces significant challenges.

Day 7

Today is the self-study class for Class 207. The content and activities are similar to yesterday's class. However, Class 207 is relatively more active, and there were many interesting questions asked.

One thing I noticed is that writing questions on paper can receive a greater quantity and higher quality of questions. The longer the time given for these questions, the higher the probability of asking high-quality questions. On the other hand, directly asking questions in class results in more general and easy questions (such as black history, emotional experiences, and life regrets, similar to "truth or dare").

The first thing I did after each class was to quickly get some water in the office. Teaching so many classes in a row made me both sleepy and thirsty. Overall, high-intensity teaching does take a toll on the body.

For lunch, I had dumplings from here, which were very good. I also discovered that I have gradually developed a liking for mint.

In the afternoon, I listened to a high school teacher talking about the difficulties of providing summer classes for senior high school students here. Some students report the school for providing summer classes, some parents help their children take leave to avoid summer classes and the college entrance examination, and some parents come to the school to demand summer classes when the school does not provide them. The situation is quite complicated. In addition, classes here have a two-day weekend (starting on Friday afternoon, which should actually be two and a half days), while some schools in the city only have one day off per month. As a result, high school education here faces significant challenges.

Day 8

Today, there are three physics classes according to the schedule, which will be taught in three different classes. The prepared teaching content mainly covers heat engines and the law of energy conservation. While preparing, I happened to see that Ruanyifeng's Science Weekly had been updated, so I selected some content from it as the opening of the class. I also shared the website with the students.

After comparing, I found that writing questions on paper can receive a greater quantity and higher quality of questions. The longer the time given for these questions, the higher the probability of asking high-quality questions. On the other hand, directly asking questions in class results in more general and easy questions (such as black history, emotional experiences, and life regrets, similar to "truth or dare").

During the lunch break, the teachers from the teaching support team informed us that there is only one more day left for the teachers at the school, and the summer course will end here. This change came three days earlier than planned, which caught us off guard. Originally, we planned to teach Class 208 on Wednesday, but now we only have one day of classes left on Monday.

In response to this sudden change, our teaching support team contacted the school's teachers overnight and negotiated that the last day's classes would all be taught by the teaching support team. In addition, I also discussed with Teacher Lvlin and asked for half of the evening self-study class to teach Class 208.which I promised during the dinner at the student's house

Coincidentally, the physics teacher who guided me had five classes that day. In addition to the three classes in the morning, he also exchanged two classes with the physical education teacher. In total, he had to teach five classes. Combined with the evening self-study class for Class 208, there were a total of six class hours to be taught.

In the morning, I helped the research group collect questionnaire survey results in the class. I thought for a long time about what to teach in the last class for the students in the afternoon. Finally, I thought of the many students who were curious about my research when they learned that I was a graduate student, so I decided to popularize some knowledge in this area for them. During the lunch break, I collected materials from several friends who are currently doing or have completed research or projects, and prepared the last class for the students.

Although I explained these research contents in the simplest way, due to the inclusion of multiple research directions, the students' knowledge is limited, and it can be seen that there are some students who completely do not understand some of the content. However, at the same time, there are also some students who can understand and are very interested in some parts of the content.

In the evening, I taught the first class for Class 208 during the self-study class. It was also the last class. I quickly finished my sharing of my graduate student life and quickly moved on to the Q&A session, which was a chat with the students. Their class is the most active in Grade 9, and they ask questions directly, so there was no need to write them on paper.

After comparison, writing questions on paper can receive a greater quantity and higher quality of questions, and the longer the time given for these questions, the higher the probability of asking high-quality questions. On the other hand, directly asking questions in class results in more general and easy questions (such as black history, emotional experiences, and life regrets, similar to "truth or dare").

The first thing I did after each class was to quickly get some water in the office. Teaching so many classes in a row made me both sleepy and thirsty. Overall, high-intensity teaching does take a toll on the body.

For lunch, I had a bowl of the local specialty, bean curd skin rice noodles.

In the afternoon, I went to the office to listen to a high school teacher talking about the difficulties of providing summer classes for senior high school students here. Some students report the school for providing summer classes, some parents help their children take leave to avoid summer classes and the college entrance examination, and some parents come to the school to demand summer classes when the school does not provide them. The situation is quite complicated. In addition, classes here have a two-day weekend (starting on Friday afternoon, which should actually be two and a half days), while some schools in the city only have one day off per month. As a result, high school education here faces significant challenges.

Day 9

The students have a day off today. After teaching two classes in the morning, we cleaned up the classroom and went home. Last night, the principal told us that the teachers at the school would leave in one day, and the summer course would end here. This change came three days earlier than planned, which caught us off guard. Originally, we planned to teach Class 208 on Wednesday, but now we only have one day of classes left on Monday.

In response to this sudden change, our teaching support team contacted the school's teachers overnight and negotiated that the last day's classes would all be taught by the teaching support team. In addition, I also discussed with Lvlin Teacher and asked for half of the evening self-study class to teach Class 208.which I promised during the dinner at the student's house

Coincidentally, the physics teacher who guided me had five classes that day. In addition to the three classes in the morning, he also exchanged two classes with the physical education teacher, totaling five classes. Combined with the evening self-study class for Class 208, there were a total of six class hours to be taught.

In the morning, I helped the research group collect questionnaire survey results in the class. During the break, I thought about what to teach in the last class for the students in the afternoon. Finally, I thought of the many students who were curious about my research when they learned that I was a graduate student, so I decided to popularize some knowledge in this area for them. The research I introduced covers multiple directions, and the students' knowledge is limited, so it can be seen that some students completely do not understand some of the content. However, at the same time, there are also some students who can understand and are very interested in some parts of the content.

In the evening, I taught the first class for Class 208 during the self-study class. It was also the last class. I quickly finished my sharing of my graduate student life and quickly moved on to the Q&A session, which was a chat with the students. Their class is the most active in Grade 9, and they ask questions directly, so there was no need to write them on paper.

Every class, the first thing I did after class was to quickly get some water in the office. Teaching so many classes in a row made me both sleepy and thirsty. Overall, high-intensity teaching does take a toll on the body.

For lunch, I had a bowl of dumplings from here, which were very good. I also found that I have gradually developed a liking for mint.

In the afternoon, I listened to a high school teacher talking about the difficulties of providing summer classes for senior high school students here. Some students report the school for providing summer classes, some parents help their children take leave to avoid summer classes and the college entrance examination, and some parents come to the school to demand summer classes when the school does not provide them. The situation is quite complicated. In addition, classes here have a two-day weekend (starting on Friday afternoon, which should actually be two and a half days), while some schools in the city only have one day off per month. As a result, high school education here faces significant challenges.

Day 10

We went to the mango market in the morning and then went straight to Kunming. In the morning, we had the last crispy bun, and it was a pity that there was no ham filling. The school arranged a car to take us to Baoshan Airport and Baoshan Railway Station.

After arriving in Kunming, it started pouring rain outside as soon as we checked in at the homestay. The rain came and went quickly, stopping after about half an hour.

We went to the restaurant recommended by Dongqiang for dinner, but we couldn't find a place to eat after searching for a long time. So Dongqiang came to meet us and took us to a place to have a proper meal. We didn't have dinner, so we went to eat the Shantou hot pot where every kind of meat is 13 seconds. After dinner, we walked around outside for a while and then took a taxi back to the homestay to sleep.

Day 11

The original plan for today was to go to the Dounan Flower Market in the morning and then go directly to Kunming South Railway Station to take the high-speed train back to Xi'an. When we took a taxi from the accommodation to the subway station, a police officer told us that the flower market is better to visit in the evening because in the morning, the flower farmers are picking flowers, and now there are only some fixed stalls. In the evening, the flower market is usually more lively, with activities such as throwing and picking flowers.

So we decided to change our plan and go to Guandu Ancient Town instead.

We walked around there and saw children studying hard.

We had a bowl of tofu pudding rice noodles for lunch.

We carried our luggage and went back to Xi'an by high-speed train.

The End

引言

在科研和工程实践的过程中,问题的解决往往伴随着新问题的发生。往往这些问题都是在特定场景下才会出现,但是其问题的抽象又具有一定的普适性,从而这些问题能够构成一个个科学研究的起点。

阅读全文 »

This is an automatically translated post by LLM. The original post is in Chinese. If you find any translation errors, please leave a comment to help me improve the translation. Thanks!

Introduction

In the process of scientific research and engineering practice, the solution to a problem often comes with the emergence of new problems. These problems often occur in specific scenarios, but their abstractions have a certain universality, making them the starting point for scientific research.

阅读全文 »
0%