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

Move x2num preprocessings into the summary.py #26

Closed
ruotianluo opened this issue Sep 21, 2017 · 2 comments
Closed

Move x2num preprocessings into the summary.py #26

ruotianluo opened this issue Sep 21, 2017 · 2 comments

Comments

@ruotianluo
Copy link
Contributor

Now all the x2num preprocessings are in writer.py, like:

def add_scalar(self, tag, scalar_value, global_step=None):
        """Add scalar data to summary.
        Args:
            tag (string): Data identifier
            scalar_value (float): Value to save
            global_step (int): Global step value to record
        """
        scalar_value = makenp(scalar_value)
        assert(scalar_value.squeeze().ndim==0), 'input of add_scalar should be 0D'
        self.file_writer.add_summary(scalar(tag, scalar_value), global_step)

Why not put scalar_value = makenp(scalar_value) in scalar function.

The reason I'm proposing this, is I'm using FileWriter, and I collect the summaries during forwarding the network. (Like the pipeline in tensorflow) So I will call the scalar histogram etc functions by myself. (The reason I don't use SummaryWriter is I don't want the SummaryWriter to be exposed to the model itself.)

Now, to call scalar or histogram I have to convert to numpy first, which is ok but not necessary because you can move all the x2num to summary.py.

What do you think.

@lanpa
Copy link
Owner

lanpa commented Sep 22, 2017

Looks good. Would you like to send a PR?

@ruotianluo
Copy link
Contributor Author

ruotianluo commented Sep 22, 2017

I will do this.

lanpa added a commit that referenced this issue Sep 23, 2017
@lanpa lanpa closed this as completed Sep 23, 2017
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

No branches or pull requests

2 participants