code: def test_forward_optim_tree_enforce_inplace_op_invalid(self):
      m = model_helper.ModelHelper()
      m.Proto().type = "dag"
      m.Proto().num_workers = 4
  
      net = m.net
      net.IndexFreeze("A", "B")  # enforce inplace op
      net.Sum(["B", "B"], "C")
      net.Relu("C", "D")
      net.Sum(["D", "D"], "E")
  
      with self.assertRaises(RuntimeError):
          memonger.optimize_inference_for_dag(net, ["A"], "")
  
imports: import numpy
  from caffe2.python import workspace, memonger, core, model_helper, brew
  from caffe2.proto import caffe2_pb2
  import caffe2.python.hypothesis_test_util
  import hypothesis.strategies
  from hypothesis import given, settings
  import unittest
label_desc: Use image node_id 10 for calling the MemongerTest obj's underlying member method code with example usage: obj.test_forward_optim_tree_enforce_inplace_op_invalid() without return types