During the creation process of the constant Tensor there is the following line:
tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape))
tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape)
You cannot assign a proto to a field of a proto as explained in this doc: https://developers.google.com/protocol-buffers/docs/reference/python-generated
You cannot assign a value to an embedded message field. Instead, assigning a value to any field within the child message implies setting the message field in the parent.
If you remove the CopyFrom, you will get the following error:
AttributeError: Assignment not allowed to field "tensor" in protocol message object.