-
Couldn't load subscription status.
- Fork 5.9k
Closed
Description
Motivations
In the function package, class FunctionBase is the base class of Layer and Projection. Indeed, this design is not mandatory. We'd make replace class FunctionBase by std::function. An advantage of this change is that we can use Layers and Projections as they are C++ functions:
typedef std::function<Error(Tensors& inputs, Tensors& outputs)> CUDAKernel; CUDAKernel softmax = KernelRegisters.get("softmax"); softmax(ins, outs);Also, we can use std::bind to bind the value of some parameters, like we do with functions defined in std:
Error CosineKernel(Tensors& ins, Tensors& outs, double scale) { ... } KernelType cos = KernelRegister.get("cos", scale=3.0); cos(ins, outs);Actions Items
-
Change the use of class
Functionin layer definitions intostd::function<Error(Tensors& inputs, Tensors& outputs)>:- Decouple package
functionandlayer. - Define the conversion from
FunctionBasetoCUDAKernel. - Above has been done in Use KernelType instead of FunctionBase in Layer #2049.
- Decouple package
-
Rewrite class
Registerin packagefunction.
Metadata
Metadata
Assignees
Labels
No labels