State_dict truncates some tensors


I built a DQN in PyTorch for Kaggle’s ConnectX competition. Due to the format of the competition, I need to save the entire network as a string. However, state_dict() seems to be cutting the string output of some of the tensors arbitrarily.

Here’s an example:

conv3.weight 	 tensor([[[[-0.3832]],




         [[ 0.0565]],

         [[ 0.2471]],


As you can see, some of the tensor has been removed and replaced by the ellipsis (…).
Is there any way to circumvent this issue?


I found a solution to the problem. This isn’t related to state_dict at all, but is rather just the string returned by a torch.Tensor being capped.

Use torch.set_printoptions(profile=“full”) to increase the limit.