Skip to content

Commit

Permalink
beta 0.1.1.5
Browse files Browse the repository at this point in the history
- cpu & gpu
	- add ceil mode in pool
	- fix softmax with neg axis
- cpu
	- add unsqueeze op
	- optimize lstm
- gpu
	- add 5x5 winograd in metal
	- add batch support for winograd in opencl
- onnx
	- add concat / gather / shape / squeeze / unsqueeze
	- fix data type support in constant
  • Loading branch information
liqing committed Jun 5, 2019
1 parent f7fbf2a commit 0b085d6
Show file tree
Hide file tree
Showing 46 changed files with 900 additions and 496 deletions.
1 change: 0 additions & 1 deletion demo/exec/pictureRecognition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ int main(int argc, const char* argv[]) {
std::shared_ptr<ImageProcess> pretreat(ImageProcess::create(config));
pretreat->setMatrix(trans);
pretreat->convert((uint8_t*)FreeImage_GetScanLine(newBitmap, 0), width, height, 0, input);
FreeImage_Save(FIF_PNG, newBitmap, argv[3], PNG_DEFAULT);
FreeImage_Unload(newBitmap);
}
net->runSession(session);
Expand Down
6 changes: 3 additions & 3 deletions doc/AddOp_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
Before adding Op, please refer to [Op Manual](OpList.md) to avoid unnecessary duplication.

In MNN, adding Op consists of the following steps:
1. [Add model description of Op](#Add_model_description_of_Op)
2. [Add model conversion of Op](#Add_model_conversion_of_Op)
3. [Calculate output tensor size of Op](#Calculate_output_tensor_size_of_Op)
1. [Add model description of Op](#Add-model-description-of-Op)
2. [Add model conversion of Op](#Add-model-conversion-of-Op)
3. [Calculate output tensor size of Op](#Calculate-output-tensor-size-of-Op)
4. Add Op implementation (execution) corresponding to Backend([CPU](#CPU)|[Metal](#Metal)|[Vulkan](#Vulkan)|[OpenCL](#OpenCL)|[OpenGL](#OpenGL))

## Add model description of Op
Expand Down
8 changes: 0 additions & 8 deletions project/ios/MNN.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,6 @@
EBB38F0E21E748B9005F76D7 /* ShapeQuantizedAvgPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBB38ED521E748B9005F76D7 /* ShapeQuantizedAvgPool.cpp */; };
EBB38F0F21E748B9005F76D7 /* ShapeArgMax.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBB38ED621E748B9005F76D7 /* ShapeArgMax.cpp */; };
EBB38F1121E748B9005F76D7 /* ShapeSliceTf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBB38ED821E748B9005F76D7 /* ShapeSliceTf.cpp */; };
EBB38F1221E748B9005F76D7 /* ShapeQuantizedAdd.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBB38ED921E748B9005F76D7 /* ShapeQuantizedAdd.cpp */; };
EBB38F1321E748B9005F76D7 /* ShapeResize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBB38EDA21E748B9005F76D7 /* ShapeResize.cpp */; };
EBB38F1421E748B9005F76D7 /* ShapeTranspose.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBB38EDB21E748B9005F76D7 /* ShapeTranspose.cpp */; };
EBB38F1521E748B9005F76D7 /* ShapeWhere.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBB38EDC21E748B9005F76D7 /* ShapeWhere.cpp */; };
Expand All @@ -672,7 +671,6 @@
EBB38F2321E748B9005F76D7 /* ShapePermute.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBB38EEA21E748B9005F76D7 /* ShapePermute.cpp */; };
EBB38F2421E748B9005F76D7 /* ShapeExpandDims.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBB38EEB21E748B9005F76D7 /* ShapeExpandDims.cpp */; };
EBB38F2521E748B9005F76D7 /* ShapeROIPooling.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBB38EEC21E748B9005F76D7 /* ShapeROIPooling.cpp */; };
EBB38F2921E748B9005F76D7 /* ShapeQuantizedConcat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBB38EF021E748B9005F76D7 /* ShapeQuantizedConcat.cpp */; };
EBB38F2A21E748B9005F76D7 /* ShapeCropAndResize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBB38EF121E748B9005F76D7 /* ShapeCropAndResize.cpp */; };
EBB38F2B21E748B9005F76D7 /* ShapeQuantizedMaxPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBB38EF221E748B9005F76D7 /* ShapeQuantizedMaxPool.cpp */; };
EBB38F2C21E748B9005F76D7 /* ShapeRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBB38EF321E748B9005F76D7 /* ShapeRange.cpp */; };
Expand Down Expand Up @@ -1358,7 +1356,6 @@
EBB38ED521E748B9005F76D7 /* ShapeQuantizedAvgPool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShapeQuantizedAvgPool.cpp; sourceTree = "<group>"; };
EBB38ED621E748B9005F76D7 /* ShapeArgMax.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShapeArgMax.cpp; sourceTree = "<group>"; };
EBB38ED821E748B9005F76D7 /* ShapeSliceTf.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShapeSliceTf.cpp; sourceTree = "<group>"; };
EBB38ED921E748B9005F76D7 /* ShapeQuantizedAdd.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShapeQuantizedAdd.cpp; sourceTree = "<group>"; };
EBB38EDA21E748B9005F76D7 /* ShapeResize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShapeResize.cpp; sourceTree = "<group>"; };
EBB38EDB21E748B9005F76D7 /* ShapeTranspose.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShapeTranspose.cpp; sourceTree = "<group>"; };
EBB38EDC21E748B9005F76D7 /* ShapeWhere.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShapeWhere.cpp; sourceTree = "<group>"; };
Expand All @@ -1378,7 +1375,6 @@
EBB38EEA21E748B9005F76D7 /* ShapePermute.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShapePermute.cpp; sourceTree = "<group>"; };
EBB38EEB21E748B9005F76D7 /* ShapeExpandDims.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShapeExpandDims.cpp; sourceTree = "<group>"; };
EBB38EEC21E748B9005F76D7 /* ShapeROIPooling.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShapeROIPooling.cpp; sourceTree = "<group>"; };
EBB38EF021E748B9005F76D7 /* ShapeQuantizedConcat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShapeQuantizedConcat.cpp; sourceTree = "<group>"; };
EBB38EF121E748B9005F76D7 /* ShapeCropAndResize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShapeCropAndResize.cpp; sourceTree = "<group>"; };
EBB38EF221E748B9005F76D7 /* ShapeQuantizedMaxPool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShapeQuantizedMaxPool.cpp; sourceTree = "<group>"; };
EBB38EF321E748B9005F76D7 /* ShapeRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShapeRange.cpp; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2279,9 +2275,7 @@
EBB38ED221E748B9005F76D7 /* ShapePool.cpp */,
EBB38EC821E748B9005F76D7 /* ShapePriorbox.cpp */,
EBB38EF721E748B9005F76D7 /* ShapeProposal.cpp */,
EBB38ED921E748B9005F76D7 /* ShapeQuantizedAdd.cpp */,
EBB38ED521E748B9005F76D7 /* ShapeQuantizedAvgPool.cpp */,
EBB38EF021E748B9005F76D7 /* ShapeQuantizedConcat.cpp */,
EBB38EF221E748B9005F76D7 /* ShapeQuantizedMaxPool.cpp */,
EBB38ED121E748B9005F76D7 /* ShapeQuantizedReshape.cpp */,
EBB38EF321E748B9005F76D7 /* ShapeRange.cpp */,
Expand Down Expand Up @@ -2709,7 +2703,6 @@
488876B7215B639F0079B12E /* MNNGemmInt8toInt32WithOffset.S in Sources */,
4888759B215B639F0079B12E /* MetalSpatialProduct.mm in Sources */,
92EEFEFF217F0CBC00F89377 /* CPUCrop.cpp in Sources */,
EBB38F1221E748B9005F76D7 /* ShapeQuantizedAdd.cpp in Sources */,
48887661215B639F0079B12E /* CPUDeconvolutionDepthwise.cpp in Sources */,
92682C5321819BF100B52B9D /* MetalSeLU.mm in Sources */,
488876C9215B639F0079B12E /* MNNGemmInt16to32_4x4_Unit.S in Sources */,
Expand Down Expand Up @@ -3100,7 +3093,6 @@
48A8A63721D8A43D00C2B9A7 /* BufferAllocator.cpp in Sources */,
92D765AF2228188700178BE5 /* Interpreter.cpp in Sources */,
4888765C215B639F0079B12E /* CPUNormalize.cpp in Sources */,
EBB38F2921E748B9005F76D7 /* ShapeQuantizedConcat.cpp in Sources */,
48A8A61521D101A700C2B9A7 /* ImageFloatBlitter.cpp in Sources */,
488875DF215B639F0079B12E /* MetalLSTM.mm in Sources */,
);
Expand Down
1 change: 1 addition & 0 deletions schema/default/CaffeOp.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ table Pool {
type:PoolType;
padType:PoolPadType;
dataType:DataType=DT_FLOAT;
ceilModel:bool=true;
}

table Relu {
Expand Down
1 change: 1 addition & 0 deletions schema/default/MNN.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ enum OpType : int {
Moments,
RNNSequenceGRU,
BatchMatMul,
Unsqueeze,
MAX_LAYER_TYPES,

MaxLayerCount = 128, // this count must bigger than the layer id of last layer
Expand Down
6 changes: 4 additions & 2 deletions source/backend/cpu/CPUGather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ CPUGather::CPUGather(Backend *b, const MNN::Op *op) : MNN::Execution(b), mOp(op)
ErrorCode CPUGather::onResize(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) {
MNN_ASSERT(1 == outputs.size());
auto indices = inputs[1];
MNN_ASSERT(indices->buffer().type.bits == 32 && mOp->main_as_Gather()->Tindices() == DataType_DT_INT32);
if(indices->buffer().type.bits != 32) {
return NOT_SUPPORT;
}
return NO_ERROR;
}

Expand All @@ -31,7 +33,7 @@ ErrorCode CPUGather::onExecute(const std::vector<Tensor *> &inputs, const std::v

MNN_ASSERT(embedding->buffer().type.bits == 32);

const size_t indicesCount = indices->size() / (indices->buffer().type.bits / 8);
const size_t indicesCount = indices->elementSize();
const auto limit = embedding->length(0);

auto outputData = output->host<float>();
Expand Down
Loading

0 comments on commit 0b085d6

Please sign in to comment.