def _add_owned_constant(self, tensor: Tensor) -> None:
        """
        Add an owned constant, e.g. one with a bound "data" attribute.
        Here, we codegen some extra logic to load it into memory from the .so.
        """
        assert (
            self.constants_data_file is not None
        ), "Cannot add owned constants without a data file"

        name = tensor._attrs["name"]
        data = tensor._attrs["data"]
        assert (
            tensor._attrs["offset"] >= 0
        ), f"Constant node '{name}' must have non-negative offset"
        num_bytes = len(data)
        self.constants_data_file.write(data.to_bytes())

        constant_info = f'ConstantInfo{{"{name}", {self.constants_data_size}, {tensor._attrs["offset"]}, {num_bytes}}}'
        self.owned_constants_init.append(constant_info)
        self.constants_data_size += num_bytes
        self.num_constants += 1

        Add an owned constant, e.g. one with a bound "data" attribute.
        Here, we codegen some extra logic to load it into memory from the .so.
        
python/aitemplate/backend/codegen.py