Giter Site home page Giter Site logo

facebookarchive / caffe2 Goto Github PK

View Code? Open in Web Editor NEW
8.4K 528.0 2.0K 392.86 MB

Caffe2 is a lightweight, modular, and scalable deep learning framework.

Home Page: https://caffe2.ai

License: Apache License 2.0

Shell 100.00%
deep-learning machine-learning ai artificial-intelligence caffe2 deep-neural-networks ml

caffe2's Introduction

caffe2's People

Contributors

aazzolini avatar bddppq avatar benzyx avatar boryiingsu avatar bwasti avatar chocjy avatar enosair avatar harouwu avatar houseroad avatar ilia-cher avatar jerryzh168 avatar jhcross avatar jspark1105 avatar kennyhorror avatar kittipatv avatar lukeyeager avatar onnxbot avatar orionr avatar pietern avatar pjh5 avatar salexspb avatar sf-wind avatar slayton58 avatar sunnieshang avatar urikz avatar viswanathgs avatar volkhin avatar xianjiec avatar xiaomengy avatar yangqing avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

caffe2's Issues

Compiling Caffe2_GPU in windows meets nvcc fatal error

My environment:

  • windows 10
  • visual studio 2015 community
  • cuda 8.0 and cudnn 5.1
  • NVIDIA GTX 960

Error output:

3>  Building NVCC (Device) object caffe2/CMakeFiles/Caffe2_GPU.dir/core/Release/Caffe2_GPU_generated_context_gpu.cu.obj
3>  CMake Warning (dev) at Caffe2_GPU_generated_context_gpu.cu.obj.Release.cmake:73:
3>    Syntax Warning in cmake code at column 178
3>
3>    Argument not separated from preceding token by whitespace.
3>  This warning is for project developers.  Use -Wno-dev to suppress it.
3>
3>  CMake Warning (dev) at Caffe2_GPU_generated_context_gpu.cu.obj.Release.cmake:73:
3>    Syntax Warning in cmake code at column 188
3>
3>    Argument not separated from preceding token by whitespace.
3>  This warning is for project developers.  Use -Wno-dev to suppress it.
3>
3>  nvcc fatal   : Unsupported gpu architecture 'compute_21'
3>
3>  CMake Error at Caffe2_GPU_generated_context_gpu.cu.obj.Release.cmake:218 (message):
3>    Error generating
3>    C:/Users/Ezineo/caffe2-master/build_gpu/caffe2/CMakeFiles/Caffe2_GPU.dir/core/Release/Caffe2_GPU_generated_context_gpu.cu.obj
3>
3>
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: “cmd.exe” exited, code 1.

Tests interfere on multi-user machines

Due the use of fixed snapshot names during test (e.g., due to https://github.com/Yangqing/caffe2/blob/master/data/mnist/generate_mnist_linear_classifier.py#L8), snapshotting may fail with a permissions error on https://github.com/Yangqing/caffe2/blob/master/caffe2/utils/proto_utils.cc#L61 if the target file is already owned by another user, i.e., if another user has already run the test.

I guess there should be some per-build scheme for locating such files.

Build Caffe2 on windows failed

I was trying to install Caffe2 on Windows Server 2016 (VM) with CMake, Visual Studio 2017 Community Edition, Python 3.5 (Anaconda 4.2.0) installed. When running Script\Build_Windows.bat, got the following error:

"C:\Users\sqlpythonadmin\Source\Repos\caffe2\build\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\Users\sqlpythonadmin\Source\Repos\caffe2\build\caffe2\Caffe2_CPU.vcxproj" (default target) (3) ->
"C:\Users\sqlpythonadmin\Source\Repos\caffe2\build\caffe2\proto\Caffe2_PROTO.vcxproj" (default target) (4) ->
(ClCompile target) ->
C:\Users\sqlpythonadmin\Source\Repos\caffe2\build\caffe2/proto/caffe2.pb.h(12): fatal error C1189: #error: This file
was generated by a newer version of protoc which is [C:\Users\sqlpythonadmin\Source\Repos\caffe2\build\caffe2\proto\Ca
ffe2_PROTO.vcxproj]
C:\Users\sqlpythonadmin\Source\Repos\caffe2\build\caffe2/proto/caffe2_legacy.pb.h(12): fatal error C1189: #error: Th
is file was generated by a newer version of protoc which is [C:\Users\sqlpythonadmin\Source\Repos\caffe2\build\caffe2\p
roto\Caffe2_PROTO.vcxproj]
C:\Users\sqlpythonadmin\Source\Repos\caffe2\build\caffe2/proto/hsm.pb.h(12): fatal error C1189: #error: This file wa
s generated by a newer version of protoc which is [C:\Users\sqlpythonadmin\Source\Repos\caffe2\build\caffe2\proto\Caffe
2_PROTO.vcxproj]
C:\Users\sqlpythonadmin\Source\Repos\caffe2\build\caffe2/proto/metanet.pb.h(12): fatal error C1189: #error: This fil
e was generated by a newer version of protoc which is [C:\Users\sqlpythonadmin\Source\Repos\caffe2\build\caffe2\proto\C
affe2_PROTO.vcxproj]
C:\Users\sqlpythonadmin\Source\Repos\caffe2\build\caffe2/proto/predictor_consts.pb.h(12): fatal error C1189: #error:
This file was generated by a newer version of protoc which is [C:\Users\sqlpythonadmin\Source\Repos\caffe2\build\caffe
2\proto\Caffe2_PROTO.vcxproj]

"C:\Users\sqlpythonadmin\Source\Repos\caffe2\build\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\Users\sqlpythonadmin\Source\Repos\caffe2\build\caffe2\Caffe2_CPU.vcxproj" (default target) (3) ->
"C:\Users\sqlpythonadmin\Source\Repos\caffe2\build\caffe\proto\Caffe_PROTO.vcxproj" (default target) (5) ->
C:\Users\sqlpythonadmin\Source\Repos\caffe2\build\caffe/proto/caffe.pb.h(12): fatal error C1189: #error: This file w
as generated by a newer version of protoc which is [C:\Users\sqlpythonadmin\Source\Repos\caffe2\build\caffe\proto\Caffe
_PROTO.vcxproj]

6 Warning(s)
6 Error(s)

How could I resolve these errors?

To give some context, initially I installed protobuf using command:
conda install -c conda-forge protobuf=3.2.0
but when running build script, it reports a CMake Error: The source directory "C:/Users/sqlpythonadmin/Source/Repos/caffe2/third_party/protobuf/cmake" does not exist. Hence end up build protobuf locally using .sln in Visual Studio 2017

Ubuntu 14.04 server - libCaffe2_CPU.so missing

After setting up Ubuntu Trusty VM and getting the build process to succeed, I tried running the Basics tutorial notebook's first code block that imports the libraries, but was met with this error:

WARNING:root:Debug message: libCaffe2_CPU.so: cannot open shared object file: No such file or directory CRITICAL:root:Cannot load caffe2.python. Error: libCaffe2_CPU.so: cannot open shared object file: No such file or directory

Problem with running Multibox implementation

Dear Yangqing,

Right now our data science group is working on image recognition project for one of our customers. Towards this, we tried to test the implementation of Google Multibox algorithm you had published on github using latest caffe2 build.

Unfortunately, we faced with an issue which looks like a problem with caffe2 framework. I will really appreciate your assistance with solving of this issue. Please let me know if you need any additional information.

Here is some debug information:


RuntimeError Traceback (most recent call last)
in ()
22 # Specify the device option of the network, and then create it.
23 net.device_option.CopyFrom(DEVICE_OPTION)
---> 24 workspace.CreateNet(net)

/home/ubuntu/caffe2/gen/pycaffe2/workspace.py in CreateNet(net, input_blobs)
96 for input_blob in input_blobs:
97 CreateBlob(input_blob)
---> 98 return cc_CreateNet(StringfyProto(net))
99
100 def RunOperatorOnce(operator):

RuntimeError: Cannot create network. See console log for error messages.

I1015 00:09:11.957850 30545 workspace.cc:46] Initializing network multibox
Key Conv not found.
Available keys:
Registry key: Allreduce
Registry key: Broadcast
Registry key: Iter
Registry key: LearningRate
A total of 4 registered keys.
Returning null pointer.Key Clip not found.
Available keys:
Registry key: Allreduce
Registry key: Broadcast
Registry key: Iter
Registry key: LearningRate
A total of 4 registered keys.
Returning null pointer.Key MaxPool not found.
Available keys:
Registry key: Allreduce
Registry key: Broadcast
Registry key: Iter
Registry key: LearningRate
A total of 4 registered keys.
Returning null pointer.Key Conv not found.
Available keys:
Registry key: Allreduce
Registry key: Broadcast
Registry key: Iter
Registry key: LearningRate
A total of 4 registered keys.

Thanks,
Iurii

Unable to make , due to undefined reference to cv?

I am getting this error while compiling caffe2. Please help me out here. Previously I have installed and used caffe and opencv successfully.

gen/caffe2/binaries/libconvert_encoded_to_raw_leveldb.a(convert_encoded_to_raw_leveldb.o): In function caffe2::ConvertToRawDataset(std::string const&, std::string const&)': convert_encoded_to_raw_leveldb.cc:(.text+0x47c): undefined reference tocv::imdecode(cv::_InputArray const&, int)'
collect2: error: ld returned 1 exit status

caffe2 for android

Are there plans for porting caffe2 for android? Will caffe2Go be opensourced soon?

The error of the compling, like"libCaffe2_CPU.so:对‘google::protobuf::io::CodedInputStream::PushLimit(int)’未定义的引用"

The libs of protobuf were placed on the default path(/usr/local/lib), the version was 3.1.0. After the operation "cmake ../", the value of PROTOBUF_LIBRARY is "/usr/local/lib/libprotobuf.so" in the file CmakeCache.txt. According to it, I thinks caffe2 should can link to the protobuf libs. But there are problems about the link of the protobuf libs.
image 10
I hope you can give me some messages to help me.

Docker File Improvement

Rocksdb installation
Since the current script installs the HEAD version of rocksdb, it may brings in error while building. Please use a stable release version instead.

code related:
git clone https://github.com/facebook/rocksdb.git

build_ios.sh script failing

I successfully installed caffe2 on my unbuntu machine and on my macbook! However ./scripts/build_ios.sh is not working for me. I get the following error:

In file included from /Users/nicojimenez/git/caffe2/caffe2/image/image_input_op.cc:1:
/Users/nicojimenez/git/caffe2/caffe2/image/image_input_op.h:470:21: error: no member named 'runTask'
      in 'caffe2::ThreadPool'
      thread_pool_->runTask(std::bind(
      ~~~~~~~~~~~~  ^
/Users/nicojimenez/git/caffe2/caffe2/image/image_input_op.h:482:21: error: no member named 'runTask'
      in 'caffe2::ThreadPool'
      thread_pool_->runTask(std::bind(
      ~~~~~~~~~~~~  ^
/Users/nicojimenez/git/caffe2/caffe2/image/image_input_op.h:493:17: error: no member named
      'waitWorkComplete' in 'caffe2::ThreadPool'
  thread_pool_->waitWorkComplete();
  ~~~~~~~~~~~~  ^
3 errors generated.

What's happening is that the ThreadPool class from ThreadPool.h is being used instead of the intended ThreadPool class from utils/thread_pool.h. I was able to resolve the build error by changing variable names to remove the duplication (renamed ThreadPool to TaskThreadPool in utils/thread_pool.h). Happy to make a PR if this is an acceptable solution.

AttributeError in Caffe_Translator

Hi,
when I run Caffe_translator.ipynb with the latest master caffe2 to this cell,

# We will first specify the device option: how we want to run the network.
#net.device_option.device_type = caffe2_pb2.CPU
# If you want to use cuda, use the following commands
net.device_option.device_type = caffe2_pb2.CUDA
net.device_option.cuda_gpu_id = 0

# Here we will simply use the Model object to host the model.
model = workspace.Model(net, pretrained_params, ["data"], ["prob"])
print 'Network created sucessfully.'

I meet AttributeError:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-8-813210097dbd> in <module>()
      6 
      7 # Here we will simply use the Model object to host the model.
----> 8 model = workspace.Model(net, pretrained_params, ["data"], ["prob"])
      9 print 'Network created sucessfully.'

AttributeError: 'module' object has no attribute 'Model'

Thanks for reply!

Please consider merging with DMLC/MXNet

No offence intended. Everybody respects that you created the great Caffe. Thank you very much!

But the current design seems a mix of the original Caffe and the radically differently designed MXNet. The latter has implemented many features in your road map and is gaining more momentum than this project in terms of GitHub contributors, pull requests/issues, stars, forks and watches. If you would like to combine the two independent efforts like the Avengers and lead the joint project, you as team will certainly create more rapidly a more impactful next generation distributed deep learning framework that many people have heard of but had no access to for three years [1].

[1] Jeffrey Dean, Greg S. Corrado, Rajat Monga, Kai Chen, Matthieu Devin, Quoc V. Le, Mark Z. Mao, Marc’Aurelio Ranzato, Andrew Senior, Paul Tucker, Ke Yang, and Andrew Y. Ng. Large Scale Distributed Deep Networks. In Proceedings of Neural and Information Processing Systems (NIPS), 2012, Lake Tahoe, Nevada, United States, December, 2012.

generate_alexnet dumped

test_net.AddGradientOperators(first=2) goes wrong, first id not recognized.
When I change 'first' to 'skip', I get segmentation fault. It breaks in AddGradientOperators
for forward_op, current_fwd_metadata in zip(operators[::-1], fwd_metadata[::-1]):
13th iteration.

caffe_translator,ValueError: Protocol message has no singular "torch_pooling" field.

when i use caffe_translator to translate caffe.model to caffe2.pb ,there is a problem

File "/home/xqp/caffe2/python/caffe_translator.py", line 122, in TranslateModel
layer, pretrained_blobs, is_test)
File "/home/xqp/caffe2/python/caffe_translator.py", line 67, in TranslateLayer
layer, pretrained_blobs, is_test)
File "/home/xqp/caffe2/python/caffe_translator.py", line 292, in TranslatePool
if param.HasField('torch_pooling') and param.torch_pooling:
File "/home/xqp/caffe2/build/third_party/protobuf/python/google/protobuf/internal/python_message.py", line 598, in HasField
'Protocol message has no singular "%s" field.' % field_name)
ValueError: Protocol message has no singular "torch_pooling" field.

then i have not found 'torch' in .proto.
Next i change it ,however,there is also aproblem
# if param.HasField('torch_pooling') and param.torch_pooling:
# In the Facebook port of Caffe, a torch_pooling field was added to
# map the pooling computation of Torch. Essentially, it uses
# floor((height + 2 * padding - kernel) / stride) + 1
# instead of
# ceil((height + 2 * padding - kernel) / stride) + 1
# which is Caffe's version.
# Torch pooling is actually the same as Caffe2 pooling, so we don't
# need to do anything.
# pass

else:

AddArgument(caffe_op, "legacy_pad",

         #      caffe2_legacy_pb2.CAFFE_LEGACY_POOLING)
**AddArgument(caffe_op, "legacy_pad",
             caffe2_legacy_pb2.CAFFE_LEGACY_POOLING)**

Trying benchmarking ConvNets in PyCaffe2 fails.

Hi there!

I'm currently trying to run a Python script located atcaffe2/python/convnet_benchmarks.py. Unfortunately, it breaks in runtime. My OS is Ubuntu 16.04 this time. It'll nice if you could help me out here.

I built caffe2 framework with no GPU support and now executing the following script from the <caffe2-home>/build directory:

PYTHONPATH=.:$PYTHONPATH PATH=<caffe2-home>/build/caffe2:$PATH python caffe2/python/convnet_benchmarks.py --batch_size 128 --model AlexNet

It fails with the following message:

WARNING:root:This caffe2 python run does not have GPU support. Will run in CPU only mode.
WARNING:root:Debug message: No module named caffe2_pybind11_state_gpu
AlexNet: running forward-backward.
Traceback (most recent call last):
  File "caffe2/python/convnet_benchmarks.py", line 657, in <module>
    Benchmark(model_map[args.model], args)
  File "caffe2/python/convnet_benchmarks.py", line 564, in Benchmark
    workspace.RunNetOnce(model.param_init_net)
  File "/home/kostya_by/git-repos/caffe2/build/caffe2/python/workspace.py", line 151, in RunNetOnce
    return C.run_net_once(StringfyProto(net))
RuntimeError: [enforce fail at operator.cc:106] op. Cannot create operator of type 'XavierFill'. Verify that implementation for the corresponding device exist. It might also happen if the binary is not linked with the operator implementation code. If Python frontend is used it might happen if dyndep.InitOpsLibrary call is missing. Operator def: output: "conv1_w" name: "" type: "XavierFill" arg { name: "shape" ints: 64 ints: 3 ints: 11 ints: 11 } device_option { device_type: 1 cuda_gpu_id: 0 }

A help message in the header of the script suggests to add ../gen path to the PYTHONPATH variable, but I believe this suggestion is a bit outdated as no gen directories are generated during the current framework installation process.

Thanks in advance!

printing OpSchema::doc_ from python?

Hi, is there a way to print OpSchema::doc_ from python script? I know I can list all the registered ops names:
ops = workspace.RegisteredOperators()

Can I then access their descriptions when I have their names? (or read other attributes?)
Thanks!

SpatialBN doesn't support in-place input and output

Hi, I was just testing my predict net with caffe2. and I meet this:

`[E ....\caffe2\core\operator_schema.cc:57] Input index 0 and output idx 0 are set to be in-place but this is actually not supported by op SpatialBN

RuntimeError:
'[enforce fail at ..\..\caffe2\core\operator.cc:66] schema->Verify(operator_def). Operator def...BN" arg { name: "is_test" i: 1 } arg { name: "epsilon" f: 1e-06 } arg { name: "order" s: "NCHW" } '`

I wonder why SpatialBN op doesn't support in-place input and output and how to solve it.
Thanks.

Problem with running Multibox implementation

I have the following error when running the multibox implementation:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-9-32ba0248c8c0> in <module>()
     22 # Specify the device option of the network, and then create it.
     23 net.device_option.CopyFrom(DEVICE_OPTION)
---> 24 workspace.CreateNet(net)

/home/exx/caffe2/gen/pycaffe2/workspace.pyc in CreateNet(net, input_blobs)
     97   for input_blob in input_blobs:
     98     CreateBlob(input_blob)
---> 99   return cc_CreateNet(StringfyProto(net))
    100 
    101 def RunOperatorOnce(operator):

RuntimeError: Cannot create network. See console log for error messages.

I am running on Ubuntu 14.04, and caffe2 built cleanly. The console error log reports:

 [E operator.cc:83] Output size 2 not in range [min=1, max=1].
[E operator.cc:86] Error at operator :MaxPool
[E net.cc:55] Failed to verify operator.
[E workspace.cc:60] Error when setting up network multibox

Your assistance is appreciated.

Multibox : Error from operator input: "avgpool7"

I get an error whenever I try to run multibox. I'm trying to run it on CPU with gcc 5.4. The error happens when I call this : workspace.RunNet("multibox") . It says there are 4 dimensions instead of 2, but I don't know how to solve this problem.

Here's the error I get in the terminal :

I0824 22:32:45.188304 24099 workspace.cc:105] Initializing network multibox
E0824 22:32:46.356940 24099 logging.cc:59] [enforce fail at fully_connected_op.h:25] W.ndim() == 2. 4
E0824 22:32:46.357280 24099 logging.cc:64] Error from operator input: "avgpool7"
input: "nn0_w"
input: "nn0_b"
output: "nn0_pre_relu6"
type: "FC"
device_option {
device_type: CPU
}
Traceback (most recent call last):
File "code_multibox.py", line 109, in
location, confidence = RunMultiboxOnImage("not-penguin.jpg", LOCATION_PRIOR)
File "code_multibox.py", line 96, in RunMultiboxOnImage
workspace.RunNet("multibox")
RuntimeError: [enforce fail at fully_connected_op.h:25] W.ndim() == 2. 4Error from operator input: "avgpool7"
input: "nn0_w"
input: "nn0_b"
output: "nn0_pre_relu6"
type: "FC"
device_option {
device_type: CPU
}

It would be appreciated if someone can help me on this.
Thanks!

SummarizeOp fails if using core.NameScope

  • core.NameScope adds a '/' to blobnames.
  • SummarizeOp tries to create a file for each blob.
  • In Linux, filenames can't have '/' in them.
  • Thus, SummarizeOp fails when creating a file.

The error is like this:
RuntimeError: [enforce fail at summarize_op.h:32] log_file_->good(). Failed to open summarize file for tensor gpu_0/conv_w. rdstate() = 4

We may need a regex solution for this operator as well.

Debug errors in the data_layer

@Yangqing , I have rewite the the data_layer for a triplet_data, you know in some versions, the data_layer.cpp must include the pthread.h to prefetch data, and now when I running the net, there comes an error and the data_layer can't work normally.

0x00007ffff23c866b in pthread_join (threadid=140736858203904, 
thread_return=0x0) at pthread_join.c:92
92  pthread_join.c: No such file or directory.

for this problem, I have checked my system environment and there are two libpthread.a, and there is an MATLAB's libpathread.a, another one is system's own. Does I need to make some changes to Makefile

Compiling error

info:

WARNING: Build failed: //third_party:nccl. Fail messages are as follows:
nvcc fatal : Unsupported gpu architecture 'compute_61'

what's meaning?

@Yangqing

Multinode over internet, Async and Parallel SGD, WebAssembly

I see that your are opening here also to a distributed perspective. What do you think of some emerging solution like http://arxiv.org/abs/1503.05743? Yes this rely on WebCL that it is not supported natively in any browser and actually propose only convolutional layers in a distributed fashion. But some discussion on WebAssembly, in which also Google is involved, are starting to think on GPU support of this forming standard. See WebAssembly/design#273. Do you think that caffe2 design could be further proof to scale at the level where every node could run on a browser tab? Or don't you believe that training and networks design could evolve at large scale relying on users nodes with "standard" internet bandwidth interconnection?

Forward Performance on CPU

I tested the googlenet on my ubuntu pc (cpu i7), when I use the cat.jpg as the input of the net, the run consume 6s (cpu mode). It's too long , is it normal?

Almost same time consuming both using cpp interface and using python interface.

caffe2 build setting:

  • USE_OPENMP=OFF
  • USE_MPI=OFF
  • Blas: Eigen

Here is my core code.

void run() {
    if (FLAGS_init_net.empty()) {
        LOG(FATAL) << "No init net specified. Use --init_net=/path/to/net.";
    }
    if (FLAGS_predict_net.empty()) {
        LOG(FATAL) << "No predict net specified. Use --predict_net=/path/to/net.";
    }
    caffe2::NetDef init_net, predict_net;
    CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_init_net, &init_net));
    CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_predict_net, &predict_net));
    auto predictor = caffe2::make_unique<Predictor>(init_net, predict_net);
    cv::Mat im = cv::imread("./cat.jpg");
    if (!im.data) {
        std::cout << "failed to read image" << std::endl;
        return;
    }
    cv::resize(im, im, cv::Size(224, 224));
    im.convertTo(im, CV_32FC3);
    cv::Mat mean = cv::Mat(im.size(), im.type(), cv::Scalar(104.00698793, 116.66876762, 122.67891434));
    im = im - mean;
    std::vector<int> input_shape{1, 3, 224, 224};
    TensorCPU input_tensor(input_shape);
    float *input_tensor_data = input_tensor.mutable_data<float>();
    std::vector<cv::Mat> bgr_channels;
    for (int c = 0; c < im.channels(); c++) {
        cv::Mat single_channel(im.size(), CV_32FC1, input_tensor_data);
        bgr_channels.push_back(single_channel);
        input_tensor_data += (im.rows * im.cols);
    }
    cv::split(im, bgr_channels);
    std::cout << "Checking that a null forward-pass works" << std::endl;

    Predictor::TensorVector inputVec, outputVec;
    inputVec.push_back(&input_tensor);

    double time_start = getTimeOfMSeconds();
    for (int i = 0; i < 10; i++) {
        predictor->run(inputVec, &outputVec);
    }
    double time_end = getTimeOfMSeconds();
    std::cout << "time used: " << time_end - time_start << std::endl;

    CAFFE_ENFORCE_GT(outputVec.size(), 0);

    TensorCPU *output = outputVec[0];
    cv::Mat pre(1, output->size(), CV_32FC1, output->mutable_data<float>());
    cv::Point max_idx;
    cv::minMaxLoc(pre, nullptr, nullptr, nullptr, &max_idx);
}

if there any simple guide for runing test process?

thanks to great caffe, I learnt a lot.
If Caffe2 has some simple guide for running a test process? I have installed and compiled it successfully, but cannot run it.
Even I cannot find the main function, can you give some help? or can i invite you to help me in zhihu?

Issues trying to run multibox without GPU support

This is the error that i am getting:

[E operator.cc:83] Output size 2 not in range [min=1, max=1].
[E operator.cc:86] Error at operator :MaxPool
[E net.cc:55] Failed to verify operator.
[E workspace.cc:60] Error when setting up network multibox
Traceback (most recent call last):
File "multibox.py", line 69, in
workspace.CreateNet(net)
File "/home/henrique/Documents/Projeto/caffe2/gen/pycaffe2/workspace.py", line 99, in CreateNet
return cc_CreateNet(StringfyProto(net))
RuntimeError: Cannot create network. See console log for error messages.

And here are the warnings when caffe2 is built:

WARNING: Not all dependencies have succeeded. Skipping build. Failed dependencies:
WARNING: ['//caffe2/core:core_gpu']
WARNING: Failed to build:
WARNING: //caffe2/binaries:inspect_gpus
WARNING: //caffe2/core:core_cudnn
WARNING: //caffe2/core:core_gpu
WARNING: //caffe2/core:core_gpu_test
WARNING: //caffe2/core:cuda_memorypool_test
WARNING: //caffe2/cuda_rtc:rtc_ops
WARNING: //caffe2/end_to_end_test:end_to_end_tests
WARNING: //caffe2/image:image_ops_gpu
WARNING: //caffe2/mpi:mpi_gpu_test
WARNING: //caffe2/mpi:mpi_ops_gpu
WARNING: //caffe2/operators:core_ops_cudnn
WARNING: //caffe2/operators:core_ops_gpu
WARNING: //caffe2/operators:core_ops_gpu_cu
WARNING: //caffe2/operators:core_ops_test
WARNING: //caffe2/sgd:sgd_ops_gpu
WARNING: //caffe2/utils:math_gpu
WARNING: //third_party/cnmem:cnmem

MPI build fails

In file included from /home/mhouston/caffe2/caffe2/mpi/mpi_ops.h:7:0,
from /home/mhouston/caffe2/caffe2/mpi/mpi_ops.cc:1:
/home/mhouston/caffe2/caffe2/mpi/mpi_ops.h: In instantiation of ‘bool caffe2::MPISendTensorOp::RunOnDevice() [with Context = caffe2::CPUContext]’:
/home/mhouston/caffe2/caffe2/mpi/mpi_ops.cc:27:1: required from here
/home/mhouston/caffe2/caffe2/mpi/mpi_ops.h:176:71: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive]
input.raw_data(), input.nbytes(), MPI_CHAR, dst_, tag_, comm));
^
/home/mhouston/caffe2/caffe2/mpi/mpi_common.h:37:18: note: in definition of macro ‘MPI_CHECK’
int error = (condition);
^
In file included from /home/mhouston/caffe2/caffe2/mpi/mpi_ops.h:4:0,
from /home/mhouston/caffe2/caffe2/mpi/mpi_ops.cc:1:
/usr/lib/openmpi/include/mpi.h:1384:20: error: initializing argument 1 of ‘int MPI_Send(void*, int, MPI_Datatype, int, int, MPI_Comm)’ [-fpermissive]
OMPI_DECLSPEC int MPI_Send(void *buf, int count, MPI_Datatype datatype, int dest,

Several issues with compiling Caffe2 on Mac OSX without GPU

Hi,
I have been trying to get Caffe 2 to work on Mac OSX without GPU/CUDA .

Here are the list of issues I have encountered.

The BREW files should have 'lopencv_imgcodecs'

I added following lines to register third party target and added "opencv_imgcoded" in each BREW file where opencv was used.

cc_thirdparty_target(
name="opencv_imgcodecs",
srcs=["BREW"],
commands=[],
cc_obj_files=["-lopencv_imgcodecs"],
)

This solved the linking issue and I was able to build.

After this even though I had specified non existing CUDA_DIR in build_env.py.
it did not detect and set following PYCAFFE2_CPU_ONLY correctly, resulting in cublas_2.h not found errors. I then went to caffe2_python.cc and manully commented out all portions that relied on #ifndef PYCAFFE2_CPU_ONLY.

With this I was able to build caffe2_python.cc .

Eventually all non GPU dependencies succeed except toy models.

[libprotobuf ERROR google/protobuf/descriptor_database.cc:57] File already exists in database: caffe/proto/caffe.proto
[libprotobuf FATAL google/protobuf/descriptor.cc:1018] CHECK failed: generated_database_->Add(encoded_file_descriptor, size):
libc++abi.dylib: terminating with uncaught exception of type google::protobuf::FatalException: CHECK failed: generated_database_->Add(encoded_file_descriptor, size):
Pycaffe+GPU is not available. Using CPU only version.
/bin/sh: line 1: 81061 Abort trap: 6 python generate_mnist_linear_classifier.py

This seems to be result of two copies of Protobuf being linked / mixed.

http://stackoverflow.com/questions/33017985/static-linking-with-generated-protobufs-causes-abort

I am now trying to edit BREW file to force it to use only the system protobuf.

osx install instructions fail

I can probably figure out why this didn't work, but the instructions don't work as stated.

-- The BLAS backend of choice:Eigen
-- Found gflags  (include: /usr/local/include, library: /usr/local/lib/libgflags.a)
-- Found system gflags install.
-- Could NOT find Glog (missing:  GLOG_INCLUDE_DIR GLOG_LIBRARY) 
CMake Warning at cmake/External/glog.cmake:13 (message):
  glog is not found.  Caffe2 will build without glog support but it is
  strongly recommended that you install glog.
Call Stack (most recent call first):
  cmake/Dependencies.cmake:59 (include)
  CMakeLists.txt:72 (include)


CMake Warning at cmake/Dependencies.cmake:65 (message):
  Not compiling with glog.  Suppress this warning with -DUSE_GLOG=OFF
Call Stack (most recent call first):
  CMakeLists.txt:72 (include)


CMake Error at cmake/Dependencies.cmake:85 (add_subdirectory):
  The source directory

    /Users/varung/caffe2/third_party/googletest

  does not contain a CMakeLists.txt file.
Call Stack (most recent call first):
  CMakeLists.txt:72 (include)


CMake Error at cmake/Dependencies.cmake:87 (add_subdirectory):
  The source directory

    /Users/varung/caffe2/third_party/benchmark

  does not contain a CMakeLists.txt file.
Call Stack (most recent call first):
  CMakeLists.txt:72 (include)


-- Found lmdb    (include: /usr/local/include, library: /usr/local/lib/liblmdb.so)
-- Found LevelDB (include: /usr/local/include, library: /usr/local/lib/libleveldb.dylib)
-- Found Snappy  (include: /usr/local/include, library: /usr/local/lib/libsnappy.dylib)
-- Could NOT find RocksDB (missing:  RocksDB_INCLUDE_DIR RocksDB_LIBRARIES) 
CMake Warning at cmake/Dependencies.cmake:126 (message):
  Not compiling with RocksDB.  Suppress this warning with -DUSE_ROCKSDB=OFF
Call Stack (most recent call first):
  CMakeLists.txt:72 (include)


CMake Warning at cmake/Dependencies.cmake:169 (message):
  Not compiling with OpenCV.  Suppress this warning with -DUSE_OPENCV=OFF
Call Stack (most recent call first):
  CMakeLists.txt:72 (include)


-- NumPy ver. 1.11.1 found (include: /Users/varung/anaconda/lib/python2.7/site-packages/numpy/core/include)
-- Could NOT find MPI_C (missing:  MPI_C_LIBRARIES MPI_C_INCLUDE_PATH) 
-- Could NOT find MPI_CXX (missing:  MPI_CXX_LIBRARIES MPI_CXX_INCLUDE_PATH) 
CMake Warning at cmake/Dependencies.cmake:221 (message):
  Not compiling with MPI.  Suppress this warning with -DUSE_MPI=OFF
Call Stack (most recent call first):
  CMakeLists.txt:72 (include)


-- Try OpenMP C flag = [-fopenmp=libomp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [ ]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [/openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-Qopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-xopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [+Oopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-qsmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-mp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-fopenmp=libomp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [ ]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [/openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-Qopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-xopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [+Oopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-qsmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-mp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Could NOT find OpenMP (missing:  OpenMP_C_FLAGS OpenMP_CXX_FLAGS) 
CMake Warning at cmake/Dependencies.cmake:235 (message):
  Not compiling with OpenMP.  Suppress this warning with -DUSE_OPENMP=OFF
Call Stack (most recent call first):
  CMakeLists.txt:72 (include)


CMake Warning at cmake/Dependencies.cmake:257 (message):
  Not compiling with CUDA.  Suppress this warning with -DUSE_CUDA=OFF
Call Stack (most recent call first):
  CMakeLists.txt:72 (include)


CMake Warning at cmake/Dependencies.cmake:265 (message):
  If not using cuda, one should not use NCCL either.
Call Stack (most recent call first):
  CMakeLists.txt:72 (include)


-- Need to define long as a separate typeid.
-- This compiler does not have builtin_cpu_supports feature.
-- Turning off deprecation warning due to glog.
-- NCCL operators built due to no CUDA support
-- CUDA RTC operators built due to no CUDA support
-- Excluding image processing operators due to no opencv
-- Excluding mkl operators as we are not using mkl
-- MPI operators skipped due to no MPI support
-- Automatically generating missing __init__.py files.
-- 
-- ******** Summary ********
-- General:
--   Version               : 
--   Git                   : 
--   System                : Darwin
--   C++ compiler          : /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
--   Protobuf compiler     : /usr/local/bin/protoc
--   CXX flags             :  -Wno-deprecated -std=c++11 -fPIC -Wno-narrowing
--   Build type            : Release
--   Compile definitions   : CAFFE2_USE_EIGEN_FOR_BLAS;CAFFE2_USE_GFLAGS;EIGEN_MPL2_ONLY;CAFFE2_UNIQUE_LONG_TYPEMETA;CAFFE2_NO_BUILTIN_CPU_SUPPORTS
-- 
--   BUILD_SHARED_LIBS     : ON
--   BUILD_PYTHON          : ON
--     Python version      : 2.7.12
--     Python library      : /Users/varung/anaconda/lib/libpython2.7.dylib
--   USE_CUDA              : OFF
--   USE_NERVANA_GPU       : OFF
--   USE_GLOG              : OFF
--   USE_GFLAGS            : ON
--     gflags version      : 
--   USE_LMDB              : ON
--     LMDB version        : 0.9.14
--   USE_LEVELDB           : ON
--     LevelDB version     : 1.18
--     Snappy version      : 1.1.3
--   USE_OPENCV            : OFF
--   USE_ZMQ               : OFF
--   USE_ROCKSDB           : OFF
--   USE_MPI               : OFF
--   USE_NCCL              : OFF
--   USE_NNPACK            : OFF
--   USE_OPENMP            : OFF
--   USE_REDIS             : OFF
-- Configuring incomplete, errors occurred!
See also "/Users/varung/caffe2/build/CMakeFiles/CMakeOutput.log".
See also "/Users/varung/caffe2/build/CMakeFiles/CMakeError.log".

caffe2_pybind11_state.so: undefined symbol: __cpu_model

I have compiled caffe2 with CUDA, or without CUDA successful, then use python to import caffe2.python.core, it appeared such error:

WARNING:root:This caffe2 python run does not have GPU support. Will run in CPU only mode.
WARNING:root:Debug message: No module named caffe2_pybind11_state_gpu
CRITICAL:root:Cannot load caffe2.python. Error: caffe2/python/caffe2_pybind11_state.so: undefined symbol: __cpu_model

Can you help about training image data?

I am studying about caffe.
Recently, I found out your caffe2.

I want to train and classify easily.

Can you explain simple train step?

I guess inception_tensors.pb in inception are data file.

Thanks
Marx HA

[discussion] Cross device memory pool

In my recent diff d4fea53 I tried to fix the memory pool implementation for multiple devices. It seems to be quite inefficient that we need to explicitly maintain a map from memory to device id.

IMHO the device pool provided in cub and cnmem should handle this instead of the framework - @slayton58 @thatguymike @pooyadavoodi do you guys have recommendation on how to properly deal with this? Or is the current implementation good enough?

Thanks so much guys.

Compiling errors

In file included from /caffe2/gen/caffe2/proto/caffe2.pb.cc:5:
caffe2/gen/caffe2/proto/caffe2.pb.h:9:10: fatal error: 'google/protobuf/stubs/common.h' file not found
#include <google/protobuf/stubs/common.h>
         ^
1 error generated.

'file not found' why not, it's on our system.

Also still getting #39
nvcc fatal : Unsupported gpu architecture 'compute_61'

undefined reference to cv::imdecode error on make

Summary

getting bunch of the following error as a result of make

"...undefined reference to cv::imdecode..."

Command to reproduce the error

$ make
...
caffe2/gen/caffe2/image/image_input_op.h:109: undefined reference to 'cv::imdecode(cv::_InputArray const&, int)'
caffe2/gen/caffe2/image/image_input_op.h:150: undefined reference to 'cv::imdecode(cv::_InputArray const&, int)'
caffe2/caffe2/binaries/convert_encoded_to_raw_leveldb.cc:94: undefined reference to 'cv::imdecode(cv::_InputArray const&, int)'
, cv::Mat*, int*)'

Note

I had added the following to third_party/opencv/BREW before make

cc_thirdparty_target(
  name="opencv_imgcodecs",
  srcs=["BREW"],
  commands=[],
  cc_obj_files=["-lopencv_imgcodecs"],
)

OS

Ubuntu 15.04 (64)

OpenCV

pkg-config --modversion opencv
3.0.0

redundant letter "c" in caffe2/core/loggin_is_google_glog.h Line 20

A small mistake in caffe2/core/loggin_is_google_glog.h Line 20.

Two more suggestions:

  1. Maybe it is better to control log level of GLOG using the same flag caffe2_log_level. And FLAG_alsologtostderr is better to be 1 by default.
  2. caffe2_log_level is unnecessary declared in caffe2/core/loggin_is_not_google_glog.h

Tensorflow

Do you think that you will go ahead with this after tensorflow release?

Compatibility with old Caffe

Hi @Yangqing ,
Are you planning to add Caffe2 -> Caffe translator which allows us to convert Caffe2 description & snapshots to old Caffe .prototxt & .caffemodel?

Compiling Caffe2 on a Mac OS X 10.10.5: Caffe symbols not found for architecture x84_64 (types.cc)

Hello, I am trying to compile Caffe 2 on mac mini 64 bits (2.6 GHz Intel Core i5) running OS-X 10.10.5. So CPU only with no GPU. I think I have installed all the dependencies excluding CUDA. I have changed in build.py the optimization flag to -O2 as -O2+ was causing me problems. Along the compilation process, the first error of the kind described in the title (symbols not found) is the one reported below. What am i doing wrong? Thanks very much

LOG: Building //caffe2:core_test
WARNING: Build failed: //caffe2:core_test. Fail messages are as follows:

clang: warning: argument unused during compilation: '-pie'
clang: warning: argument unused during compilation: '-pthread'
Undefined symbols for architecture x86_64:
"long caffe2::TypeMeta::Id<std::__1::vector<unsigned long, std::__1::allocator > >()", referenced from:
std::__1::vector<unsigned long, std::__1::allocator >* caffe2::Blob::GetMutable<std::__1::vector<unsigned long, std::__1::allocator > >(bool*) in libcore_test.a(parallel_net_test.o)
"long caffe2::TypeMeta::Id()", referenced from:
bool caffe2::DispatchHelper<caffe2::TensorTypes<double, int, long, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > >::call<caffe2::FindDuplicateElementsOpcaffe2::CPUContext >(caffe2::FindDuplicateElementsOpcaffe2::CPUContext, caffe2::TypeMeta const&) in libcore_ops.a(find_duplicate_elements_op.o)
long const
caffe2::Tensorcaffe2::CPUContext::data() const in libcore_ops.a(find_duplicate_elements_op.o)
bool caffe2::DispatchHelper<caffe2::TensorTypes<float, double, int, long> >::call<caffe2::UnaryElementwiseWithArgsOp<caffe2::TensorTypes<float, double, int, long>, caffe2::CPUContext, caffe2::WithDefaultConstructorcaffe2::NegativeCPUFunctor, caffe2::SameTypeAsInput> >(caffe2::UnaryElementwiseWithArgsOp<caffe2::TensorTypes<float, double, int, long>, caffe2::CPUContext, caffe2::WithDefaultConstructorcaffe2::NegativeCPUFunctor, caffe2::SameTypeAsInput>, caffe2::TypeMeta const&) in libcore_ops.a(negative_op.o)
bool caffe2::UnaryElementwiseWithArgsOp<caffe2::TensorTypes<float, double, int, long>, caffe2::CPUContext, caffe2::WithDefaultConstructorcaffe2::NegativeCPUFunctor, caffe2::SameTypeAsInput>::DoRunWithType() in libcore_ops.a(negative_op.o)
long const
caffe2::Tensorcaffe2::CPUContext::data() const in libcore_ops.a(negative_op.o)
caffe2::(anonymous namespace)::PackSegmentsOpcaffe2::CPUContext::RunOnDevice() in libcore_ops.a(pack_segments.o)
caffe2::(anonymous namespace)::UnpackSegmentsOpcaffe2::CPUContext::RunOnDevice() in libcore_ops.a(pack_segments.o)
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

and then also:

LOG: Building //caffe2:caffe2_core
WARNING: Build failed: //caffe2:caffe2_core. Fail messages are as follows:

clang: warning: argument unused during compilation: '-pthread'
Undefined symbols for architecture x86_64:
"long caffe2::TypeMeta::Id()", referenced from:
bool caffe2::DispatchHelper<caffe2::TensorTypes<double, int, long, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > >::call<caffe2::FindDuplicateElementsOpcaffe2::CPUContext >(caffe2::FindDuplicateElementsOpcaffe2::CPUContext, caffe2::TypeMeta const&) in libcore_ops.a(find_duplicate_elements_op.o)
long const
caffe2::Tensorcaffe2::CPUContext::data() const in libcore_ops.a(find_duplicate_elements_op.o)
bool caffe2::DispatchHelper<caffe2::TensorTypes<float, double, int, long> >::call<caffe2::UnaryElementwiseWithArgsOp<caffe2::TensorTypes<float, double, int, long>, caffe2::CPUContext, caffe2::WithDefaultConstructorcaffe2::NegativeCPUFunctor, caffe2::SameTypeAsInput> >(caffe2::UnaryElementwiseWithArgsOp<caffe2::TensorTypes<float, double, int, long>, caffe2::CPUContext, caffe2::WithDefaultConstructorcaffe2::NegativeCPUFunctor, caffe2::SameTypeAsInput>, caffe2::TypeMeta const&) in libcore_ops.a(negative_op.o)
bool caffe2::UnaryElementwiseWithArgsOp<caffe2::TensorTypes<float, double, int, long>, caffe2::CPUContext, caffe2::WithDefaultConstructorcaffe2::NegativeCPUFunctor, caffe2::SameTypeAsInput>::DoRunWithType() in libcore_ops.a(negative_op.o)
long const
caffe2::Tensorcaffe2::CPUContext::data() const in libcore_ops.a(negative_op.o)
caffe2::(anonymous namespace)::PackSegmentsOpcaffe2::CPUContext::RunOnDevice() in libcore_ops.a(pack_segments.o)
caffe2::(anonymous namespace)::UnpackSegmentsOpcaffe2::CPUContext::RunOnDevice() in libcore_ops.a(pack_segments.o)
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Visual editor?

I read the caffe2 source code and the "Improving Caffe: Some Refactoring" slides and was thinking that a visual model editor would be nice. The new operator/tensor separation reminds me of PureData, a dataflow programming language for digital audio signal processing, or the Blender Nodes interface, for 3D shader programming. I saw someone has hacked a caffe1 editor into the Blender Nodes interface here: caffe-gui-tool and I have read through this caffe1 issue "GUI version of tools?": BVLC/caffe#481

I went ahead and mocked up what the initialization and forward propagation phases of the caffe2 mnist model might look like in PureData (a task that would require adding tensor datatypes), though I did not finish any gradient or training ops:
example_mnist

Notably, PureData requires inputs to propagate from the top of the page to the bottom, which contradicts the standard depiction of neural networks processing data from the bottom up.

I think a visual editor might broaden the audience that can toy with these powerful models and encourage novel extensions.

Listing all layers

Is there a possibility of easily listing all layers and their settings? Maybe to a protobuf? If not, any ideas how I would go about most robustly implementing this?

Failure during installing Caffe2 on macOS

Hey there!

I faced some problems while installing Caffe2 on macOS. I'd be grateful if you could help me to resolve them.

The compilation asserts in the very beginning with the following error:

[  1%] Performing build step for 'nccl_external'
ls: /usr/local/cuda/lib64/libcudart.so.*: No such file or directory
ls: /usr/local/cuda/lib64/libcudart.so.*: No such file or directory
ls: /usr/local/cuda/lib64/libcudart.so.*: No such file or directory
ls: /usr/local/cuda/lib64/libcudart.so.*: No such file or directory
Compiling src/core.cu                         > /Users/kostya_by/Programming/aimatter/caffe2/third_party/nccl/build/obj/core.o
src/core.cu(717): error: expected an expression

src/core.cu(717): error: expected an expression

2 errors detected in the compilation of "/var/folders/n6/s4c7zx0s5f3fflgh_dl7qtc80000gn/T//tmpxft_000022bd_00000000-11_core.compute_52.cpp1.ii".
make[3]: *** [/Users/kostya_by/Programming/aimatter/caffe2/third_party/nccl/build/obj/core.o] Error 2
make[2]: *** [nccl_external-prefix/src/nccl_external-stamp/nccl_external-build] Error 2
make[1]: *** [CMakeFiles/nccl_external.dir/all] Error 2
make: *** [all] Error 2

I checked my /usr/local/cuda directory. There is no lib64 subdirectory there, only lib. And there is no entity matching the libcudart.so.* pattern, only libcudart.8.0.dylib, libcudart.dylib and libcudart_static.a.

I have the following software installed on my Mac:

macOS version: 10.12.3
CUDA driver version: 8.0.53

Thanks!

compatibility with ubuntu 16.04

gcc after 5.0 is not supported by CUDA 7.5. Some confusing problems may occur.

  1. std::vector X(1, 1); // fail to compile
    std::vector X(1, double(1)); // succeed
  2. CHECK_EQ(vector, vector); // fail to compile
    CHECK(vector<int == vector); // succeed

numerical stability in consecutive matrix multiplication

Hi Yangqing
When i was implementing a forward-backward algorithm with consecutive matrix multiplication, i found that the utility functions in math_function.cpp may suffer a numerical stability problem in this case ,especially when the number of matrix increases. So i am working on implementing a "log version" of the element-wise and matrix-matrix multiplication in which situation the element of matrix is treated as a logProb and the vector dot operation is therefore transferred to "LogOfSumExponential" process with max-subtraction trick involved. Would you mind giving me some advice for doing that? Can i just take advantage of some basic cblas functions just like those already in math_function.cpp? Or will i have to suffer a severe efficiency loss if i just do it naively element by element ?

Many thanks in advance !!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.