Skip to content

Add arguments __repr__ in Distribution base class#10373

Closed
nadavbh12 wants to merge 5 commits intopytorch:masterfrom
nadavbh12:master
Closed

Add arguments __repr__ in Distribution base class#10373
nadavbh12 wants to merge 5 commits intopytorch:masterfrom
nadavbh12:master

Conversation

@nadavbh12
Copy link
Contributor

No description provided.

return self.__class__.__name__ + '()'
param_names = [k for k,_ in self.arg_constraints.items()]
args_string = ', '.join(['{}: {}'.format(p, self.__dict__[p]) for p in param_names])
return self.__class__.__name__ + '(' + args_string + ')'

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

ezyang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

param_names = [k for k,_ in self.arg_constraints.items()]
args_string = ', '.join(['{}: {}'.format(p, self.__dict__[p]) for p in param_names])
args_string = ', '.join(['{}: {}'.format(p, self.__dict__[p]
if len(self.__dict__[p].shape) == 0

This comment was marked as off-topic.

args_string = ', '.join(['{}: {}'.format(p, self.__dict__[p]) for p in param_names])
args_string = ', '.join(['{}: {}'.format(p, self.__dict__[p]
if len(self.__dict__[p].shape) == 0
else self.__dict__[p].shape)

This comment was marked as off-topic.

ezyang
ezyang previously requested changes Aug 13, 2018
Copy link
Contributor

@ezyang ezyang left a comment

Choose a reason for hiding this comment

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

see @vishwakftw's comments

Copy link
Contributor

@vishwakftw vishwakftw left a comment

Choose a reason for hiding this comment

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

@ssnl
Copy link
Collaborator

ssnl commented Aug 14, 2018

@vishwakftw how does this look now?

@vishwakftw
Copy link
Contributor

vishwakftw commented Aug 14, 2018

I think it looks fine now, but Travis is still complaining.

Edit: didn’t notice Travis passed. Sorry.

Copy link
Contributor

@vishwakftw vishwakftw left a comment

Choose a reason for hiding this comment

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

Looks good to me, could you add a test in test_distributions to make sure that the __repr__ is called correctly?

@ezyang ezyang dismissed their stale review August 15, 2018 03:31

dismiss

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

ezyang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

PenghuiCheng pushed a commit to PenghuiCheng/pytorch that referenced this pull request Sep 11, 2018
Summary: Pull Request resolved: pytorch#10373

Differential Revision: D9240316

Pulled By: ezyang

fbshipit-source-id: f35c500f61f86e6be405e8bd4040db5146224984
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants