d2l-ai / d2l-en

Interactive deep learning book with multi-framework code, math, and discussions. Adopted at 500 universities from 70 countries including Stanford, MIT, Harvard, and Cambridge.
https://D2L.ai
Other
23.92k stars 4.36k forks source link

Unnecessary output <tensorflow.python.keras.engine.sequential.Sequential at 0x7fd94cc7aa50> #1125

Closed astonzhang closed 4 years ago

astonzhang commented 4 years ago

http://preview.d2l.ai.s3-website-us-west-2.amazonaws.com/d2l-en/master/chapter_convolutional-neural-networks/lenet.html

Is there a way to avoid printing unnecessary output for train_ch6 (and possibly other similar functions): <tensorflow.python.keras.engine.sequential.Sequential at 0x7fd94cc7aa50>

@terrytangyuan

abhinavsp0730 commented 4 years ago

Hey, @astonzhang it's not the training output. I think the train_ch6 function is having a return statement. So while calling the model it's returning the model and thats why it's printing the address of the model. How, about making the train_ch6 without a return statement. @astonzhang @terrytangyuan does this work?

astonzhang commented 4 years ago

Hiding the return statement will be ideal.

terrytangyuan commented 4 years ago

The return is necessary since we are creating the model object inside the function the model will be used outside of the function scope. We can assign the returned model to a local variable for cases where the return value is not used to hide it from the output.

astonzhang commented 4 years ago

Sure, can we just hide it from the output?

astonzhang commented 4 years ago

Reason for closure: https://github.com/d2l-ai/d2l-en/pull/1221