Code Monkey home page Code Monkey logo

Comments (3)

jstoecker avatar jstoecker commented on September 12, 2024 1

Sorry for the delayed response! Most of us are still on holiday vacation. :)

This looks like a bug in DirectMLX. When there is a single node in a graph, the dml::Graph::Compile function is trying to eliminate some overhead by compiling the node as a standalone operator. This optimization only works when the bindings for the graph are identical to the bindings for the sole node in the graph. In your example they are not, since the graph input bindings do not include the third (optional) bias tensor for the convolution node.

The key thing to remember is that you're binding for the graph; you're not binding for the first node and last nodes in the graph. When you create a graph, you're effectively defining a new operator with its own bindings. Each call to dml::InputTensor with a unique inputIndex is adding another input binding to the graph. Your code is explicitly creating two input bind points for the graph:

auto input = dml::InputTensor(graph, 0, ...);
auto filter = dml::InputTensor(graph, 1, ...);

However, you could have declared the input and filter tensors in the opposite order:

auto filter = dml::InputTensor(graph, 0, ...);
auto input = dml::InputTensor(graph, 1, ...);

Either way, the graph itself only has two inputs. The graph inputs are wired to the node inputs based on the expressions you pass in: since you call dml::Convolution(input, filter) it will wire the graph's input at whatever index the input and filter tensors have when you called dml::InputTensor. It's a little easier to explain with a figure:

image

Pinging @adtsai (our binding expert) for his thoughts when he's back from vacation, but I believe we should remove this optimization or somehow detect when it's possible to do safely. For now, you can comment out lines 630-638 to work around.

from directml.

oldoldman avatar oldoldman commented on September 12, 2024

Some one can comment this for me ? :)

from directml.

oldoldman avatar oldoldman commented on September 12, 2024

thanks. So the "graph compiler" will deal with the optional binding automatically.

from directml.

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.