37 lines
985 B
Dart
37 lines
985 B
Dart
import 'package:archimedes_test/src/splat/tensor.dart';
|
|
import 'package:collection/collection.dart';
|
|
import 'package:test/test.dart';
|
|
|
|
void main() {
|
|
group('stack', () {
|
|
test('A random tensor can be generated', () {
|
|
Tensor generated = Tensor.random([2, 4]);
|
|
expect(generated.length, equals(2));
|
|
expect(generated[0].length, equals(4));
|
|
});
|
|
|
|
test("A tensor can be stacked", () {
|
|
Tensor x = Tensor(const DelegatingList([
|
|
DelegatingList([0.3367, 0.1288, 0.2345]),
|
|
DelegatingList([0.2303, -1.1229, -0.1863])
|
|
]));
|
|
|
|
expect(Tensor.stack(x)[0], equals(x));
|
|
expect(
|
|
Tensor.stack(x),
|
|
equals(Tensor.fromList([
|
|
[
|
|
[
|
|
[0.3367, 0.1288, 0.2345],
|
|
[0.3367, 0.1288, 0.2345],
|
|
],
|
|
[
|
|
[0.2303, -1.1229, -0.1863],
|
|
[0.2303, -1.1229, -0.1863]
|
|
]
|
|
]
|
|
])));
|
|
});
|
|
});
|
|
}
|