Coder Social home page Coder Social logo

Comments (5)

soumith avatar soumith commented on August 28, 2024

is the matrix here contiguous? Can you post a code snippet to reproduce the issue?

from torch7.

Atcold avatar Atcold commented on August 28, 2024

I cropped the first column of an image, therefore no, data are not contiguous.

require 'image'
lena = image.lena()
lenaColumn = lena[{ {},{1,5},{1} }]
= lenaColumn
= lenaColumn:repeatTensor(1,1,2)

which outputs

(1,.,.) = 
  0.7569
  0.7686
  0.7804
  0.7843
  0.7843

(2,.,.) = 
  0.4353
  0.4471
  0.4510
  0.4549
  0.4549

(3,.,.) = 
  0.2902
  0.3020
  0.3059
  0.3137
  0.3216
[torch.DoubleTensor of dimension 3x5x1]


(1,.,.) = 
  0.7569  0.7569
  0.7765  0.7765
  0.7647  0.7647
  0.7647  0.7647
  0.7843  0.7843

(2,.,.) = 
  0.7882  0.7882
  0.7804  0.7804
  0.7922  0.7922
  0.7725  0.7725
  0.7765  0.7765

(3,.,.) = 
  0.7686  0.7686
  0.7529  0.7529
  0.7529  0.7529
  0.7569  0.7569
  0.7451  0.7451
[torch.DoubleTensor of dimension 3x5x2]

from torch7.

nicholas-leonard avatar nicholas-leonard commented on August 28, 2024

Yeah its definitely a problem of contiguity. When the input is contiguous, repeatTensor works.
Maybe we should just as an assert(tensor:isContiguous()) for now. Also, while we are in this function, we should probably allow passing a result tensor as is the case for most methods (allows for reusing memory).

from torch7.

soumith avatar soumith commented on August 28, 2024

closed via c19c892

from torch7.

Atcold avatar Atcold commented on August 28, 2024

Thank you!

from torch7.

Related Issues (20)

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.