Skip to content

Utility for copying array to GPU #581

@gdalle

Description

@gdalle

Would this shortcut be welcome as a PR? I find it's one of the first thing I need when starting to play with KA, but perhaps I'm wrong.

function gpu(backend::Backend, x::Array)
    y = allocate(backend, eltype(x), size(x))
    return copyto!(y, x)
end

This is inspired by the Flux function of the same name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions