#
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import sys
from bigdl.nn.layer import Layer

if sys.version >= '3':
    long = int
    unicode = str


class Shape(Layer):
    """
    A layer which takes a tensor as input and outputs an 1D tensor containing the shape of the input.

    >>> shape = Shape()
    creating: createShape
    """
    def __init__(self, bigdl_type="float"):
        super(Shape, self).__init__(None, bigdl_type)

@@ -591,16 +591,35 @@
 ort sys%0A
+import numpy as np%0A
 from big
@@ -642,16 +642,54 @@
 rt Layer
+%0Afrom bigdl.util.common import JTensor
 %0A%0Aif sys
@@ -740,16 +740,1074 @@
 = str%0A%0A%0A
+%0Aclass Gemm(Layer):%0A    %22%22%22%0A    General Matrix multiplication: https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms#Level_3%0A%0A    A' = transpose(A) if transA else A%0A    B' = transpose(B) if transB else B%0A%0A    Compute Y = alpha * A' * B' + beta * C, where input tensor A has shape (M, K) or (K, M),%0A    input tensor B has shape (K, N) or (N, K), input tensor C is broadcastable to shape (M, N),%0A    and output tensor Y has shape (M, N). A will be transposed before doing the computation if%0A    attribute transA is non-zero, same for B and transB.%0A%0A    %3E%3E%3E matrix_b = np.random.random(%5B2, 2%5D)%0A    %3E%3E%3E matrix_c = np.random.random(%5B2, 2%5D)%0A    %3E%3E%3E gemm = Gemm(matrix_b=matrix_b, matrix_c=matrix_c)%0A    creating: createGemm%0A    %22%22%22%0A    def __init__(self, matrix_b, matrix_c, alpha=float(1.0), beta=float(1.0), trans_a=0, trans_b=0,%0A                 bigdl_type=%22float%22):%0A        super(Gemm, self).__init__(None, bigdl_type, alpha, beta, trans_a, trans_b,%0A                                   JTensor.from_ndarray(matrix_b), JTensor.from_ndarray(matrix_c))%0A%0A%0A
 class Sh
@@ -2023,32 +2023,32 @@
 _type=%22float%22):%0A
-
         super(Sh
@@ -2085,8 +2085,9 @@
 l_type)%0A
+%0A

Add Onnx Supported Layers (#2902)