Robocup: Python Style Convention

1. 通用原则 总体规范参考 Google 规范,略有改动 详见 $\rightarrow$ https://google.github.io/styleguide/pyguide.html 使用或借助 AI 写代码请务必自己理解每个代码都在干什么 行宽不超过 80 字符,设置 vscode 行宽 80 字符线: Ctrl(Cmd) + , 或者 File $\rightarrow$ Preferences $\rightarrow$ Settings 搜索:ruler 编辑 settings.json: 1{ 2 "editor.rulers": [80] // 原有配置的基础上添加这一行 3} 代码可读性第一,避免过度优化或炫技 变量、函数、类名应自解释,避免无意义缩写(如 a, tmp1),除非是广泛接受的缩写(如 id, url, cmd) 错误处理必须显式,不能忽略可能的异常、错误码或返回值 全英文注释:统一,正式,美观,且标点只使用半角标点(英文字符) 标点(: , ; . ? !)前不加空格,后加一个空格, (() [] {} "" '')外侧加空格内测不加 (- _)前后不加空格,其余所有运算符前后都有空格 在函数名和左括号之间不要留空格。在参数列表的逗号后留一个空格。 int add(a, b); 避免在圆括号、方括号或花括号内部紧邻留空格。 list[1:5] dict = {'key': value} 声明与初始化尽可能的靠近,如 1int i = function(); 设置pylance: ...

November 12, 2025 · 6 min · 1169 words · xxraincandyxx

Robocup: Preliminary

Prerequisites Environment Requirements / 环境需求 Linux Distributor ID: Ubuntu Description: Ubuntu 24.04.3 LTS Release: 24.04 ROS2 Distribution: ros:kilted Visual Studio Code Python Please do be sure you have set the Type Checking Mode to strict.

November 12, 2025 · 1 min · 35 words · xxraincandyxx

Pseudo Inverse

Reprinted and translated from this Post. All Copyrights Reserved. Many readers, like myself, may find themselves with a feeling of both familiarity and strangeness when it comes to the low-rank approximation of matrices. This familiarity stems from the fact that the concept and significance of low-rank approximation are straightforward to grasp. Moreover, with the proliferation of fine-tuning techniques built upon it, such as LoRA, the idea has become deeply ingrained through constant exposure. Nevertheless, the sheer breadth of content covered by low-rank approximation, coupled with the frequent appearance of unfamiliar yet astonishing new techniques in related papers, results in a sense of not-quite-knowing. ...

November 8, 2025 · 1 min · 146 words · xxraincandyxx

The Gradient Descent within the Router of MoE

The process of Gradient Descent for training the router layer (gating network) of a Mixture-of-Experts (MoE) model involves calculating the gradient of the total loss with respect to the router’s parameters and using this to update the parameters. The primary challenge in MoE training is the non-differentiability introduced by the Top-$K$ routing mechanism, which discretely selects experts. Standard backpropagation struggles with this non-smooth operation. 1. MoE Layer Output and Loss Function MoE Layer Output ($y$) For a given input vector $\mathbf{x}$, the router layer, typically a linear projection followed by a Softmax, produces unnormalized scores (logits) $\mathbf{h}(\mathbf{x}) = \mathbf{W}_g \mathbf{x}$, where $\mathbf{W}_g$ are the router’s parameters. These logits are often passed through a Softmax function to get the expert weights (or “gates”) $\mathbf{G}(\mathbf{x})$: ...

November 6, 2025 · 10 min · 1929 words · xxraincandyxx

An Address Opposed to Legalizing Cannabis, Refactored

Argument Table Here is the complete, combined list of Research Arguments and Rebuttal Arguments in the requested table format. Argument Category Argument Example 1 Example 2 Citation (APA Format) Research Arguments (Health Drawbacks) 1. After becoming legal for recreational use, more individuals use cannabis more frequently, and more develop cannabis use disorder (CUD), now a public health issue. Since legalization, adults have shown increased cannabis use and higher rates of CUD from 2008 to 2016. Young people in legal states are also more likely to develop these problems. Cerdá, M., Mauro, C., Hamilton, A., Levy, N. S., Santaella-Tenorio, J., Hasin, D., Wall, M. M., Keyes, K. M., & Martins, S. S. (2019). Association Between Recreational Marijuana Legalization in the United States and Changes in Marijuana Use and Cannabis Use Disorder From 2008 to 2016. JAMA Psychiatry, 77(2), 165. https://doi.org/10.1001/jamapsychiatry.2019.3254 Research Arguments (Health Drawbacks) 2. Daily and high-potency cannabis use is associated with a higher incidence of psychotic disorder. Cities that had more high-potency use had higher first-episode psychosis rates. The daily users had significantly higher chances of psychosis than the non-users. Di Forti, M., Quattrone, D., Freeman, T. P., Tripoli, G., Gayer-Anderson, C., Quigley, H., Rodriguez, V., Jongsma, H. E., Ferraro, L., La Cascia, C., La Barbera, D., Tarricone, I., Berardi, D., Szöke, A., Arango, C., Tortelli, A., Velthorst, E., Bernardo, M., Del-Ben, C. M.,… Van Der Ven, E. (2019). The contribution of cannabis use to variation in the incidence of psychotic disorder across Europe (EU-GEI): a multicentre case-control study. The Lancet Psychiatry, 6(5), 427–436. https://doi.org/10.1016/s2215-0366(19)30048-3 Research Arguments (Health Drawbacks) 3. Adolescent cannabis use is associated with later depression and suicidality. Meta-analysis: depression OR ≈ 1.37; suicidal ideation OR ≈ 1.50; suicide attempt OR ≈ 3.46. These associations remain even after considering their previous mental health condition. Gobbi, G., Atkin, T., Zytynski, T., Wang, S., Askari, S., Boruff, J., Ware, M., Marmorstein, N., Cipriani, A., Dendukuri, N., & Mayo, N. (2019). Association of cannabis use in adolescence and risk of depression, anxiety, and suicidality in young adulthood. JAMA Psychiatry, 76(4), 426. https://doi.org/10.1001/jamapsychiatry.2018.4500 Research Arguments (Health Drawbacks) 4. In teenagers and young adults, using cannabis will cause brain problems — like poor memory, weak learning, and cannot focus. Many big studies say memory, attention, and learning all got problem one. These cognitive effects can reduce school performance and decision-making ability. Scott, J. C., Slomiak, S. T., Jones, J. D., Rosen, A. F. G., Moore, T. M., & Gur, R. C. (2018). Association of cannabis with cognitive functioning in adolescents and young adults. JAMA Psychiatry, 75(6), 585. https://doi.org/10.1001/jamapsychiatry.2018.0335 Research Arguments (Health Drawbacks) 5. Medical cannabis for chronic pain relief might have only limited benefits, whereas long-term harms are greater. Studies report negative effects such as addiction, memory problems, and mental health issues. The overall quality of the evidence for lasting benefits remains low. Zeraatkar, D., Cooper, M. A., Agarwal, A., Vernooij, R. W. M., Leung, G., Loniewski, K., Dookie, J. E., Ahmed, M. M., Hong, B. Y., Hong, C., Hong, P., Couban, R., Agoritsas, T., & Busse, J. W. (2022). Long-term and serious harms of medical cannabis and cannabinoids for chronic pain: a systematic review of non-randomised studies. BMJ Open, 12(8), e054282. https://doi.org/10.1136/bmjopen-2021-054282 Research Arguments (Health Drawbacks) 6. High-potency commercial cannabis dramatically accelerates addiction and psychiatric risk. For every 1% increase in cannabis potency, there is a statistically significant 1.4 times increased risk (Hazard Ratio, 1.4) of progression to the onset of Cannabis Use Disorder (CUD) symptoms.[1] Modern cannabis concentrates contain “extraordinarily high” levels of THC, frequently exceeding 60%, a chemical profile that creates acute pharmacological stress on the central nervous system.[2, 3] Petrilli, K., Ofori, S., Hines, L., et al. (2022). Association of cannabis potency with mental ill health and addiction: a systematic review. The Lancet Psychiatry, 9(9), 736–750. [4] Research Arguments (Health Drawbacks) 7. Legalization generates an epidemic of unintentional pediatric poisoning from attractive edible products. California saw a 469% increase in cannabis-related calls to the Poison Control System among children aged 5 years and under between 2016 and 2023.[5] The surge in calls for this young age group was overwhelmingly driven by unintentional exposure to cannabis edibles, which are often indistinguishable from conventional candies and increased by 971% during the same period.[5] California Department of Public Health. (2024). Cannabis Poison Control System Calls Dashboard..[5] https://www.cdph.ca.gov/Programs/CCDPHP/sapb/cannabis/Pages/Cannabis-Poison-Control-System-Calls-Dashboard.aspx Research Arguments (Health Drawbacks) 8. Cannabis use is an independent risk factor for premature cardiovascular death and major vascular events, even in young, healthy adults. Systematic reviews find cannabis use is associated with a measured risk ratio of 2.10 for cardiovascular mortality.[6] Users under age 50 who were otherwise healthy and non-tobacco users faced over a sixfold increased risk of heart attack and a fourfold increased risk of ischemic stroke.[7] Qanungo, S. et al. (2025). Association between cannabis use and major adverse cardiovascular events: a systematic review and meta-analysis of real-world data. Heart, 111(22), 1047. https://doi.org/10.1136/heartjnl-2024-325327 [6] Research Arguments (Health Drawbacks) 9. Prenatal exposure to cannabis is linked to long-term neurodevelopmental and behavioral deficits in children. Adolescents exposed to cannabis during pregnancy were significantly more likely to experience psychopathological outcomes, including conduct problems, aggression, and rule-breaking behavior.[8] Case-control studies have found that children exposed to cannabis during pregnancy had lower scores on the cognitive domain compared to their unexposed counterparts.[8] Baranger, D. A., et al. (2022). Adolescents exposed to cannabis during pregnancy were more likely to experience psychopathological outcomes. JAMA Psychiatry. [8] Research Arguments (Health Drawbacks) 10. Major medical organizations formally oppose state-level legalization due to insufficient safety evidence and documented public health threats. The American Medical Association (AMA) believes that legalizing the adult use of cannabis poses a demonstrable threat to public health and opposes legalization without further scientific research.[9] The AMA explicitly opposes the legalization of cannabis for medicinal use through state legislative or ballot processes, arguing safety and effectiveness must be assessed via the rigorous federal investigational new drug (IND) application process.[10] American Medical Association (AMA). (2019). AMA Policy D-95.969: Cannabis Legalization for Medicinal Use..[9, 10] https://www.ama-assn.org/system/files/2019-05/a19-yps-resolution-05.pdf Rebuttal Arguments 1. Evidence doesn’t support the claim of effective treatment of anxiety/depression/PTSD; risk may be greater than benefit. Systematic review/meta-analysis reveals lack of evidence for benefits of cannabinoids in most mental illnesses. Authors advise on existing trials concerning adverse events and imprecise evidence. Black, N., Stockings, E., Campbell, G., Tran, L. T., Zagic, D., Hall, W. D., Farrell, M., & Degenhardt, L. (2019). Cannabinoids for the treatment of mental disorders and symptoms of mental disorders: a systematic review and meta-analysis. The Lancet Psychiatry, 6(12), 995–1010. https://doi.org/10.1016/s2215-0366(19)30401-8 Rebuttal Arguments 2. In chronic pain, the benefits are small/ unclear, whereas serious long-term adverse effects are established. A systematic review reveals non-trivial side effects such as CUD, cognitive, & psychiatric effects. Overall quality of evidence = low to moderate; sustained benefit unclear. Zeraatkar, D., Cooper, M. A., Agarwal, A., Vernooij, R. W. M., Leung, G., Loniewski, K., Dookie, J. E., Ahmed, M. M., Hong, B. Y., Hong, C., Hong, P., Couban, R., Agoritsas, T., & Busse, J. W. (2022b). Long-term and serious harms of medical cannabis and cannabinoids for chronic pain: a systematic review of non-randomised studies. BMJ Open, 12(8), e054282. https://doi.org/10.1136/bmjopen-2021-054282 Rebuttal Arguments 3. Cannabis is not “safer than alcohol” for driving—acute THC raises crash risk. Meta-analysis shows ~2× increased motor-vehicle collision risk after cannabis use. Risk remains after adjusting for study quality and publication bias. Rogeberg, O., & Elvik, R. (2016). The effects of cannabis intoxication on motor vehicle collision revisited and revised. Addiction, 111(8), 1348–1359. https://doi.org/10.1111/add.13347 Rebuttal Arguments 4. “Legal cannabis reduces opioid overdose” is not reliable—newer data show the opposite trend. U.S. analysis finds association between medical cannabis laws and opioid overdose mortality increased over time. Earlier apparent benefits were likely ecological/temporal confounding. Shover, C. L., Davis, C. S., Gordon, S. C., & Humphreys, K. (2019). Association between medical cannabis laws and opioid overdose mortality has reversed over time. Proceedings of the National Academy of Sciences, 116(26), 12624–12626. https://doi.org/10.1073/pnas.1903434116 Rebuttal Arguments 5. Even with medical access, cannabis use disorder (CUD) rises in real-world health systems after legalization. Among U.S. Veterans Health Administration patients in legal states, CUD diagnoses increased significantly. Indicates addiction risk persists despite “medical” framing. Hasin, D. S., Cerdá, M., Keyes, K. M., et al. (2023). State recreational cannabis laws and population-level diagnoses of cannabis use disorder in U.S. Veterans Health Administration patients. JAMA Psychiatry, 80(3), 252–260. https://doi.org/10.1001/jamapsychiatry.2022.4430 Rebuttal Arguments 6. Chronic high-dose use of commercial products substantially increases the strain on emergency services with Cannabinoid Hyperemesis Syndrome (CHS). Following the commercialization of recreational cannabis in Nevada, the rate of CHS-related Emergency Department (ED) visits more than doubled, increasing from 1.07 to 2.22 per 100,000 people.[11] Studies show that up to 32.9% of self-reported frequent users presenting to emergency departments with cyclic vomiting may meet the criteria for CHS, creating a significant, avoidable burden on acute care facilities.[12] Shah, S. M., et al. (2024). Incidence of Cannabinoid Hyperemesis Syndrome Emergency Department Visits After Commercialization of Recreational Cannabis in Nevada. Clinical Drug Investigation. [11]

November 6, 2025 · 8 min · 1493 words · xxraincandyxx