Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for adding the entire Batch as one tensor #36

Open
wvabrinskas opened this issue Jun 21, 2023 · 0 comments
Open

Allow for adding the entire Batch as one tensor #36

wvabrinskas opened this issue Jun 21, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@wvabrinskas
Copy link
Owner

right now we iterate over all instances of the batches and perform a forward operation all at once. If we add a 4th dimension to the Tensor, to support images, we can concat all the Tensor in a batch into one tensor and perform the forward operations on that instead of repeating it.

we can concat like this using the concat function introduced in the vectorize branch

    guard let first = data.first else { return  (outputs: [], gradients: Tensor.Gradient(), loss: 0, accuracy: 0) }
    let newData = data.dropFirst()
    let cumulativeData = newData.reduce(first, { $0.concat($1, axis: 1) })
@wvabrinskas wvabrinskas self-assigned this Jun 21, 2023
@wvabrinskas wvabrinskas added the enhancement New feature or request label Jun 21, 2023
@wvabrinskas wvabrinskas added this to the 2.1 milestone Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant