Handbook
Glossary
num-index ( n/seq tensor -- n tensor )
Vocabulary
tensors
.
private
Inputs
n/seq
an
object
tensor
an
object
Outputs
n
an
object
tensor
an
object
Definition
USING:
accessors
arrays
kernel
math
sequences
sequences.extras
tensors
;
IN:
tensors.private
:
num-index
( n/seq tensor -- n tensor )
swap
dup
array?
not
[
2dup
[
shape>>
length
]
dip
length
2dup
=
[
dimension-mismatch-error
]
unless
2drop
[
dup
shape>>
ind-mults
]
dip
[
*
]
2map-sum
]
unless
swap
;