ndav-torch-tensor 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ndav/torch/tensor.rb +31 -24
- data/ndav-torch-tensor.gemspec +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ea390bc80d0a532c10da276aac487657743f4e188a93db24424662c22be0e7c4
|
|
4
|
+
data.tar.gz: 620f47e4a3feda6a59958562a4e4463ba6fd2afa2cb03cb2b2b75846fe80bd7f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3c026d68364bc1a9a8511372dfb9ad2f2d83d8cb1887a1c744575cf8121bf3722d96d536b61bf1f996d0fd3c5b79ad3011cedc4ccb2fa58275510cb7ae60f85c
|
|
7
|
+
data.tar.gz: be8683e7369a631c60f64564f7884c6ee47bdc317885cfdb0b208edf9df66c52fbf0cb8788175ee3be8629bb859d5517d051ef40070731810d125a78edea7ea0
|
data/lib/ndav/torch/tensor.rb
CHANGED
|
@@ -31,31 +31,38 @@ class NDAV
|
|
|
31
31
|
float64: "d"
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
FORMAT_TO_TYPE =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
:"uint#{suffix}"
|
|
41
|
-
when "f", "d"
|
|
42
|
-
:"float#{suffix}"
|
|
43
|
-
else
|
|
44
|
-
case IO::Buffer::HOST_ENDIAN
|
|
45
|
-
when IO::Buffer::LITTLE_ENDIAN
|
|
46
|
-
if ["v", "V", "e", "E"].include? format
|
|
47
|
-
:"float#{suffix}"
|
|
48
|
-
end
|
|
49
|
-
when IO::Buffer::BIG_ENDIAN
|
|
50
|
-
if ["n", "N", "g", "G"].include? format
|
|
51
|
-
:"float#{suffix}"
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
[format, type]
|
|
56
|
-
}
|
|
34
|
+
FORMAT_TO_TYPE = Hash.new {|types, format| types[format] = type_from_format(format)}
|
|
35
|
+
|
|
36
|
+
class << self
|
|
37
|
+
def type_from_format(format)
|
|
38
|
+
item_desc = ITEM_DESCS[format]
|
|
39
|
+
return unless item_desc.length == 1
|
|
57
40
|
|
|
58
|
-
|
|
41
|
+
component = item_desc[0]
|
|
42
|
+
return unless component.repeat == 1
|
|
43
|
+
|
|
44
|
+
suffix = component.size * 8
|
|
45
|
+
case component.format
|
|
46
|
+
when "c", "s", "l", "q", "i", "j"
|
|
47
|
+
:"int#{suffix}"
|
|
48
|
+
when "C", "S", "L", "Q", "I", "J"
|
|
49
|
+
:"uint#{suffix}"
|
|
50
|
+
when "f", "d"
|
|
51
|
+
:"float#{suffix}"
|
|
52
|
+
else
|
|
53
|
+
case IO::Buffer::HOST_ENDIAN
|
|
54
|
+
when IO::Buffer::LITTLE_ENDIAN
|
|
55
|
+
if ["v", "V", "e", "E"].include? format
|
|
56
|
+
:"float#{suffix}"
|
|
57
|
+
end
|
|
58
|
+
when IO::Buffer::BIG_ENDIAN
|
|
59
|
+
if ["n", "N", "g", "G"].include? format
|
|
60
|
+
:"float#{suffix}"
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
59
66
|
|
|
60
67
|
module MemoryViewable
|
|
61
68
|
def ndav_descriptor(**)
|
data/ndav-torch-tensor.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = "ndav-torch-tensor"
|
|
3
|
-
s.version = "0.0.
|
|
3
|
+
s.version = "0.0.5"
|
|
4
4
|
s.authors = ["Kitaiti Makoto"]
|
|
5
5
|
s.summary = "N-Dimensional Array View for Torch::Tensors"
|
|
6
6
|
s.licenses = ["MIT"]
|
|
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
|
8
8
|
|
|
9
9
|
s.files = Dir.chdir(__dir__) {`git ls-files -z`.split("\x0")}
|
|
10
10
|
|
|
11
|
-
s.add_runtime_dependency "ndav", ">= 0.0.
|
|
11
|
+
s.add_runtime_dependency "ndav", ">= 0.0.7"
|
|
12
12
|
s.add_runtime_dependency "torch-rb"
|
|
13
13
|
|
|
14
14
|
s.add_development_dependency "rake"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ndav-torch-tensor
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kitaiti Makoto
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.0.
|
|
18
|
+
version: 0.0.7
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.0.
|
|
25
|
+
version: 0.0.7
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: torch-rb
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|