Hello I am implementing a resnet 3d model in pytorch but constantly get non-deterministic result.
I do have all seed set up:
def seed_torch(seed=123):
random.seed(seed)
os.environ[‘PYTHONHASHSEED’] = str(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
torch.backends.cudnn.benchmark = False
torch.backends.cudnn.deterministic = True
def _init_fn(worker_id):
seed_torch(SEED)
I also change the model to Alexnet then the result is deterministic, so there must be some functions inside Resnet that cause this issue.
I am using the resnet 3D from:

  
      github.com
  
  
    kenshohara/3D-ResNets-PyTorch/blob/master/models/resnet.py 4
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import math
from functools import partial

__all__ = [
    'ResNet', 'resnet10', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
    'resnet152', 'resnet200'
]


def conv3x3x3(in_planes, out_planes, stride=1):
    # 3x3x3 convolution with padding
    return nn.Conv3d(
        in_planes,
        out_planes,
        kernel_size=3,
        stride=stride,


  This file has been truncated. show original

  
  
    
    
  
  


I tried both wide resnet and resnet, 18 and 50, all have the same issue