Code Monkey home page Code Monkey logo

Comments (4)

yikaiw avatar yikaiw commented on September 22, 2024 1
        if len(slim_params) % 3 == 0:
            slim_params.append(param[:len(param) // 3])
        elif len(slim_params) % 3 == 1:
            slim_params.append(param[len(param) // 3: len(param) // 3 * 2])
        else:
            slim_params.append(param[len(param) // 3 * 2:])

from cen.

yikaiw avatar yikaiw commented on September 22, 2024

Hi, thank you for the interest in our work.

In our previous implementation, we manually wrote exchanging codes for 3 or 4 modalities (based on Eq. 6 in the paper) respectively. An example script of 3 modalities is,

def forward(self, x, insnorm, insnorm_threshold):
    insnorm0, insnorm1, insnorm2 = insnorm[0].weight.abs(), insnorm[1].weight.abs(), insnorm[2].weight.abs()
    x0, x1, x2 = torch.zeros_like(x[0]), torch.zeros_like(x[1]), torch.zeros_like(x[2])
    x0[:, insnorm0 >= insnorm_threshold] = x[0][:, insnorm0 >= insnorm_threshold]
    x0[:, insnorm0 < insnorm_threshold] = (x[1][:, insnorm0 < insnorm_threshold] + x[2][:, insnorm0 < insnorm_threshold]) / 2
    x1[:, insnorm1 >= insnorm_threshold] = x[1][:, insnorm1 >= insnorm_threshold]
    x1[:, insnorm1 < insnorm_threshold] = (x[0][:, insnorm1 < insnorm_threshold] + x[2][:, insnorm1 < insnorm_threshold]) / 2
    x2[:, insnorm2 >= insnorm_threshold] = x[2][:, insnorm2 >= insnorm_threshold]
    x2[:, insnorm2 < insnorm_threshold] = (x[0][:, insnorm2 < insnorm_threshold] + x[1][:, insnorm2 < insnorm_threshold]) / 2
    return [x0, x1, x2]

In addition, for 3 modalities, these lines of code should be modified to three disjoint parts, as shown in our supplementary materials (Figure 11 and Figure 12).

from cen.

onat-dalmaz avatar onat-dalmaz commented on September 22, 2024

Hi, thank you very much for the quick response, that was really helpful. How can I modify those lines of code? If you have the sample code for 3 modalities, I would appreciate if you can share it.
Thanks.

from cen.

onat-dalmaz avatar onat-dalmaz commented on September 22, 2024

Thank you very much.

from cen.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.