Comments (4)
I was able to implement a temporary workaround to this issue by using element-wise set
. Basically:
- Convert the slice to a list of coordinates of the target array.
- Use
Owl.Dense.Ndarray.Generic.set
andList.iter2
to iterate over the list of coordinates and values and set them one at a time
List.iter2
(fun coord val ->
Owl.Dense.Ndarray.Generic.set coord val) coord_list value_list
I would like to add that this issue also affects the transpose
function as well. The offending lines are:
owl/src/owl/core/owl_ndarray_transpose.ml
Lines 41 to 54 in 455bde1
Unfortunately, I haven't been able to find a workaround for this
from owl.
UPDATE: So I managed to find a workaround for computing the transpose of any kind using Owl functions. Essentially, this involves converting between .Any
and .Generic
representations of an array. The functions that seem to not work on .Generic
happen to work on .Any
arrays. Here is an implementation of transpose that works for any Bigarray kind:
module Ndarray = Owl.Dense.Ndarray.Generic
module Anyarray = Owl.Dense.Ndarray.Any
let transpose ?axis x =
let shape = Ndarray.shape x in
let y = Anyarray.init_nd shape @@ fun c -> Ndarray.get x c in
let y' = Anyarray.transpose ?axis y in
Ndarray.init_nd (Ndarray.kind x) (Anyarray.shape y') @@ fun c ->
Anyarray.get y' c
I suppose this workaround can be generalized to any of the Generic functions that are limited to only 4 bigarray kinds?
Cc @jzstark
from owl.
Nice. The main downside is that this won't scale well since it involves copying everything twice, but at least would circumvent the current unnecessary limitation
from owl.
Nice. The main downside is that this won't scale well since it involves copying everything twice, but at least would circumvent the current unnecessary limitation
Perhaps it can be used only for the Bigarray kinds not currently supported by the Generic
module, that's if correctness/usability is prioritized over performance.
I am very interested in getting Generic
functions to work for any kind. What part of the codebase would I need to extend to support this functionality? Is it doable or too complicated for someone who doesn't have intimate knowledge of the codebase?
from owl.
Related Issues (20)
- Documentation is not in sync with current way plots are working
- OCaml cannot fins owl package HOT 1
- ssqr_diff' modifies inputs in place HOT 2
- Failure to load datasets for neural nets HOT 1
- Broken link to Algodiff module. HOT 2
- Exponential regression -- incorrect case HOT 1
- Test fails with GCC 13
- `Dataframe.to_cols` returns columns of incorrect size HOT 1
- Move project to ocaml-community HOT 7
- OCaml 5.2 support HOT 4
- Reintroduce owl-plplot HOT 6
- Dead link to TODO list HOT 1
- Random.float bounds are inclusive, be careful with logarithms
- Dataframe issues
- gamma_isf nan HOT 3
- Slack issues
- Map a fancy/basic index list into a list of array coordinates? HOT 1
- load_mnist_test_data can't download data HOT 1
- Serious bug with `not_equal_scalar` function always returning the wrong result.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from owl.