Skip to content

Instantly share code, notes, and snippets.

@haydnv
Created February 11, 2023 07:49
Show Gist options
  • Save haydnv/88fe281e14282db4794ba71dabcca9e9 to your computer and use it in GitHub Desktop.
Save haydnv/88fe281e14282db4794ba71dabcca9e9 to your computer and use it in GitHub Desktop.
custos-math
$ cargo test --no-default-features
Updating crates.io index
Compiling proc-macro2 v1.0.51
Compiling quote v1.0.23
Compiling unicode-ident v1.0.6
Compiling syn v1.0.107
Compiling custos v0.6.2
Compiling custos-math v0.6.2 (/home/haydn/Documents/custos-math-upstream)
Compiling custos-macro v0.1.0
warning: unused imports: `each_op_slice_mut`, `each_op`
--> src/ops/nn/activations.rs:1:13
|
1 | use crate::{each_op, each_op_slice_mut, Matrix};
| ^^^^^^^ ^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: unused imports: `CDatatype`, `MainMemory`
--> src/ops/nn/activations.rs:2:41
|
2 | use custos::{impl_stack, number::Float, CDatatype, Device, MainMemory, Shape};
| ^^^^^^^^^ ^^^^^^^^^^
warning: unused import: `CDatatype`
--> src/ops/nn/loss/mse.rs:4:31
|
4 | use custos::{prelude::Number, CDatatype, IsShapeIndep, Shape};
| ^^^^^^^^^
warning: unused imports: `ColOp`, `FnsOps`, `MaxOps`, `SumOverOps`, `TransposeOp`, `matrix_multiply::MatrixMultiply`
--> src/ops/nn/softmax.rs:7:5
|
7 | matrix_multiply::MatrixMultiply, ColOp, FnsOps, Matrix, MaxOps, SumOverOps,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ ^^^^^^ ^^^^^^ ^^^^^^^^^^
8 | TransposeOp,
| ^^^^^^^^^^^
warning: unused imports: `CPU`, `GenericBlas`, `number::Float`, `range`
--> src/ops/nn/softmax.rs:10:14
|
10 | use custos::{number::Float, range, Device, GenericBlas, CPU};
| ^^^^^^^^^^^^^ ^^^^^ ^^^^^^^^^^^ ^^^
warning: unused imports: `CPU`, `MainMemory`, `number::Number`
--> src/ops/arithmetic.rs:1:26
|
1 | use custos::{impl_stack, number::Number, Device, MainMemory, Shape, CPU};
| ^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^
warning: unused import: `ew_op`
--> src/ops/arithmetic.rs:3:13
|
3 | use crate::{ew_op, Matrix};
| ^^^^^
warning: unused imports: `CPU`, `number::Number`
--> src/ops/assign.rs:1:26
|
1 | use custos::{impl_stack, number::Number, Alloc, Buffer, Device, MainMemory, Shape, CPU};
| ^^^^^^^^^^^^^^ ^^^
warning: unused import: `assign_to_lhs`
--> src/ops/assign.rs:16:13
|
16 | use crate::{assign_to_lhs, element_wise_op_mut, Matrix};
| ^^^^^^^^^^^^^
warning: unused imports: `CDatatype`, `CPU`, `MainMemory`, `number::Number`
--> src/ops/clip.rs:1:26
|
1 | use custos::{impl_stack, number::Number, CDatatype, Device, MainMemory, Shape, CPU};
| ^^^^^^^^^^^^^^ ^^^^^^^^^ ^^^^^^^^^^ ^^^
warning: unused import: `cpu::col_op`
--> src/ops/col_op.rs:1:13
|
1 | use crate::{cpu::col_op, Matrix};
| ^^^^^^^^^^^
warning: unused imports: `CPU`, `MainMemory`, `number::Number`
--> src/ops/col_op.rs:2:14
|
2 | use custos::{number::Number, Device, MainMemory, CPU};
| ^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^
warning: unused imports: `CDatatype`, `MainMemory`
--> src/ops/diagflat.rs:6:14
|
6 | use custos::{CDatatype, Device, MainMemory};
| ^^^^^^^^^ ^^^^^^^^^^
warning: unused imports: `CDatatype`, `MainMemory`
--> src/ops/fns.rs:1:41
|
1 | use custos::{impl_stack, number::Float, CDatatype, Device, MainMemory, Shape};
| ^^^^^^^^^ ^^^^^^^^^^
warning: unused import: `each_op`
--> src/ops/fns.rs:9:13
|
9 | use crate::{each_op, Matrix};
| ^^^^^^^
warning: unused imports: `CPU`, `Dim2`, `GenericBlas`, `MainMemory`, `MayDim2`
--> src/ops/gemm.rs:1:34
|
1 | use custos::{impl_stack, Device, Dim2, GenericBlas, MainMemory, MayDim2, Shape, CPU};
| ^^^^ ^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^ ^^^
warning: unused imports: `CDatatype`, `CPU`, `MainMemory`, `number::Number`
--> src/ops/max.rs:2:14
|
2 | use custos::{number::Number, CDatatype, Device, MainMemory, CPU};
| ^^^^^^^^^^^^^^ ^^^^^^^^^ ^^^^^^^^^^ ^^^
warning: unused imports: `cpu::row_op`, `row_op_slice_lhs`
--> src/ops/row_op.rs:1:13
|
1 | use crate::{cpu::row_op, row_op_slice_lhs, Matrix};
| ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
warning: unused imports: `CDatatype`, `MainMemory`, `number::Number`
--> src/ops/row_op.rs:2:26
|
2 | use custos::{impl_stack, number::Number, CDatatype, Device, MainMemory, Shape};
| ^^^^^^^^^^^^^^ ^^^^^^^^^ ^^^^^^^^^^
warning: unused import: `cpu::scalar_apply`
--> src/ops/scalar.rs:1:13
|
1 | use crate::{cpu::scalar_apply, Matrix};
| ^^^^^^^^^^^^^^^^^
warning: unused imports: `CDatatype`, `MainMemory`, `number::Number`
--> src/ops/scalar.rs:2:26
|
2 | use custos::{impl_stack, number::Number, CDatatype, Device, MainMemory, Shape};
| ^^^^^^^^^^^^^^ ^^^^^^^^^ ^^^^^^^^^^
warning: unused import: `assign_to_lhs_scalar`
--> src/ops/scalar_assign.rs:1:13
|
1 | use crate::{assign_to_lhs_scalar, Matrix};
| ^^^^^^^^^^^^^^^^^^^^
warning: unused import: `SubAssign`
--> src/ops/scalar_assign.rs:2:50
|
2 | use core::ops::{AddAssign, DivAssign, MulAssign, SubAssign};
| ^^^^^^^^^
warning: unused imports: `CDatatype`, `CPU`, `MainMemory`
--> src/ops/scalar_assign.rs:3:26
|
3 | use custos::{impl_stack, CDatatype, Device, MainMemory, Shape, CPU};
| ^^^^^^^^^ ^^^^^^^^^^ ^^^
warning: unused imports: `CDatatype`, `CPU`, `MainMemory`, `impl_stack`, `number::Number`
--> src/ops/sum.rs:2:14
|
2 | use custos::{impl_stack, number::Number, CDatatype, Device, MainMemory, Shape, CPU};
| ^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^ ^^^^^^^^^^ ^^^
warning: unused imports: `CDatatype`, `MainMemory`
--> src/ops/transpose.rs:5:14
|
5 | use custos::{CDatatype, Device, MainMemory, Shape};
| ^^^^^^^^^ ^^^^^^^^^^
warning: unused import: `crate::Matrix`
--> src/matrix.rs:943:9
|
943 | use crate::Matrix;
| ^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: unused imports: `each_op_slice_mut`, `each_op`
--> src/ops/nn/activations.rs:1:13
|
1 | use crate::{each_op, each_op_slice_mut, Matrix};
| ^^^^^^^ ^^^^^^^^^^^^^^^^^
warning: unused import: `number::Float`
--> src/ops/nn/activations.rs:2:26
|
2 | use custos::{impl_stack, number::Float, CDatatype, Device, MainMemory, Shape};
| ^^^^^^^^^^^^^
warning: `custos-math` (lib) generated 27 warnings
error[E0599]: no function or associated item named `new` found for struct `CPU` in the current scope
--> tests/activations.rs:6:31
|
6 | let device = custos::CPU::new();
| ^^^ function or associated item not found in `CPU`
|
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
1 | use custos::Device;
|
error[E0432]: unresolved import `custos::cpu`
--> tests/row_op.rs:1:13
|
1 | use custos::cpu::CPU;
| ^^^ could not find `cpu` in `custos`
error[E0432]: unresolved import `custos::cpu`
--> tests/col_op.rs:1:13
|
1 | use custos::cpu::CPU;
| ^^^ could not find `cpu` in `custos`
error[E0599]: no method named `relu_mut` found for struct `Matrix<'_, {float}, _>` in the current scope
--> tests/activations.rs:9:9
|
9 | mat.relu_mut();
| ^^^^^^^^ method not found in `Matrix<'_, {float}, _>`
|
= note: the method was found for
- `Matrix<'a, T, D, S>`
warning: unused import: `std::time::Instant`
--> tests/gemm_trans.rs:1:5
|
1 | use std::time::Instant;
| ^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: unused imports: `CPU`, `Cache`, `GenericBlas`, `range`
--> tests/gemm_trans.rs:3:14
|
3 | use custos::{range, Cache, GenericBlas, CPU};
| ^^^^^ ^^^^^ ^^^^^^^^^^^ ^^^
warning: unused import: `custos_math::Matrix`
--> tests/gemm_trans.rs:4:5
|
4 | use custos_math::Matrix;
| ^^^^^^^^^^^^^^^^^^^
error[E0432]: unresolved import `custos::cpu`
--> tests/scalar.rs:1:14
|
1 | use custos::{cpu::CPU, number::Float};
| ^^^ could not find `cpu` in `custos`
error[E0599]: no method named `read` found for struct `Matrix<'_, {float}, _>` in the current scope
--> tests/activations.rs:11:20
|
11 | assert_eq!(mat.read(), [0., 0., 3., 0.3]);
| ^^^^ method not found in `Matrix<'_, {float}, _>`
|
= note: the method was found for
- `Matrix<'a, T, D, S>`
For more information about this error, try `rustc --explain E0599`.
warning: unused import: `ColOp`
--> tests/col_op.rs:2:19
|
2 | use custos_math::{ColOp, Matrix};
| ^^^^^
|
= note: `#[warn(unused_imports)]` on by default
error: could not compile `custos-math` due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
For more information about this error, try `rustc --explain E0432`.
warning: `custos-math` (test "col_op") generated 1 warning
error: could not compile `custos-math` due to previous error; 1 warning emitted
error[E0599]: no function or associated item named `new` found for struct `CPU` in the current scope
--> tests/max_op.rs:6:23
|
6 | let device = CPU::new();
| ^^^ function or associated item not found in `CPU`
|
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
1 | use custos::Device;
|
error[E0599]: no method named `read` found for struct `Matrix<'_, {float}, _>` in the current scope
--> tests/row_op.rs:12:18
|
12 | assert_eq!(c.read(), vec![2., 4., 6., 5., 7., 9., 8., 10., 12.]);
| ^^^^ method not found in `Matrix<'_, {float}, _>`
|
= note: the method was found for
- `Matrix<'a, T, D, S>`
warning: unused import: `MaxOps`
--> tests/max_op.rs:2:27
|
2 | use custos_math::{Matrix, MaxOps};
| ^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: unused import: `RowOp`
--> tests/row_op.rs:2:35
|
2 | use custos_math::{row_op, Matrix, RowOp};
| ^^^^^
|
= note: `#[warn(unused_imports)]` on by default
error[E0599]: no function or associated item named `new` found for struct `CPU` in the current scope
--> tests/sum.rs:6:23
|
6 | let device = CPU::new();
| ^^^ function or associated item not found in `CPU`
|
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
1 | use custos::Device;
|
Some errors have detailed explanations: E0432, E0599.
For more information about an error, try `rustc --explain E0432`.
error[E0599]: no function or associated item named `new` found for struct `CPU` in the current scope
--> tests/cce.rs:6:23
|
6 | let device = CPU::new();
| ^^^ function or associated item not found in `CPU`
|
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
1 | use custos::Device;
|
warning: `custos-math` (test "max_op") generated 1 warning
error: could not compile `custos-math` due to previous error; 1 warning emitted
error[E0599]: no method named `read` found for struct `Matrix<'_, {float}, _>` in the current scope
--> tests/scalar.rs:42:20
|
42 | assert_eq!(res.read(), vec![2.31, 3.12, 2., 6., 5.,]);
| ^^^^ method not found in `Matrix<'_, {float}, _>`
|
= note: the method was found for
- `Matrix<'a, T, D, S>`
warning: `custos-math` (test "row_op") generated 1 warning
error: could not compile `custos-math` due to 2 previous errors; 1 warning emitted
error[E0599]: no function or associated item named `new` found for struct `CPU` in the current scope
--> tests/softmax.rs:6:23
|
6 | let device = CPU::new();
| ^^^ function or associated item not found in `CPU`
|
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
1 | use custos::Device;
|
error[E0599]: the method `read` exists for struct `Matrix<'_>`, but its trait bounds were not satisfied
--> tests/sum.rs:20:20
|
20 | assert_eq!(res.read(), vec![-15., -15., -24.]);
| ^^^^ method cannot be called on `Matrix<'_>` due to unsatisfied trait bounds
|
::: /home/haydn/.cargo/registry/src/github.com-1ecc6299db9ec823/custos-0.6.2/src/buffer.rs:7:1
|
7 | pub struct CPU {}
| -------------- doesn't satisfy `CPU: custos::Read<f32>`
|
= note: the following trait bounds were not satisfied:
`CPU: custos::Read<f32>`
error[E0277]: the trait bound `CPU: Alloc<'_, f32>` is not satisfied
--> tests/softmax.rs:8:39
|
8 | let targets = Matrix::<f32>::from((&device, (2, 3), [0., 0., 1., 1., 0., 0.]));
| ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Alloc<'_, f32>` is not implemented for `CPU`
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `From<T>`:
<Matrix<'a, T, D, S> as From<(Buffer<'a, T, D, S>, (usize, usize))>>
<Matrix<'a, T, D, S> as From<(Buffer<'a, T, D, S>, usize, usize)>>
<Matrix<'a, T, D> as From<(&'a D, (usize, usize))>>
<Matrix<'a, T, D> as From<(&'a D, (usize, usize), &Vec<T>)>>
<Matrix<'a, T, D> as From<(&'a D, (usize, usize), &[T])>>
<Matrix<'a, T, D> as From<(&'a D, (usize, usize), Vec<T>)>>
<Matrix<'a, T, D> as From<(&'a D, (usize, usize), [T; N])>>
<Matrix<'a, T, D> as From<(&'a D, usize, usize)>>
and 3 others
= note: required for `Matrix<'_>` to implement `From<(&CPU, (usize, usize), [f32; 6])>`
error[E0599]: no method named `cce_loss` found for struct `Matrix<'_, {float}, _>` in the current scope
--> tests/cce.rs:11:17
|
11 | let res = x.cce_loss(&y);
| ^^^^^^^^ method not found in `Matrix<'_, {float}, _>`
|
= note: the method was found for
- `Matrix<'a, T, D, S>`
error: could not compile `custos-math` due to 2 previous errors
error[E0277]: the trait bound `CPU: RawConv` is not satisfied
--> tests/softmax.rs:8:39
|
8 | let targets = Matrix::<f32>::from((&device, (2, 3), [0., 0., 1., 1., 0., 0.]));
| ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `RawConv` is not implemented for `CPU`
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `From<T>`:
<Matrix<'a, T, D, S> as From<(Buffer<'a, T, D, S>, (usize, usize))>>
<Matrix<'a, T, D, S> as From<(Buffer<'a, T, D, S>, usize, usize)>>
<Matrix<'a, T, D> as From<(&'a D, (usize, usize))>>
<Matrix<'a, T, D> as From<(&'a D, (usize, usize), &Vec<T>)>>
<Matrix<'a, T, D> as From<(&'a D, (usize, usize), &[T])>>
<Matrix<'a, T, D> as From<(&'a D, (usize, usize), Vec<T>)>>
<Matrix<'a, T, D> as From<(&'a D, (usize, usize), [T; N])>>
<Matrix<'a, T, D> as From<(&'a D, usize, usize)>>
and 3 others
= note: required for `CPU` to implement `IsShapeIndep`
= note: required for `Matrix<'_>` to implement `From<(&CPU, (usize, usize), [f32; 6])>`
error[E0599]: the method `read` exists for struct `Matrix<'_>`, but its trait bounds were not satisfied
--> tests/sum.rs:23:20
|
23 | assert_eq!(res.read(), vec![-21., -15., -18.]);
| ^^^^ method cannot be called on `Matrix<'_>` due to unsatisfied trait bounds
|
::: /home/haydn/.cargo/registry/src/github.com-1ecc6299db9ec823/custos-0.6.2/src/buffer.rs:7:1
|
7 | pub struct CPU {}
| -------------- doesn't satisfy `CPU: custos::Read<f32>`
|
= note: the following trait bounds were not satisfied:
`CPU: custos::Read<f32>`
error[E0599]: no function or associated item named `new` found for struct `CPU` in the current scope
--> tests/fns.rs:18:23
|
18 | let device = CPU::new();
| ^^^ function or associated item not found in `CPU`
|
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
1 | use custos::Device;
|
warning: unused import: `SumOps`
--> tests/sum.rs:2:27
|
2 | use custos_math::{Matrix, SumOps, SumOverOps};
| ^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: unused import: `SumOverOps`
--> tests/sum.rs:2:35
|
2 | use custos_math::{Matrix, SumOps, SumOverOps};
| ^^^^^^^^^^
error[E0277]: the trait bound `CPU: Alloc<'_, {float}>` is not satisfied
--> tests/softmax.rs:9:34
|
9 | let activated = Matrix::from((&device, (2, 3), [0.1, 0.1, 0.8, 0.9, 0.05, 0.05]));
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Alloc<'_, {float}>` is not implemented for `CPU`
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `From<T>`:
<Matrix<'a, T, D, S> as From<(Buffer<'a, T, D, S>, (usize, usize))>>
<Matrix<'a, T, D, S> as From<(Buffer<'a, T, D, S>, usize, usize)>>
<Matrix<'a, T, D> as From<(&'a D, (usize, usize))>>
<Matrix<'a, T, D> as From<(&'a D, (usize, usize), &Vec<T>)>>
<Matrix<'a, T, D> as From<(&'a D, (usize, usize), &[T])>>
<Matrix<'a, T, D> as From<(&'a D, (usize, usize), Vec<T>)>>
<Matrix<'a, T, D> as From<(&'a D, (usize, usize), [T; N])>>
<Matrix<'a, T, D> as From<(&'a D, usize, usize)>>
and 3 others
= note: required for `Matrix<'_, {float}>` to implement `From<(&CPU, (usize, usize), [{float}; 6])>`
error: could not compile `custos-math` due to 2 previous errors
error[E0277]: the trait bound `CPU: RawConv` is not satisfied
--> tests/softmax.rs:9:34
|
9 | let activated = Matrix::from((&device, (2, 3), [0.1, 0.1, 0.8, 0.9, 0.05, 0.05]));
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `RawConv` is not implemented for `CPU`
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `From<T>`:
<Matrix<'a, T, D, S> as From<(Buffer<'a, T, D, S>, (usize, usize))>>
<Matrix<'a, T, D, S> as From<(Buffer<'a, T, D, S>, usize, usize)>>
<Matrix<'a, T, D> as From<(&'a D, (usize, usize))>>
<Matrix<'a, T, D> as From<(&'a D, (usize, usize), &Vec<T>)>>
<Matrix<'a, T, D> as From<(&'a D, (usize, usize), &[T])>>
<Matrix<'a, T, D> as From<(&'a D, (usize, usize), Vec<T>)>>
<Matrix<'a, T, D> as From<(&'a D, (usize, usize), [T; N])>>
<Matrix<'a, T, D> as From<(&'a D, usize, usize)>>
and 3 others
= note: required for `CPU` to implement `IsShapeIndep`
= note: required for `Matrix<'_, {float}>` to implement `From<(&CPU, (usize, usize), [{float}; 6])>`
warning: `custos-math` (test "sum") generated 2 warnings
error: could not compile `custos-math` due to 3 previous errors; 2 warnings emitted
error[E0599]: the method `cce_grad` exists for struct `Matrix<'_, {float}>`, but its trait bounds were not satisfied
--> tests/softmax.rs:11:27
|
11 | let grads = activated.cce_grad(&targets);
| ^^^^^^^^ method cannot be called on `Matrix<'_, {float}>` due to unsatisfied trait bounds
|
::: /home/haydn/.cargo/registry/src/github.com-1ecc6299db9ec823/custos-0.6.2/src/buffer.rs:7:1
|
7 | pub struct CPU {}
| -------------- doesn't satisfy `CPU: CCEOp<{float}>`
|
= note: the following trait bounds were not satisfied:
`CPU: CCEOp<{float}>`
warning: unused import: `FnsOps`
--> tests/fns.rs:2:19
|
2 | use custos_math::{FnsOps, Matrix};
| ^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: `custos-math` (test "fns") generated 1 warning
error: could not compile `custos-math` due to previous error; 1 warning emitted
error[E0599]: no method named `softmax_grad` found for struct `CPU` in the current scope
--> tests/softmax.rs:15:16
|
15 | device.softmax_grad(&activated, &grads);
| ^^^^^^^^^^^^ method not found in `CPU`
warning: unused import: `nn::SoftmaxOps`
--> tests/softmax.rs:2:19
|
2 | use custos_math::{nn::SoftmaxOps, Matrix};
| ^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.
warning: `custos-math` (test "softmax") generated 1 warning
error: could not compile `custos-math` due to 7 previous errors; 1 warning emitted
warning: `custos-math` (test "gemm_trans") generated 3 warnings
warning: `custos-math` (lib test) generated 28 warnings (26 duplicates)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment