Skip to content

Add torch module#638

Draft
veehz wants to merge 1 commit intosource-academy:masterfrom
veehz:torch
Draft

Add torch module#638
veehz wants to merge 1 commit intosource-academy:masterfrom
veehz:torch

Conversation

@veehz
Copy link
Copy Markdown

@veehz veehz commented Mar 26, 2026

Description

Include the torch module, a PyTorch-like machine learning library designed for Source Academy.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.

  • Test A
  • Test B

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new machine learning capability to Source Academy by integrating a torch module. This module aims to provide functionalities similar to PyTorch, enabling users to perform machine learning tasks within the Source Academy environment. This addition expands the platform's utility, offering advanced computational tools for educational and experimental purposes.

Highlights

  • New Module Introduction: A new torch module has been added, providing a PyTorch-like machine learning library for Source Academy.
  • Dependency Integration: The new module integrates the @veehz/torch library, enabling machine learning functionalities.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new torch bundle, which wraps the @veehz/torch machine learning library. The bundle includes its own package.json, tsconfig.json, and an index.ts that re-exports the external library, along with an empty manifest.json indicating it's a library-only bundle. The yarn.lock file has been updated to reflect these new dependencies. Feedback from the review highlights two main points: the absence of unit tests for the new torch module, which are crucial for verifying functionality and preventing regressions, and the presence of an unnecessary serve script and its description in package.json for a library-only bundle, suggesting it should be removed for cleaner configuration.

* @author Vee Hua Zhi
*/

export * from '@veehz/torch';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

While this file correctly exports the torch module, there are no accompanying tests. For a new library feature, it's crucial to add tests to verify its functionality, ensure proper integration, and prevent future regressions. Please consider adding unit tests for this module.

Comment on lines +17 to +31
"scripts": {
"build": "buildtools build bundle .",
"lint": "buildtools lint .",
"tsc": "buildtools tsc .",
"test": "buildtools test --project .",
"postinstall": "buildtools compile",
"serve": "yarn buildtools serve"
},
"scripts-info": {
"build": "Compiles the given bundle to the output directory",
"lint": "Runs ESlint on the code in the bundle",
"serve": "Starts the modules server",
"test": "Runs unit tests defined for the bundle",
"tsc": "Runs the Typescript compiler and produces the library version of the bundle"
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The serve script and its corresponding description in scripts-info seem unnecessary for this bundle. Since torch is a library-only bundle without any UI components (as indicated by the empty tabs array in manifest.json), there's nothing to serve. Removing unused scripts helps keep the configuration clean and avoids confusion.

  "scripts": {
    "build": "buildtools build bundle .",
    "lint": "buildtools lint .",
    "tsc": "buildtools tsc .",
    "test": "buildtools test --project .",
    "postinstall": "buildtools compile"
  },
  "scripts-info": {
    "build": "Compiles the given bundle to the output directory",
    "lint": "Runs ESlint on the code in the bundle",
    "test": "Runs unit tests defined for the bundle",
    "tsc": "Runs the Typescript compiler and produces the library version of the bundle"
  }

@RichDom2185 RichDom2185 self-requested a review March 26, 2026 14:56
@veehz veehz self-assigned this Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant