Skip to content

Commit b0cd99b

Browse files
committed
v0.7.0
1 parent f03b25c commit b0cd99b

3 files changed

Lines changed: 24 additions & 16 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# Changelog
22

3+
## 0.7.0
4+
5+
- add support for f16 dtypes, with f32 conversion as needed (#49, thanks @eek!)
6+
37
## 0.6.0
4-
- Add type declarations
58

9+
- Add type declarations
610

711
## 0.5.0
812

README.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@ yarn add npyjs
1919
# npm i npyjs
2020
```
2121

22-
## Import
22+
## Import
23+
2324
```javascript
2425
import npyjs from "npyjs";
2526
```
2627

27-
2828
## Usage
29+
2930
- Create a new npyjs object:
31+
3032
```javascript
3133
let n = new npyjs();
3234
// Or with options:
@@ -39,9 +41,7 @@ let n = new npyjs({ convertFloat16: false }); // Disable float16 to float32 conv
3941
n.load("my-array.npy", (array, shape) => {
4042
// `array` is a one-dimensional array of the raw data
4143
// `shape` is a one-dimensional array that holds a numpy-style shape.
42-
console.log(
43-
`You loaded an array with ${array.length} elements and ${shape.length} dimensions.`
44-
);
44+
console.log(`You loaded an array with ${array.length} elements and ${shape.length} dimensions.`);
4545
});
4646
```
4747

@@ -64,21 +64,25 @@ const npyArray = await n.load("test.npy");
6464
```javascript
6565
import ndarray from "ndarray";
6666
const npyArray = ndarray(data, shape);
67-
npyArray.get(10, 15)
67+
npyArray.get(10, 15);
6868
```
6969

7070
## Supported Data Types
71+
7172
The library supports the following NumPy data types:
72-
- `int8`, `uint8`
73-
- `int16`, `uint16`
74-
- `int32`, `uint32`
75-
- `int64`, `uint64` (as BigInt)
76-
- `float32`
77-
- `float64`
78-
- `float16` (converted to float32 by default)
73+
74+
- `int8`, `uint8`
75+
- `int16`, `uint16`
76+
- `int32`, `uint32`
77+
- `int64`, `uint64` (as BigInt)
78+
- `float32`
79+
- `float64`
80+
- `float16` (converted to float32 by default)
7981

8082
### Float16 Support
83+
8184
By default, float16 arrays are automatically converted to float32 for compatibility, since JavaScript doesn't natively support float16. You can control this behavior with the constructor options:
85+
8286
```javascript
8387
// Default behavior - float16 is converted to float32
8488
const n1 = new npyjs();

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "npyjs",
3-
"version": "0.6.0",
3+
"version": "0.7.0",
44
"type": "module",
55
"description": "Parse npy files in JS",
66
"exports": "./index.js",
@@ -20,4 +20,4 @@
2020
"dependencies": {
2121
"cross-fetch": "^3.1.5"
2222
}
23-
}
23+
}

0 commit comments

Comments
 (0)