SMAUG
Simulating Machine Learning Applications on gem5-Aladdin
|
Implements a pooling operator. More...
#include <pooling_op.h>
Implements a pooling operator.
The pooling operator reduces the size of the input Tensor by applying a windowed filter that reduces all elements in its field of view to a single value.
Backend | The Backend specialization of this Operator. |
Definition at line 22 of file pooling_op.h.
Public Member Functions | |
PoolingOp (const std::string &name, OpType _opType, Workspace *workspace) | |
std::pair< int, int > | getPoolingSize () const |
std::pair< int, int > | getPoolingStride () const |
void | setPoolingSize (int rowSize, int colSize) |
void | setPoolingStride (int rowStride, int colStride) |
bool | validate () override |
Returns true if the parameters/tensors of this operator are all valid. | |
int | getNumOfmaps () const |
TensorShape | inferOutputShape () const |
void | createOutputTensors () |
void | createAllTensors () override |
For tests: creates all input and output tensors for this operator. More... | |
bool | isSamplingSupported () const override |
void | setSamplingInfo (const SamplingInfo &_sampling) override |
Public Member Functions inherited from smaug::Operator | |
Operator (const std::string &_name, OpType _opType, Workspace *_workspace) | |
virtual void | tile () |
virtual void | run ()=0 |
Executes the Operator. More... | |
virtual bool | isDead () |
Returns true if the Operator is dead. More... | |
virtual std::vector< TensorBase * > | getParameterizableInputs () |
Return a list of Tensors whose values that are parameterizable. More... | |
virtual int | getNumParameters () const |
This returns the number of parameterizable weights in the operator. | |
void | printSummary (std::ostream &out) const |
void | setInput (TensorBase *op, int index) |
void | setOutput (TensorBase *op, int index) |
void | setNumPendingInputs (int num) |
Set the number of input tensors that this operator is waiting on. More... | |
int | getNumPendingInputs () const |
void | decrNumPendingInputs () |
const std::string & | getName () const |
Vertex | getVertex () const |
void | setVertex (Vertex v) |
OpType | getOpType () const |
Workspace * | getWorkspace () |
Tensor * | getInput (int index) const |
const std::vector< TensorBase * > & | getInputs () const |
Tensor * | getOutput (int index) const |
const std::vector< TensorBase * > & | getOutputs () const |
void | setInputsMemType (MemoryType type) |
void | setWeightsMemType (MemoryType type) |
void | setOutputsMemType (MemoryType type) |
MemoryType | getInputsMemType () const |
MemoryType | getWeightsMemType () const |
MemoryType | getOutputsMemType () const |
Protected Types | |
enum | { Inputs, kNumInputs } |
enum | { Outputs, kNumOutputs } |
Protected Member Functions | |
int | calcOutputRows (int inputRows) const |
int | calcOutputCols (int inputCols) const |
int | computeOutputDim (int inputDims, int poolSize, int poolStride) const |
Protected Attributes | |
int | poolingRowSize |
int | poolingColSize |
int | poolingRowStride |
int | poolingColStride |
SamplingInfo | sampling |
Protected Attributes inherited from smaug::Operator | |
std::vector< TensorBase * > | inputs |
An ordered list of input tensors consumed by this operator. More... | |
std::vector< TensorBase * > | outputs |
An ordered list of output tensors produced by this operator. More... | |
std::string | name |
OpType | opType |
Vertex | vertex |
The BGL Vertex corresponding to this Operator. | |
Workspace * | workspace |
int | numPendingInputs |
The number of tensors that this operator is waiting on before it can be scheduled. | |
MemoryType | inputsMemType |
The memory interface over which input activations are expected to arrive. | |
MemoryType | weightsMemType |
The memory interface over which weights are expected to arrive. | |
MemoryType | outputsMemType |
The memory interface over which outputs are expected to be delivered. | |
|
inlineoverridevirtual |
For tests: creates all input and output tensors for this operator.
When running a network, all tensor shapes are specified in the network topology proto, and the network builder will automatically create them for you. In unit tests, this is a convenience method to avoid needing to create TensorShape protos.
This should only be called once the Operator is fully initialized with all required parameters. It is responsible for creating only the tensors it "owns". All operators "own" their output tensors, but not necessarily all of their input tensors. For example, a convolution operator "owns" its weight tensors, but not the input activations (which are the output of a previous Operator).
Note that "ownership" of a Tensor does not mean the Operator holds a std::unique_ptr to the Tensor; it simply means it is solely responsible for constructing and allocating memory for it.
Reimplemented from smaug::Operator.
Definition at line 93 of file pooling_op.h.