FuSta icon indicating copy to clipboard operation
FuSta copied to clipboard

Windows support

Open azoksky opened this issue 2 years ago • 0 comments

Unfortunately, I am unable to run this on windows. When using torch==1.0.0 torchvision==0.2.1, faced c++ compliler issues. By using the latest conda version compatible with cuda 11.7, it worked and compilled pretty well. Then I fed the input images and it seemed to run well in the beginning. Then it complained of legacy autograd functions with correlation.py and I tried modifying the code by removing init() and adding @staticmethod along with apply() in the result. Now another error popped up. I am a newbie. Please help.

How can I resolve it?

Screenshot 2022-11-23 103010

Here is the modified correlation.py

class CorrelationFunction(torch.autograd.Function):

@staticmethod
def forward(ctx, input1, input2, 
        pad_size=3, kernel_size=3, max_displacement=20, stride1=1, stride2=2, corr_multiply=1):
    ctx.save_for_backward(input1, input2)

    with torch.cuda.device_of(input1):
        rbot1 = input1.new()
        rbot2 = input2.new()
        output = input1.new()
    return output

@staticmethod
def backward(ctx, grad_output):
    input1, input2 = ctx.saved_tensors

    with torch.cuda.device_of(input1):
        rbot1 = input1.new()
        rbot2 = input2.new()

        grad_input1 = input1.new()
        grad_input2 = input2.new()
    return grad_input1, grad_input2

class Correlation(torch.autograd.Function):

@staticmethod
def forward(ctx, input1, input2, 
        pad_size=0, kernel_size=0, max_displacement=0, stride1=1, stride2=2, corr_multiply=1): 
    result = CorrelationFunction.apply(input1, input2, pad_size, kernel_size, max_displacement, stride1, stride2, corr_multiply)
    return result

azoksky avatar Nov 23 '22 05:11 azoksky