5
$\begingroup$

Evaluating cells such as

i = NetEncoder[{"Image", {64, 64}, ColorSpace -> "Grayscale"}]
NetChain[{
  ConvolutionLayer[32, 5],
  Ramp,
  PoolingLayer[2]
  }, "Input" -> i]

always produces

enter image description here enter image description here

where as what I need is the open view

enter image description here enter image description here

, at least for the NetChain.

Is there a way to always display full details?

$\endgroup$
5
$\begingroup$

For neural networks, you can do

NeuralNetworks`Private`$ExpandNetSummaryBoxByDefault = True;

to open them by default.

For most other types of summary boxes, you can use the following:

prot = Unprotect@BoxForm`ArrangeSummaryBox;
DownValues@BoxForm`ArrangeSummaryBox = DownValues@BoxForm`ArrangeSummaryBox /.
   HoldPattern@DynamicModule[
      {open_ = False, rest__},
      body_
      ] :> DynamicModule[
     {open = True, rest},
     body
     ];
Protect /@ prot

This changes the default state of the generated boxes from closed to open.

$\endgroup$
  • $\begingroup$ Is there a way of doing this for any summary box without messing with its internals? I am ok to evaluate an additional function on a closed result each time. $\endgroup$ – Cetin Sert Dec 9 '19 at 21:53
  • $\begingroup$ As far as I know, no. The issue is that the state is stored inside a DynamicModuleBox, and I don't thinks it's feasible to get the variable and set it after the fact, without even worse messing with the front-end internals... $\endgroup$ – Lukas Lang Dec 9 '19 at 22:04
  • 2
    $\begingroup$ @CetinSert you can add a formatting wrapper that would introduce this rule only temporarily. Basically define some function: MakeBoxes[OpenedSummaryBoxes[e], form_]:=Internal`InheritedBlock[{BoxForm`ArrangeSummaryBox}, <<lucas's code >>; MakeBoxes[e, form] $\endgroup$ – b3m2a1 Dec 10 '19 at 5:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.