Skip to content

(doc) needs help on how to deal with batch data #5

Open

Description

@qlibp

In run_tensor.py, how to implement the forward function to handle batch data? As the final result of Network.forward should return Tensor data, so the method in Module 1 using for and list is not a choice. For now, I merely figure out one possible solution: add one more dimension to the dataset. For dataset of shape (50, 2), I will change it to (50, 1, 2) and then using the broadcasting mechanism to pass it through network.

Is there a better way to implement it?

Activity

  1. srush commented on Sep 6, 2020

    @srush
    Contributor

    You are correct that this is the expected method to implement it => View, then Broadcast, and then reduce. I will add some hints to make that more clear.

  2. srush commented on Sep 6, 2020

    @srush
    Contributor

    I will add some more docs here, in the mean time, this diagram from the next section explains the main approach https://minitorch.github.io/matrixmult.html

  3. qlibp commented on Sep 6, 2020

    @qlibp
    Author

    You are correct that this is the expected method to implement it => View, then Broadcast, and then reduce. I will add some hints to make that more clear.

    Thanks for the confirmation and then I will try to figure out what goes wrong with my code.

  4. qlibp commented on Sep 13, 2020

    @qlibp
    Author

    I finally find out that the reason why my training procedure get stuck(derivative vanish at around epoch=60). I miss the relu activation in the Network forward function. I comment here in case someone come up with the same problem which I waste for about a week to find it out.

  5. srush commented on Sep 13, 2020

    @srush
    Contributor

    Oh no! I didn't mean for that to be a hard part. I'll add more docs in the network class to describe the exact shape of the network.

    Did you eventually get it working? I see why that would be frustrating.

  6. qlibp commented on Sep 13, 2020

    @qlibp
    Author

    Oh yeah, I finally make it work(maybe). It's still a little bit different from the result of Module 1.

    截屏2020-09-13 下午11 18 20

  7. srush commented on Sep 13, 2020

    @srush
    Contributor

    Looks great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions