MATH20621 - Coursework3

Pandas入门教程(二十二):股票数据分析实战——yfinance 获取数据、技术指标与收益率分析 把 Pandas 用在真实场景,才能体会它的价值。本文以茅台股票为例,用 yfinance 获取历史行情,完成缺失值处理与列筛选,绘制收盘价曲线,计算 SMA 移动平均线与 RSI 相对强弱指数,并通过日收益率、累计收益率和波动率完成完整的量化分析流程。 阅读详情

Coursework 3
In this coursework, worth 70% of the marks for the course, you are required to write Python functions, by filling in code into the template below. Submit your Python script on Blackboard before the deadline on Thursday, 14th December 2023 at 1pm. (I suggest aiming to submit at least hour earlier, to avoid any last-minute computer problems).

Working independently
As with all assessed work in this unit, you must complete this coursework independently on your own. You are allowed to use online resources and all lecture notes and exercise solutions. The lecture notes from weeks 1 to 8 contain all that is required to solve the below problems. You are not allowed to ask other humans for help, and in particular, you are not allowed to send, give, or receive Python code to/from classmates and others. Use of AI generative tools, such as ChatGPT, is not permitted for this coursework.

See the University Guidelines for Academic Malpractice http://documents.manchester.ac.uk/display.aspx?DocID=2870 .

Code template
Use the template below (also available at https://personalpages.manchester.ac.uk/staff/chris.johnson/python/content/coursework_3/template.py ) to complete the assignment.

Add your name, university ID number and email address in the docstring at top of the file, where indicated
Add code in the functions where TODO comments are present, to implement the functions in the ten tasks below. To check that your code is working correctly, you may wish to add some of your own tests in the main() function, but nothing in your main() function will be assessed.
You are very welcome to add your own functions to the code, and call these from the assessed functions, if you feel that this will improve the structure your code.
Important:

Do not alter the names of any of the required functions, the format for the game state, the numbering of points on the board, or the file formats for saved/loaded games. Doing so may result in the loss of a significant number of marks. Ensure that the functions can be called with the parameters precisely as specified, and that, they return the appropriate values.
Do not add any code to your solution that is outside a function. The only line of code outside a function should be the final line, main() that calls your main function.
Ensure that the code you submit is valid python code which runs without crashing. If you are unable to complete some of the tasks, please make sure your code is still valid (e.g. by including the pass statement for any functions in which you do not have any code written)
“”"
MATH20621 - Coursework 3
Student name:
Student id:
Student mail:

Do not change any part of this string except to replace
the with your name, id and university email address.
“”"

def request_location(question_str):
“”"
Prompt the user for a board location, and return that location.

Takes a string parameter, which is displayed to the user as a prompt.

Raises InputError if input is not a valid integer, 
or RuntimeError if the location typed is not in the valid range.

*************************************************************
DO NOT change this function in any way
You MUST use this function for ALL user input in your program
*************************************************************
"""
loc = int(input(question_str))
if loc<0 or loc>=24:
    raise RuntimeError("Not a valid location")
return loc

def draw_board(g):
“”"
Display the board corresponding to the board state g to console.
Also displays the numbering for each point on the board, and the
number of counters left in each players hand, if any.
A reference to remind players of the number of each point is also displayed.

You may use this function in your program to display the board
to the user, but you may also use your own similar function, or
improve this one, to customise the display of the game as you choose
"""
def colored(r, g, b, text):
    """
    Spyder supports coloured text! This function creates coloured
    version of the text 'text' that can be printed to the console.
    The colour is specified with red (r), green (g), blue (b) components,
    each of which has a range 0-255.
    """
    return f"\033[38;2;{r};{g};{b}m{text}\033[0m"

def piece_char(i):
    """
    Return the (coloured) character corresponding to player i's counter,
    or a + to indicate an unoccupied point
    """
    if i==0:
        return colored(100,100,100,'+')
    elif i==1:
        return colored(255,60,60,'X')
    elif i==2:
        return colored(60,120,255,'O')

    
board = '''

x--------x--------x 0--------1--------2
| | | | | |
| x-----x-----x | | 3-----4-----5 |
| | | | | | | | | |
| | x–x–x | | | | 6–7–8 | |
| | | | | | | | | | | |
x–x–x x–x–x 9-10-11 12-13-14
| | | | | | | | | | | |
| | x–x–x | | | | 15-16-17 | |
| | | | | | | | | |
| x-----x-----x | | 18—19----20 |
| | | | | |
x--------x--------x 21------22-------23
‘’’
boardstr = ‘’
i = 0
for c in board:
if c==‘x’:
boardstr += piece_char(g[0][i])
i += 1
else:
boardstr += colored(100,100,100,c)
if g[1]>0 or g[2]>0:
boardstr += '\nPlayer 1: ’ + (piece_char(1)*g[1])
boardstr += '\nPlayer 2: ’ + (piece_char(2)*g[2])
print(boardstr)

#############################

The functions for each task

def is_adjacent(i, j):
# TODO: implement function here
pass

def new_game():
# TODO: implement function here
pass

def remaining_counters(g):
# TODO: implement function here
pass

def is_in_mill(g, i):
# TODO: implement function here
pass

def player_can_move(g):
# TODO: implement function here
pass

def place_counter(g, i):
# TODO: implement function here
pass

def move_counter(g, i, j):
# TODO: implement function here
pass

def remove_opponent_counter(g, i):
# TODO: implement function here
pass

def turn(g):
# TODO: implement function here
pass

def save_state(g, filename):
# TODO: implement function here
pass

def load_state(filename):
# TODO: implement function here
pass

def play_game():
# TODO: implement function here
pass

def main():
# You could add some tests to main()
# to check your functions are working as expected

# The main function will not be assessed. All code to
# play the game should be in the play_game() function,
# and so your main function should simply call this.
play_game()

main()
Feedback
As this is part of the course assessment, we will not be able to help you solving these problems in the lab classes or elsewhere. You will receive a feedback report with a score for each function, and some overall feedback on the code quality.

Please read the problem descriptions carefully! The problems should (hopefully) be formulated in a way that there are no doubts. In case there remains a question on a problem formulation, please post it to the Blackboard Discussion Forum and it will be answered. Errors in this document will be corrected and noted on the ‘errata’ list on Blackboard.

Nine Men’s Morris
Nine Men’s Morris is a two-player game played with counters on a board. It was popular in mediæval England, but has been played for over 2000 years. The game board consists of 16 lines, as follows:

┌──────────┬──────────┐
│ │ │
│ ┌──────┼──────┐ │
│ │ │ │ │
│ │ ┌──┴──┐ │ │
│ │ │ │ │ │
├───┼───┤ ├───┼───┤
│ │ │ │ │ │
│ │ └──┬──┘ │ │
│ │ │ │ │
│ └──────┼──────┘ │
│ │ │
└──────────┴──────────┘
Two players can place their counters (X for player 1, and O for player 2) on each of the 24 corners or intersections of the lines (we’ll call these ‘points’), leading to boards in play that look like, for example,

X──────────┬──────────┐
│ │ │
│ O──────O──────O │
│ │ │ │ │
│ │ ┌──┴──┐ │ │
│ │ │ │ │ │
X───X───┤ O───┼───X
│ │ │ │ │ │
│ │ └──┬──┘ │ │
│ │ │ │ │
│ └──────O──────┘ │
│ │ │
└──────────┴──────────X
The game is played in two stages:

The board starts with no counters on it, and each player starts with nine counters in their hand. Starting with player 1, they take it in turns to place their counters on unoccupied points on the board. If in placing a piece, a player manages to occupy all three points on a straight line with one of their counters (called forming a mill) then they may then remove one of their opponents counters from the board. (For example, in the diagram above, player 2, represented by O, has such a mill, but player 1, represented by X, does not). Such removed counters play no further part in the game. This continues until both players have placed all their counters.

Players continue to alternate turns. In a turn, a player moves one of their counters along a line to an adjacent unoccupied point. As before, if this move forms a mill, then the player removes one of their opponents counters from the board. A player loses if they are unable to move any of their pieces, or if they have only two counters left on the board.

Simulating the game in Python
The object of this coursework is to write a simulator for the game, which allows either two players to play each other.

The board
We’ll identify points on the board with integers 0 to 23 as follows:

0──────────1──────────2
│ │ │
│ 3──────4──────5 │
│ │ │ │ │
│ │ 6──7──8 │ │
│ │ │ │ │ │
9──10──11 12─13──14
│ │ │ │ │ │
│ │ 15─16─17 │ │
│ │ │ │ │
│ 18────19─────20 │
│ │ │
21────────22─────────23
The game state
The game state – that is, everything required to describe a game in play – consists of four elements:

The location and type of counters on the board
The number of unplaced counters that each player has in their hand
The player who taking a turn
We will store game state in a Python list g containing four elements,

g = [[…], p1_counters, p2_counters, active_player]
g[0] is itself a list of 24 integers, describing the board, with the ith element of this list, g[0][i] describing what is present at point i on the board. g[0][i] is:
0 if point i is unoccupied
1 if point i contains a counter of player 1
2 if point i contains a counter of player 2
g[1] stores an integer containing the number of counters that player 1 has in hand (not yet placed on the board)
g[2] stores an integer containing the number of counters that player 2 has in hand (not yet placed on the board)
g[3] stores an integer, either 1 or 2, depending on whether the player currently taking their turn is player 1 or player 2, respectively.
A function draw_board() is provided that displays a board state to the console, using diagrams similar to those above. You may use this function as-is, as part of your program, or you may wish to modify it to improve the appearance of the board.

Asking the user for input
The game should interact with users only by asking for integer board locations, and a function request_location(question_str) is provided for this purpose.

This function

displays the parameter string question_str that is passed to it, as a prompt to the user
waits for the user to type an integer
either: -returns this integer, if it corresponds to a location on the board (between 0 and 23 inclusive)
or raises a ValueError if the text typed was not an integer
or raises a RuntimeError if the text typed was an integer, but not in the range 0 to 23 inclusive.
The request_location function is the only way in which you should ask the user for input. You must not modify this function, and you must not use the input(…) function anywhere else in your code. (The reason for this is that, when testing the code, I may modify the request_location function to automate the user input to your program). Using the input(…) function anywhere else in your code will result in the loss of marks.

The tasks:
The following tasks each ask you to write a Python function that forms some part of the game. Generally speaking, the earlier tasks are easier than the later tasks. It is expected that you will call some of the functions from earlier tasks in the later tasks. Unless otherwise specified, functions do not return a value.

The function definitions are already defined in the template code provided. Use this template, and fill in the implementation of the functions.
For each function, write a short docstring (~ 1-3 sentences) that explains what the function does, what parameters it takes, and what it returns (if anything).
Document each of your functions using comments (#) to explain what the code is doing. On average, I suggest writing one comment line for every ~5 lines of code, though this varies greatly depending on the code being written
Task 1: checking adjacency (4 marks)
Write a function is_adjacent(i, j) that takes two integers representing points on the board, and returns the Boolean value True if those two points are adjacent to one another (connected by a line without going through another point), or False otherwise. A point is not adjacent to itself. For example is_adjacent(21,22) should return True, and is_adjacent(21, 23) and is_adjacent(21,20) should both return False.

You can assume that the values of i and j provided are integers between 0 and 23 inclusive.

Task 2: setting up the game state (4 marks)
Write a function new_game() that returns the game state (the list of four elements, as described above), for a new game in which no counters have been placed.

Task 3: counting counters (4 marks)
Write a function remaining_counters(g) that takes a game state g and returns an integer containing the total number of counters that the current player (g[3]) has available. This is the sum of the number of counters the player has in hand (yet to place on the board) and the number of counters they have on the board.

Task 4: checking for mills (6 marks)
Write a function is_in_mill(g, i) that takes a game state g and an integer index of a point i. The function should return:

-1 if i is outside the range 0-23 inclusive, or if there is no counter at point i
0 if the counter at point i is not in a mill,
1 if the counter at point i belongs to player 1 and is in (one or more) mills
2 if the counter at point i belongs to player 2 and is in (one or more) mills
Task 5: checking if the player can move (4 marks)
Write a function player_can_move(g) that returns True if the current player has a valid move to make, or False if they do not. A player has a valid move if they have one or more counters left in their hand, or if not, if any of their counters on the board are next to an adjacent unoccupied space.

Task 6: placing a counter (4 marks)
Write a function place_counter(g, i) that places a counter of the currently active player at point i on the board. The function should raise a RuntimeError if there is already a counter at this location. The function should update the game state g to place the counter on the board, and decrement the number of counters that the current player has in their hand.

You can assume that i will be an integer between 0 and 23 inclusive, and that this function is only called if the active player has at least one counter in their hand.

(Hint: Recall that changes to the game state g inside this function will be visible outside the function too, because g is a list. This is the desired behaviour and the functions in this and subsequent tasks should update the game state that is provided to them (and not return a new game state). You should not attempt to make a copy of the game state.)

Task 7: moving a counter (4 marks)
Write a function move_counter(g, i, j) that moves a counter of the currently active player from point i on the board to the adjacent point j. The function should raise a RuntimeError if this move is not possible, namely if points i and j are not adjacent, if point i doesn’t contain a counter of the current player, or if there is already a counter at point j. The function should update the game state to reflect the moved counter.

You can assume that i and j will be an integers between 0 and 23 inclusive.

Task 8: removing an opponent’s counter (4 marks)
Write a function remove_opponent_counter(g, i) that takes a game state g and point i and removes the counter at point i on the board. The function succeeds if the point i is occupied by a counter of the opposing player (i.e. the player who is not the current player), and raises a RuntimeError otherwise.

Task 9: taking a turn (8 marks)
Write a function turn(g) that simulates taking a turn of the game. This function takes a game state g and should do five things in sequence:

Check whether the current player is unable to move or has otherwise lost the game, and return False if so, without modifying g.

If the current player has one or more counters in hand,

ask the player for a location to place a counter on the board using request_location,
update the game state g to place this counter
If the player gives an invalid location, or the placement is not possible under the rules of the game, the player should be prompted to enter the location again, until a valid placement is made.

otherwise, the current player has no counters in hand, so,

ask the player for the location of a counter to move using request_location,
ask the player for a location to move said counter to, again using request_location.
update the game state g to move this counter
If the player gives invalid location(s), or the move is not possible under the rules of the game, the player should be prompted to enter both the locations again, until a valid move is made.

If the play in step 2 has formed a mill, ask the player for the location of an opposing counter to be removed, and update the game state g to remove this counter. As before, if an invalid location is given, the player should be re-prompted until a valid location of an opposing counter is provided.

Update the game state to switch the current player.

Return True to indicate that the game is not over yet

At appropriate points during the turn, you should display the board, using the provided draw_board() function, or otherwise.

Task 10: saving and loading a game state (8 marks)
Write a function save_state(g, filename) that saves the game state g to a text file, and a function load_state(filename) that returns a game state loaded from a text file. In both cases, the filename is given in the string filename.

Both functions should raise a RuntimeError if the file cannot be saved/loaded.

The file format for both functions is the same, so that the code

save_state(g, ‘my_file.txt’)
g_new = load_state(‘my_file.txt’)
reloads the same game state that has just been saved, and g_new is equal to g.

The text file used by both functions has four lines, in the following format:

The first line of the file contains the board state g[0], stored as integers from g[0][0] to g[0][23], separated by spaces and commas, as follows 0, 2, 1, 0,… etc. There is no comma after the final number g[0][23].
The second line of the file contains a single integer, the value of g[1]
The third line of the file contains a single integer, the value of g[2]
The fourth line of the file contains a single integer, the value of g[3]
Task 11: playing a game
Write a simple function play_game() that creates a new game state g and repeatedly calls turn(g) to simulate an entire game. Once the game is over, display some text to congratulate the winner.

The play_game function is assessed by hand, rather than by automated testing.

How this coursework will be assessed
This coursework is worth 70 marks, and 70% of the course overall.

50 marks are for correctness of the functions defined in tasks 1-9. These will be tested in an automated way, as in the previous courseworks. The number of automatically assessed marks for each task 1-10 is shown above.

8 marks will be for the overall quality of experience of a player playing the game in Task 11. This will be assessed by humans, and will be based on:

Correct behaviour of the play_game function
Clear display of the board at appropriate points in the game
Clear prompts to the players throughout the game, for example when positions on the board are being requested
Appropriate handling of errors and clear error messages when invalid input is provided
12 marks will be for the quality of the code. This will be assessed by humans, and will be based on:

Clarity and precision of docstrings for each function
Clarity of comments elsewhere in the code that describe what the code is doing
Code quality. Code should be clear, efficient and easy to maintain. Marks may be lost for
Very inefficient algorithms
Code that is unnecessarily verbose or difficult to understand
Unnecessary duplication of code
The model answer to coursework 2, to be released during week 9, provides an example of good quality code, comments and docstrings

Before you submit…
Re-read the instructions carefully and make sure you have not missed anything.
Make sure you have filled out your name, student ID number, and email at the top of the code
Be sure to submit to Blackboard just the .py file containing the python code. Do not submit the code in any other format (for example, a screenshot, PDF, jupyer notebook or word document are not acceptable formats).

如何处理动态语言(Python / JS)的“隐形”调用链? 本文揭示动态语言(Python/JS)中静态AST解析导致调用链“断链”的核心问题,提出通过运行时追踪补全图谱的解决方案。基于Code-Graph-RAG的cgr trace机制,分别利用pytest插件与V8 Profiler捕获真实调用路径,将动态边合并至静态图谱,并在权重体系中提升动态边优先级。实践表明,该方法可显著提升图谱覆盖率,实现“结构+行为”双视角理解代码,为MCP与Rerank系统提供可靠支持。 阅读详情

相关推荐

A robust and easy to implement method for IMU calibration without external equipments(IMU标定)

A robust and easy to implement method for IMU calibration without external equipments 1 标定原理1 亲试可用,还有动态演示效果不错。相比商用产品的简易标定流程,该标定方法有以下几点不同: 给出了加速度计和陀螺仪更复杂的模型。 利用Allan方差的定义,标定陀螺仪的偏置。 大量冗余数据,保证最优化收敛。利用数十...

擦擦擦大侠的博客 3948

MATH20621 - Coursework 3Python

fififito screen.2;2;2;2;Movingevenifit is not onelessthantheblocksMaking astates= {'blocked'FalseFalseFalseFalseFalseTrue],'complete': [FalseFalseFalseTrueFalseFalse],

tellttyby的博客 907

手把手教你排查I2C通信故障:当上拉电阻配置不当会发生什么?

本文深入解析I2C通信中上拉电阻配置不当导致的常见故障,包括波形畸变和通信失败现象。通过示波器波形分析和系统化解决方案,帮助工程师快速诊断和优化I2C总线性能,特别适用于嵌入式系统和智能设备开发场景。

weixin_33725722的博客 341

MATH20621 - Coursework 2

”"“”"

todcode的博客 337

CVPR 2026 即插即用 | 注意力篇 | MSEF:超轻注意力,空间-通道双分支并行融合,既增强特征又抑制噪声!

Multinex提出了一种超轻量级微光图像增强框架,其核心创新是MSEF模块。MSEF采用双分支并行架构,结合空间局部特征(深度可分离卷积)和全局通道注意力(改进SE),通过Tanh激活实现特征增强与抑制。相比传统注意力模块,MSEF在几乎不增加计算量的情况下显著提升性能,特别适合轻量级网络和边缘设备部署。实验表明,该模块能有效提升PSNR约3dB,同时保持极低的参数量(0.7K-45K)。

主要更新底层视觉(去噪、超分等)相关的科研内容,形式为【论文精读】+【论文复现】 604

“EXB文件的格式和编程“

首先,打开文件并读取文件头,然后解析文件头中的元数据信息。接下来,循环读取数据块,每次读取块头部分,解析块的大小和类型,并读取相应大小的块数据。文件头(Header):EXB文件通常包含一个文件头,用于存储关于文件的元数据信息。读取EXB文件时,首先需要解析文件头,以了解文件的属性和数据结构。总结起来,EXB文件是一种常见的二进制数据文件格式,在编程中处理EXB文件需要了解其基本结构和元数据信息。通过以上代码,您可以根据自己的需求扩展处理其他类型的数据块,或者根据EXB文件的具体规范进行解析和处理。

HackCyberX的博客 1535

AI全栈实战 | 3.9-01 爬虫入门:requests 加 BeautifulSoup 三分钟跑通,但 90% 的人栽在这 4 个“礼貌“问题上

⚠️:本文内容仅用于。请遵守目标站点的服务条款与相关法律法规,不得对目标服务造成负担,不得采集、传播个人隐私数据。技术是中性的,边界在你手里。爬虫的入门技术(requests 发请求 + BeautifulSoup 解析)三分钟就能学会。真正区分"会用爬虫"和"会做爬虫的人"的,是这篇我们跑通"请求→解析→存储"的最小闭环,然后重点把"合规与礼貌"这根弦给你绷上。

源码获取 | 运行部署 | 定制二开修改,如果回复不及时请耐心等待,请见谅。 406

JavaScript实现斗地主(附完整源码)

JavaScript实现斗地主(附完整源码)

希望我的博客,能帮上你解决学习中工作中所遇到的问题 1503

从一段视频到可漫游的 4D 有声场景:思路拆解与最小复现手记

只需一段手机视频,你就能生成可"走进去"的 4D 有声场景:转头时狗叫声方向随之变化,走近时声音更清晰。本文拆解 Video-to-4DAVScene 的核心思路,手把手带你用几十行 Python 搭出最小管线,把视频中的运动物体变成带空间位置的声源,并附上三个真实踩坑的排障经验,代码可直接跑。🎧

helloagent的博客 235

delphi fmx android 自动更新(一)

所以,如果是http 则,manifest.xml application 下,https无需添加。增加android:usesCleartextTraffic="true",不然无法使用http下载东西。1,REQUEST_INSTALL_PACKAGES 权限。4,WRITE_EXTERNAL_STORAGE 权限。3,READ_EXTERNAL_STORAGE 权限。一般是从http下载安装包 apk。2,INTERNET 权限。sFile为apk包路径。

全粘工程师 550

python opencv的车牌识别分割详细教程 毕业设计

python opencv的车牌识别分割详细教程 毕业设计

机器学习深度学习业余选手 1327

【每天一个 Python 小案例30】Python 基础知识综合小项目:我的工具盒

作为系列收官,本篇把前 29 篇的知识点合成一个能直接用的命令行工具"我的工具盒":计算器(用 ast 解析表达式,不碰 eval)、单位换算与温度转换(一张换算表 + 特例分支)、记账与分类统计(Decimal + JSON 持久化)、以及用"字典当命令表"把菜单和业务逻辑解耦的主循环。文中对比了 eval 的安全隐患与 ast 白名单的做法,解释了 lambda 闭包在字典里的写法与晚绑定陷阱,并在最后给出整个系列的知识地图,把变量、数据结构、控制流、函数、类、异常、文件、标准库八块内容对应到具体篇目。

xinjiyaya的博客 426

Ubuntu开机进入initramfs,解决办法来了!

摘要:Ubuntu系统启动时卡在initramfs界面,表明系统无法正常挂载根文件系统。常见原因包括引导配置错误、文件系统损坏、驱动程序问题和硬件故障。解决方法包括:1)使用fsck修复文件系统;2)通过dmesg排查驱动问题;3)检查硬盘等硬件状态;4)重新安装GRUB引导程序。建议做好系统备份等预防措施,遇到问题时按步骤排查。该问题通常可通过文件系统修复或引导配置重建解决。(148字)

米可的博客! 3421

详解Python条件语句

在 Python 中,if...else 是一种条件语句,可以根据给定的条件执行不同的操作。这个语句通常用于控制程序的流程。

2601_96798737的博客 207

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

Python3 协程:异步编程的核心机制与实战

协程是解决I/O密集型任务等待瓶颈的高效机制,相比线程更轻量、无锁开销。从yield到async/await的演进,使异步编程语义清晰、易于理解。通过async/await可实现并发执行多个任务(如gather、create_task),显著提升网络请求、爬虫等场景性能。关键在于使用异步库(如aiohttp)替代同步库,避免阻塞事件循环。合理控制超时与并发数,才能发挥协程最大优势。

Lxn2zh的博客 159

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

torch.compile 差异仅 1e-6,边界样本预测为何翻转

torch.compile 加速后输出与 eager 不一致,部分预测翻转。逐层对比与 graph break 分析定位到动态分支翻转根因。容差回归仅适用于无分支翻转场景,零容忍场景应禁用编译。

昨日种种,皆成今我。今日种种,皆成新我。 159

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

二进制木马免杀-Python 分离免杀与 Web 挂马

二进制木马免杀-Python 分离免杀与 Web 挂马

2503_94637398的博客 268

蓝桥杯·全国青少年信息素养大赛·电子学会Python/C++考级 备考:莫队算法离线区间查询详解

备赛进行时:第十八届蓝桥杯软件赛报名已于 2026-10-08 10:00 开启、12-18 14:00 截止,省赛定在 2027-04-10(C/C++·Python 程序设计 9:00–13:00);中国电子学会 2026 年 12 月软件编程(C/C++ 一级至十级、Python 一级至六级)考级报名 9/23–12/2 16:00、统考 12-12;全国青少年信息素养大赛 2026—2027 赛季算法应用主题赛也已进入复盘练兵窗口。

IT_Scratch的博客 137

【Python】国家中小学智慧教育平台电子教材批量下载与 PDF 合成实战

成果:两本语文电子课本(一年级上册 118 页 / 23MB、三年级上册 130 页 / 30.3MB),合计 248 页、约 54MB,单本下载加合成 40~60 秒,PDF 页数校验全部通过。经验教训SPA 站点的数据接口优先从 bundle 里挖,比抓页面稳得多;资源链接要按 private/public 分组看待,只取平台公开部分;页数、目录名这类“可推断”的信息,永远用实际响应验证一次;受限环境里“能不能跑浏览器”要在方案定稿前确认。后续计划:这版 PDF 是图片版,没有文字层;

木头大左的博客 137

魔塔社区微调训练Qwen2-1.5B-Instruct模型并烧录到‌RK3568开发板教程

本文基于Ubuntu 22.04 + CUDA 13.0.3环境,使用LLaMA-Factory框架对Qwen2-1.5B-Instruct模型进行LoRA微调,训练儿童故事生成专用模型。通过配置qwen模板、制作alpaca格式数据集、执行sft训练并合并LoRA权重,最终将模型转换为GGUF格式,并量化为Q4_K_M以适配RK3568嵌入式平台。全程支持国产镜像加速下载与显存优化,实现高效轻量化部署。

浅清秋慕夏的博客 186

【回眸】DeepSeek V4.1 Flash 快速上手与实战

本文介绍如何高效本地部署开源大模型,通过现代化工具链实现分钟级环境搭建。聚焦显存优化、一键安装、代码调用与多轮对话实现,解决“显存不足”“连接超时”等痛点,提供参数调优与结构化输出技巧,助力开发者在离线场景下快速构建稳定、高效的本地推理系统。

啤酒鸭的物联网开发记录博客 223

智叟云集-手机证据抓取系统的工程结构与应用入口

本文系统阐述手机证据抓取系统的工程结构与应用入口,涵盖四大层面:工程目录划分(Android、Python服务、Web页面、测试与构建工具);Android组件通过Manifest声明可启动页面,主界面由MainActivity管理;Python服务通过run.py解析参数并启动FastAPI应用,支持远程访问;浏览器页面采用HTML/CSS/JS分离架构,静态资源通过路径关联,实现动态交互。各模块分工明确,协同构建可运行的采集系统。

2301_77178996的博客 232

Java Arrays.asList 常见坑详解|UnsupportedOperationException、数组联动、基本类型 bug

解析 Arrays.asList 常见开发陷阱,演示 UnsupportedOperationException、底层数组引用共享、基本类型数组问题,区分 Arrays 内部 ArrayList 与 java.util.ArrayList,给出数组转 List 的各种场景正确代码。

weixin_42617033的博客 473

利用python中matplotlib.pyplot库绘制图

plt.plot(x,y) # x,y是每个点的坐标,plot()把每个点按顺序画折线。plt.subplots(2,2)表示绘制2*2的子图布局,axs[0,0]表示在第0行第0列绘制子图...coordinates_i[:,0]表示获取每一行(每一个spot)的第0列(x坐标)coordinates_i[:,1]表示获取每一行(每一个spot)的第0列(y坐标)plot.subplot(2,2,1) 表示子图布局是2*2的,开始绘制第一个。也可以导入数据绘制。可以设置color属性,设置颜色。

qq_46147236的博客 102

Spring Boot 自动配置原理

Spring Boot 自动配置由 @EnableAutoConfiguration 导入选择器,读取 jar 中 .imports 候选清单,经去重、排序、排除后逐类做条件判断,通过才注册 Bean。延迟导入让用户 Bean 优先,@ConditionalOnMissingBean 使默认配置让位。失效时查清单和 Negative matches。

2401_89855466的博客 377

【随笔】KV缓存量化:省下的显存,要付出多少数值误差

用可运行量化器解释位宽、比例信息、分组和离群值的关系,核算KV缓存实际载荷,并给出Transformers配置与容量、延迟、质量验收方法。

code2cat的博客 455
上一篇: MATH20621 - Coursework 2
下一篇: MSBA7017 Financial Engineering
todcode
博客等级 码龄7年 359粉丝 108原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值