Giter VIP home page Giter VIP logo

Comments (6)

denizyuret avatar denizyuret commented on June 10, 2024

This turned out to be tough nut to crack: it has to do with broadcast multiplying a Result{Array} with an Array{Any} that has Result's in it. I am not sure this code does anything useful but it certainly proved useful as a test case. @ekinakyurek where did you find this code and what is it supposed to compute?

from autograd.jl.

ekinakyurek avatar ekinakyurek commented on June 10, 2024

from autograd.jl.

hiiroo avatar hiiroo commented on June 10, 2024

I am not sure if that is exactly the same problem, but gives "AssertionError: Only scalar valued functions supported." with the code below.

using CuArrays
using AutoGrad
a= Param([cu(rand(4,1)) for i=1:4])
f(x) = (maximum.(a)).^2
@show f(a)
dvals = @diff f(a)
parameters = collect(params(dvals))
map(x->grad(dvals, x),parameters)

from autograd.jl.

fatihtalu avatar fatihtalu commented on June 10, 2024

The plot of F(t) runs. But Fd(t) can not run.
I see the same error (AssertionError: Only scalar valued functions supported.)

using Knet, Plots
F(t) = sin.(t)
Fd = grad(F)

t=0:0.1:2*3.14
plot(F(t))
plot(Fd(t))

from autograd.jl.

ozanarkancan avatar ozanarkancan commented on June 10, 2024

To take the grad of F, F should return a scalar value. Then you can apply broadcasted version of both F and Fd on t.

using Knet, Plots
F(t) = sin(t)
Fd = grad(F)

t=0:0.1:2*3.14
plot(F.(t))
plot(Fd.(t))

from autograd.jl.

fatihtalu avatar fatihtalu commented on June 10, 2024

Thank you very much Ozan.
The answer is true.

from autograd.jl.

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.