class_docstr: Conveniently edit the parameters of a lucid model.
  
  Example usage:
  
    model = models.InceptionV1()
    param = ParameterEditor(model.graph_def)
    # Flip weights of first channel of conv2d0
    param["conv2d0_w", :, :, :, 0] *= -1
class_docstr_tok: ["Conveniently","edit","the","parameters","of","a","lucid","model",".","Example","usage",":","model","=","models.InceptionV1","(",")","param","=","ParameterEditor","(","model.graph_def",")","#","Flip","weights","of","first","channel","of","conv2d0","param","[","``","conv2d0_w","''",",",":",",",":",",",":",",","0","]","*","=","-1"]
code: def __setitem__(self, key, new_value):
      name = key[0] if isinstance(key, tuple) else key
      tensor = self.nodes[name].attr["value"].tensor
      node_shape = tuple([int(d.size) for d in tensor.tensor_shape.dim])
      if isinstance(key, tuple):
          array = np.frombuffer(tensor.tensor_content, dtype="float32")
          array = array.reshape(node_shape).copy()
          array[key[1:]] = new_value
          tensor.tensor_content = array.tostring()
      else:
          assert new_value.shape == node_shape
          dtype = tf.DType(tensor.dtype).as_numpy_dtype
          tensor.tensor_content = new_value.astype(dtype).tostring()
  
imports: import numpy
  import tensorflow
label_desc: Use image node_id 3 for calling the ParameterEditor obj's underlying member method code with example usage: obj.__setitem__(key, new_value) without return types