0

After I set the backend of Keras to CNTK on Google Colab, getting the following warning and error despite I do not get any issues when I use TensorFlow or Theano as the backend of Keras:

/usr/local/lib/python3.6/dist-packages/cntk/cntk_py_init.py:56: UserWarning: Unsupported Linux distribution (ubuntu-18.04). CNTK supports Ubuntu 16.04 and above, only.
  warnings.warn('Unsupported Linux distribution (%s-%s). CNTK supports Ubuntu 16.04 and above, only.' % (__my_distro__, __my_distro_ver__))
/usr/local/lib/python3.6/dist-packages/keras/backend/cntk_backend.py:26: UserWarning: CNTK backend warning: GPU is not detected. CNTK's CPU version is not fully optimized,please run with GPU to get better performance.
  'CNTK backend warning: GPU is not detected. '
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-1-3c177e7557ce> in <module>()
     85 
     86 if __name__ == '__main__':
---> 87     main()

8 frames
/usr/local/lib/python3.6/dist-packages/cntk/ops/__init__.py in convolution(convolution_map, operand, strides, sharing, auto_padding, sequential, dilation, reduction_rank, groups, max_temp_mem_size_in_samples, name)
    419     dilation = sanitize_shape(dilation)
    420     return convolution(convolution_map, operand, strides, sharing, auto_padding, dilation,
--> 421                        reduction_rank, groups, max_temp_mem_size_in_samples, sequential, name)
    422 
    423 @typemap

ValueError: Convolution operation requires that kernel dim 3 <= input dim 2.

[CALL STACK]
[0x7efc8f367d99]                                                       + 0x67bd99
[0x7efc8f508c65]    Microsoft::MSR::CNTK::ConvolveGeometry::  ComputeOutputShape  (Microsoft::MSR::CNTK::TensorShape const&,  Microsoft::MSR::CNTK::TensorShape const&,  Microsoft::MSR::CNTK::TensorShape const&,  Microsoft::MSR::CNTK::TensorShape const&,  std::vector<bool,std::allocator<bool>> const&,  std::vector<bool,std::allocator<bool>> const&,  Microsoft::MSR::CNTK::TensorShape const&,  Microsoft::MSR::CNTK::TensorShape const&,  Microsoft::MSR::CNTK::TensorShape const&,  unsigned long,  bool,  bool,  bool) + 0x795
[0x7efc8f4f7ad0]    CNTK::PrimitiveFunction::  ConvolutionOpOutputShape  (CNTK::PrimitiveOpType,  CNTK::NDShape const&,  CNTK::NDShape&,  CNTK::NDShape&,  CNTK::NDShape&,  std::vector<bool,std::allocator<bool>>&,  std::vector<bool,std::allocator<bool>>&,  CNTK::NDShape&,  CNTK::NDShape&,  bool,  bool,  CNTK::NDShape&,  unsigned long,  bool) + 0x1d0
[0x7efc8f5002bd]    CNTK::PrimitiveFunction::  InferOutputs  (std::vector<CNTK::Variable,std::allocator<CNTK::Variable>>&) + 0x22bd
[0x7efc8f4aaca4]                                                       + 0x7beca4
[0x7efcf5c62827]                                                       + 0xf827
[0x7efc8f4a70be]    CNTK::Function::  InitOutputs  ()                  + 0x6e
[0x7efc8f54b63d]    CNTK::CompositeFunction::  InferOutputs  (std::vector<CNTK::Variable,std::allocator<CNTK::Variable>>&) + 0xd
[0x7efc8f4aaca4]                                                       + 0x7beca4
[0x7efcf5c62827]                                                       + 0xf827
[0x7efc8f4a70be]    CNTK::Function::  InitOutputs  ()                  + 0x6e
[0x7efc8f4aef0f]    CNTK::  AsComposite  (std::shared_ptr<CNTK::Function> const&,  std::__cxx11::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>> const&) + 0x58f
[0x7efc8f4be732]    CNTK::  BinaryOp  (CNTK::PrimitiveOpType,  CNTK::Variable const&,  CNTK::Variable const&,  CNTK::Dictionary&&,  std::__cxx11::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>> const&,  bool) + 0xf2
[0x7efc8f4d1396]    CNTK::Internal::  Convolution  (CNTK::Variable const&,  CNTK::Variable const&,  CNTK::NDShape const&,  std::vector<bool,std::allocator<bool>> const&,  std::vector<bool,std::allocator<bool>> const&,  CNTK::NDShape const&,  bool,  CNTK::NDShape const&,  unsigned long,  unsigned long,  std::__cxx11::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>> const&) + 0xd6
[0x7efc8f4d2e0e]    CNTK::  Convolution  (CNTK::Variable const&,  CNTK::Variable const&,  CNTK::NDShape const&,  std::vector<bool,std::allocator<bool>> const&,  std::vector<bool,std::allocator<bool>> const&,  CNTK::NDShape const&,  unsigned long,  unsigned long,  unsigned long,  bool,  std::__cxx11::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>> const&) + 0x23e
[0x7efc9046fb68]                                                       + 0x2bab68
[0x50a2bf]                                                            
[0x50bfb4]          _PyEval_EvalFrameDefault                           + 0x444
[0x507d64]                                                            
[0x588e5c]                                                            
[0x59fc4e]          PyObject_Call                                      + 0x3e
[0x50d356]          _PyEval_EvalFrameDefault                           + 0x17e6
[0x507d64]                                                            
[0x509a90]                                                            
[0x50a48d]                                                            
[0x50cd96]          _PyEval_EvalFrameDefault                           + 0x1226
[0x507d64]                                                            
[0x509a90]                                                            
[0x50a48d]                                                            
[0x50cd96]          _PyEval_EvalFrameDefault                           + 0x1226
[0x508e55]          _PyFunction_FastCallDict                           + 0xf5
[0x594931]                                                            
[0x59fc4e]          PyObject_Call                                      + 0x3e
[0x50d356]          _PyEval_EvalFrameDefault                           + 0x17e6
[0x507d64]                                                            
[0x509042]          _PyFunction_FastCallDict                           + 0x2e2
[0x594931]                                                            
[0x54a941]                                                            
[0x5a9cbc]          _PyObject_FastCallKeywords                         + 0x19c
[0x50a5c3]                                                            
[0x50bfb4]          _PyEval_EvalFrameDefault                           + 0x444
[0x507d64]                                                            
[0x588e5c]                                                            
[0x59fc4e]          PyObject_Call                                      + 0x3e
[0x50d356]          _PyEval_EvalFrameDefault                           + 0x17e6
[0x507d64]                                                            
[0x588e5c]                                                            
[0x59fc4e]          PyObject_Call                                      + 0x3e
[0x50d356]          _PyEval_EvalFrameDefault                           + 0x17e6
[0x507d64]                                                            
[0x509a90]                                                            
[0x50a48d]                                                            
[0x50cd96]          _PyEval_EvalFrameDefault                           + 0x1226
[0x509758]                                                            
[0x50a48d]                                                            
[0x50bfb4]          _PyEval_EvalFrameDefault                           + 0x444
[0x507d64]                                                            
[0x516345]                                                            
[0x50a2bf]                                                            
[0x50bfb4]          _PyEval_EvalFrameDefault                           + 0x444
[0x507d64]                                                            
[0x509a90]                                                            
[0x50a48d]                                                            
[0x50bfb4]          _PyEval_EvalFrameDefault                           + 0x444
[0x507d64]                                                            
[0x509a90]                                                            
[0x50a48d]                                                            
[0x50cd96]          _PyEval_EvalFrameDefault                           + 0x1226
[0x507d64]                                                            
[0x509042]          _PyFunction_FastCallDict                           + 0x2e2
[0x594931]                                                            
[0x59fc4e]          PyObject_Call                                      + 0x3e
[0x50d356]          _PyEval_EvalFrameDefault                           + 0x17e6
[0x507d64]                                                            
[0x509a90]                                                            
[0x50a48d]                                                            
[0x50cd96]          _PyEval_EvalFrameDefault                           + 0x1226
[0x507d64]                                                            
[0x509a90]                                                            
[0x50a48d]                                                            
[0x50bfb4]          _PyEval_EvalFrameDefault                           + 0x444
[0x509758]                                                            
[0x50a48d]                                                            
[0x50bfb4]          _PyEval_EvalFrameDefault                           + 0x444
[0x509758]                                                            
[0x50a48d]                                                            
[0x50bfb4]          _PyEval_EvalFrameDefault                           + 0x444
[0x507d64]                                                            
[0x588d41]                                                            
[0x59fc4e]          PyObject_Call                                      + 0x3e
[0x50d356]          _PyEval_EvalFrameDefault                           + 0x17e6
[0x507d64]                                                            
[0x588d41]                                                            
[0x59fc4e]          PyObject_Call                                      + 0x3e
[0x50d356]          _PyEval_EvalFrameDefault                           + 0x17e6
[0x507d64]                                                            
[0x509a90]                                                            
[0x50a48d]                                                            
[0x50bfb4]          _PyEval_EvalFrameDefault                           + 0x444
[0x509758]                                                            
[0x50a48d]                                                            
[0x50bfb4]          _PyEval_EvalFrameDefault                           + 0x444
[0x508e55]          _PyFunction_FastCallDict                           + 0xf5
[0x594931]                                                            
[0x59fc4e]          PyObject_Call                                      + 0x3e
[0x50d356]          _PyEval_EvalFrameDefault                           + 0x17e6
[0x507d64]                                                            
[0x509a90]                                                            
[0x50a48d]                                                            
[0x50bfb4]          _PyEval_EvalFrameDefault                           + 0x444
[0x509758]                                                            
[0x50a48d]                                                            
[0x50bfb4]          _PyEval_EvalFrameDefault                           + 0x444
[0x509758]                                                            
[0x50a48d]                                                            
[0x50bfb4]          _PyEval_EvalFrameDefault                           + 0x444
[0x507d64]                                                            
[0x509a90]                                                            
[0x50a48d]                                                            
[0x50bfb4]          _PyEval_EvalFrameDefault                           + 0x444
[0x507d64]                                                            
[0x516345]                                                            
[0x50a2bf]                                                            
[0x50bfb4]          _PyEval_EvalFrameDefault                           + 0x444
[0x507d64]                                                            
[0x509a90]                                                            
[0x50a48d]                                                            
[0x50bfb4]          _PyEval_EvalFrameDefault                           + 0x444
[0x507d64]                                                            
[0x588dcd]                                                            
[0x59fc4e]          PyObject_Call                                      + 0x3e
[0x63828b]                                                            
[0x638f5f]          Py_Main                                            + 0x45f
[0x4b0d00]          main                                               + 0xe0
[0x7efcf5e93b97]    __libc_start_main                                  + 0xe7
[0x5b250a]          _start                                             + 0x2a

p.s. Software Stack:

  • Keras version: 2.3.1.
  • Python version: 3.6.9.

p.s. I'm able to use CNTK package (e.g., import cntk) as I've followed the answer provided in a similar question.

talha06
  • 6,206
  • 21
  • 92
  • 147
  • As state in the error `ValueError: Convolution operation requires that kernel dim 3 <= input dim 2.` your convolution filter size (3 x 3) is larger than its input. – snowflake Jul 09 '20 at 13:24
  • But since I'm using `Keras`, shouldn't it be handled by `Keras`? Do I need to change any lines of code to use `CNTK` as the backend of `Keras`? – talha06 Jul 09 '20 at 14:42
  • In theory it should have been handled by `Keras`, but in this is case it seems not like the case. There might be some padding keyword argument that you should set to `True` to solve this. Usually after convolution, there might be some lost in spatial dimensions. – snowflake Jul 09 '20 at 15:21
  • @talha06 May I ask why do you want to use CNTK? It's in a maintenance mode, "no plans for new feature development". – Sergii Dymchenko Jul 28 '20 at 18:14
  • Thanks for your contribution @SergiiDymchenko, it was for research-purposes. – talha06 Jul 28 '20 at 22:22

0 Answers0