class_docstr: Container for Tree style test model"
class_docstr_tok: ["Container","for","Tree","style","test","model","''"]
code: def __init__(self):
      self.in_shape = (1, 32, 32)
  
      init_norm = Gaussian(loc=0.0, scale=0.01)
  
      normrelu = dict(init=init_norm, activation=Rectlin())
      normsigm = dict(
          init=init_norm, activation=Logistic(shortcut=True)
      )
      normsoft = dict(init=init_norm, activation=Softmax())
  
      # setup model layers
      b1 = BranchNode(name="b1")
      b2 = BranchNode(name="b2")
  
      p1 = [
          Affine(nout=100, name="main1", **normrelu),
          b1,
          Affine(nout=32, name="main2", **normrelu),
          Affine(nout=160, name="main3", **normrelu),
          b2,
          Affine(nout=32, name="main2", **normrelu),
          # make next layer big to check sizing
          Affine(nout=320, name="main2", **normrelu),
          Affine(nout=10, name="main4", **normsoft),
      ]
  
      p2 = [
          b1,
          Affine(nout=16, name="branch1_1", **normrelu),
          Affine(nout=10, name="branch1_2", **normsigm),
      ]
  
      p3 = [
          b2,
          Affine(nout=16, name="branch2_1", **normrelu),
          Affine(nout=10, name="branch2_2", **normsigm),
      ]
  
      self.cost = Multicost(
          costs=[
              GeneralizedCost(costfunc=CrossEntropyMulti()),
              GeneralizedCost(costfunc=CrossEntropyBinary()),
              GeneralizedCost(costfunc=CrossEntropyBinary()),
          ],
          weights=[1, 0.0, 0.0],
      )
  
      self.layers = SingleOutputTree([p1, p2, p3], alphas=[1, 0.2, 0.2])
      self.model = Model(layers=self.layers)
      self.model.initialize(self.in_shape, cost=self.cost)
  
imports: import numpy
  import pytest
  from builtins import zip
  from neon import NervanaObject
  from neon.initializers import Gaussian, Constant, Kaiming
  from neon.layers import GeneralizedCost, Affine, Activation, Dropout
  from neon.layers import Conv, Pooling, Sequential, MergeMultistream
  from neon.layers import MergeSum, SkipNode, BatchNorm, MergeBroadcast, GeneralizedCostMask
  from neon.layers import BranchNode, Multicost, SingleOutputTree, LSTM
  from neon.layers.container import Broadcast
  from neon.models import Model
  from neon.transforms import Rectlin, CrossEntropyBinary, Softmax, Tanh
  from neon.transforms import Logistic, CrossEntropyMulti
label_desc: Use image node_id 1 to create a new TreeModel object from inherited base classes: object with example: obj = TreeModel()