Fancy torch print output

34 views
Skip to first unread message

Fabrice Dugas

unread,
Jan 17, 2017, 1:10:15 AM1/17/17
to torch7
Hi there, small question out of curiosity.

I have been trying to figure out where Torch's fancy printing happens. For example, tables in torch are print like so:
{
 
1 : "Hello"
 
2 : "World"
 
3 : "!"
}

Instead of:
table: 0x7fb03d82b400
Which is the result of tostring.

Why is it different? Is there a way to get a string instead of printing?

Fabrice


Jonghoon Jin

unread,
Jan 17, 2017, 1:26:36 AM1/17/17
to torch7 on behalf of Fabrice Dugas

try this

> a = {[1]=torch.Tensor()}
> require('trepl')
> print(a)
{
  1 : DoubleTensor - empty
}

--
You received this message because you are subscribed to the Google Groups "torch7" group.
To unsubscribe from this group and stop receiving emails from it, send an email to torch7+unsubscribe@googlegroups.com.
To post to this group, send email to tor...@googlegroups.com.
Visit this group at https://groups.google.com/group/torch7.
For more options, visit https://groups.google.com/d/optout.

Fabrice Dugas

unread,
Jan 17, 2017, 7:33:41 AM1/17/17
to torch7
Ouu yay! TREPL, that's what I was looking for. Pretty printing and the all the code for it :D

Thank you very much kind sir.


On Tuesday, January 17, 2017 at 3:26:36 PM UTC+9, Jonghoon Jin wrote:

try this

> a = {[1]=torch.Tensor()}
> require('trepl')
> print(a)
{
  1 : DoubleTensor - empty
}
On Mon, Jan 16, 2017 at 10:10 PM, Fabrice Dugas via torch7 <torch7+APn2wQfyAxnGvWBMd2y7nmoS9LJ3oK1EYTTwIglD-Sc8lBp8mi-0FmC7y@googlegroups.com> wrote:
Hi there, small question out of curiosity.

I have been trying to figure out where Torch's fancy printing happens. For example, tables in torch are print like so:
{
 
1 : "Hello"
 
2 : "World"
 
3 : "!"
}

Instead of:
table: 0x7fb03d82b400
Which is the result of tostring.

Why is it different? Is there a way to get a string instead of printing?

Fabrice


--
You received this message because you are subscribed to the Google Groups "torch7" group.
To unsubscribe from this group and stop receiving emails from it, send an email to torch7+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages