GithubHelp home page GithubHelp logo

Comments (4)

wyg1997 avatar wyg1997 commented on May 26, 2024

原因是 torch 的 diagonal 操作是个 view op:

import torch as torch_original

print("torch test:")
inputs = torch_original.rand(3, 3)
y = inputs.diagonal(0)

print(y.is_contiguous())  # False
print(y.shape)  # torch.Size([3])
print(y.stride()  # (4,)

更多维度的时候只需要让 [:-2] 维度上的 stride 值为1就可以。

from oneflow.

lihuizhao avatar lihuizhao commented on May 26, 2024

oneflow里有没有对应的view op?

from oneflow.

marigoold avatar marigoold commented on May 26, 2024

原因是 torch 的 diagonal 操作是个 view op:

import torch as torch_original

print("torch test:")
inputs = torch_original.rand(3, 3)
y = inputs.diagonal(0)

print(y.is_contiguous())  # False
print(y.shape)  # torch.Size([3])
print(y.stride()  # (4,)

更多维度的时候只需要让 [:-2] 维度上的 stride 值为1就可以。

fill_ 是 SupportNonContiguous 的吧,这里 oneflow_inputs.diagonal(0) 返回一个 non contiguous 的 tensor,按理说 fill_ 不应该出错?

from oneflow.

wyg1997 avatar wyg1997 commented on May 26, 2024

fill_ 是 SupportNonContiguous 的吧,这里 oneflow_inputs.diagonal(0) 返回一个 non contiguous 的 tensor,按理说 fill_ 不应该出错?

哎是的,我之前没编译以为 diagnonal 不是 view 操作。
应该是 fill_ 本身的问题,看 kernel 是不支持非连续输入的,但注册的地方有 SupportNonContiguous ,和其他的 view op一起使用一样会计算出错。

from oneflow.

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.