mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-05-06 17:49:07 -05:00
[GH-ISSUE #1298] [TinyTorch] #1748
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Cohegen on GitHub (Apr 9, 2026).
Original GitHub issue: https://github.com/harvard-edge/cs249r_book/issues/1298
Module
01 Tensor
Type of Improvement
Other
Description
I’ve been working with TinyTorch and had a few ideas that could make it feel more intuitive and closer to a PyTorch-like experience, especially when building ML models.
Proposed Solution
1. PyTorch-like API Aliases
To make the API more familiar and easier to use:
It might be helpful to add
@propertysupport for:ndimnumel(to align with common tensor usage patterns)Adding
view()as an alias forreshape()would also improve consistency with PyTorch.A simple
contiguous()pass-through method could be useful too, mainly to avoid attribute errors when running training pipelines that expect it.2. More Robust Tensor Initialization
The
__init__method could be made a bit more flexible when handling different types of inputs:For example, if a list of Tensors is passed in, it could recursively extract their
.data.It would also be nice if
requires_gradis preserved automatically when initializing from an existing Tensor.3. Advanced Indexing Utility
masked_fill(mask, value)method, since this comes up often in transformer models .