Giter Club home page Giter Club logo

Comments (2)

davidljung avatar davidljung commented on August 25, 2024

Same exception on Ubuntu 18.04 with Python 3.6.9 & PyTorch 1.3.1

from pylissom.

davidljung avatar davidljung commented on August 25, 2024

The issue is in pylissom.math.normalize:

def normalize(matrix, norm=1, axis=1):
    """
    This function implements a normalization of the row or column vectors of a matrix
    (by default, normalizes the columns and uses norm 1).
    Args:
        matrix: input matrix
        norm: Dimension of the norm
        axis: 0 is column, 1 is row
    Returns:
        A matrix normalized by columns or rows
    """
    matrix_norms = matrix.norm(p=norm, dim=axis)
    return matrix.div(matrix_norms.expand_as(matrix))

I'm not 100% sure I understand the intended behaviour, but making the following change:

    matrix_norms = matrix.norm(p=norm, dim=axis).reshape(-1 if axis==1 else 1,1 if axis==1 else -1)

to add a singleton dimension, seems to result in the function dividing each element by its row or col norm.
(possibly a more elegant way to implement it)

That fixes the exception on instantiation of Cortex. However, the UserWarning mentioned is still present.

from pylissom.

Related Issues (2)

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.