from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import unittest

from hypothesis import given
import numpy as np

from caffe2.proto import caffe2_pb2
from caffe2.python import core, workspace
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.serialized_test.serialized_test_util as serial


# TODO(jiayq): make them hypothesis tests for better coverage.
class TestElementwiseBroadcast(serial.SerializedTestCase):
    @given(**hu.gcs)
    def test_broadcast_Add(self, gc, dc):
        # Set broadcast and no axis, i.e. broadcasting last dimensions.
        X = np.random.rand(2, 3, 4, 5).astype(np.float32)
        Y = np.random.rand(4, 5).astype(np.float32)
        op = core.CreateOperator("Add", ["X", "Y"], "out", broadcast=1)
        workspace.FeedBlob("X", X)
        workspace.FeedBlob("Y", Y)
        workspace.RunOperatorOnce(op)
        out = workspace.FetchBlob("out")
        np.testing.assert_array_almost_equal(out, X + Y)
        self.assertDeviceChecks(dc, op, [X, Y], [0])
        self.assertGradientChecks(gc, op, [X, Y], 1, [0])

        # broadcasting intermediate dimensions
        X = np.random.rand(2, 3, 4, 5).astype(np.float32)
        Y = np.random.rand(3, 4).astype(np.float32)
        op = core.CreateOperator("Add", ["X", "Y"], "out", broadcast=1, axis=1)
        workspace.FeedBlob("X", X)
        workspace.FeedBlob("Y", Y)
        workspace.RunOperatorOnce(op)
        out = workspace.FetchBlob("out")
        np.testing.assert_array_almost_equal(out, X + Y[:, :, np.newaxis])
        self.assertDeviceChecks(dc, op, [X, Y], [0])
        self.assertGradientChecks(gc, op, [X, Y], 1, [0])

        # broadcasting the first dimension
        X = np.random.rand(2, 3, 4, 5).astype(np.float32)
        Y = np.random.rand(2).astype(np.float32)
        op = core.CreateOperator("Add", ["X", "Y"], "out", broadcast=1, axis=0)
        workspace.FeedBlob("X", X)
        workspace.FeedBlob("Y", Y)
        workspace.RunOperatorOnce(op)
        out = workspace.FetchBlob("out")
        np.testing.assert_array_almost_equal(
            out, X + Y[:, np.newaxis, np.newaxis, np.newaxis])
        self.assertDeviceChecks(dc, op, [X, Y], [0])
        self.assertGradientChecks(gc, op, [X, Y], 1, [0])

        # broadcasting with single elem dimensions at both ends
        X = np.random.rand(2, 3, 4, 5).astype(np.float32)
        Y = np.random.rand(1, 4, 1).astype(np.float32)
        op = core.CreateOperator("Add", ["X", "Y"], "out", broadcast=1, axis=1)
        workspace.FeedBlob("X", X)
        workspace.FeedBlob("Y", Y)
        workspace.RunOperatorOnce(op)
        out = workspace.FetchBlob("out")
        np.testing.assert_array_almost_equal(out, X + Y)
        self.assertDeviceChecks(dc, op, [X, Y], [0])
        self.assertGradientChecks(gc, op, [X, Y], 1, [0])

    @given(**hu.gcs)
    def test_broadcast_Mul(self, gc, dc):
        # Set broadcast and no axis, i.e. broadcasting last dimensions.
        X = np.random.rand(2, 3, 4, 5).astype(np.float32)
        Y = np.random.rand(4, 5).astype(np.float32)
        op = core.CreateOperator("Mul", ["X", "Y"], "out", broadcast=1)
        workspace.FeedBlob("X", X)
        workspace.FeedBlob("Y", Y)
        workspace.RunOperatorOnce(op)
        out = workspace.FetchBlob("out")
        np.testing.assert_array_almost_equal(out, X * Y)
        self.assertDeviceChecks(dc, op, [X, Y], [0])
        self.assertGradientChecks(gc, op, [X, Y], 1, [0])

        # broadcasting intermediate dimensions
        X = np.random.rand(2, 3, 4, 5).astype(np.float32)
        Y = np.random.rand(3, 4).astype(np.float32)
        op = core.CreateOperator("Mul", ["X", "Y"], "out", broadcast=1, axis=1)
        workspace.FeedBlob("X", X)
        workspace.FeedBlob("Y", Y)
        workspace.RunOperatorOnce(op)
        out = workspace.FetchBlob("out")
        np.testing.assert_array_almost_equal(out, X * Y[:, :, np.newaxis])
        self.assertGradientChecks(gc, op, [X, Y], 1, [0])
        self.assertDeviceChecks(dc, op, [X, Y], [0])

        # broadcasting the first dimension
        X = np.random.rand(2, 3, 4, 5).astype(np.float32)
        Y = np.random.rand(2).astype(np.float32)
        op = core.CreateOperator("Mul", ["X", "Y"], "out", broadcast=1, axis=0)
        workspace.FeedBlob("X", X)
        workspace.FeedBlob("Y", Y)
        workspace.RunOperatorOnce(op)
        out = workspace.FetchBlob("out")
        np.testing.assert_array_almost_equal(
            out, X * Y[:, np.newaxis, np.newaxis, np.newaxis])
        self.assertGradientChecks(gc, op, [X, Y], 1, [0])
        self.assertDeviceChecks(dc, op, [X, Y], [0])

        # broadcasting with single elem dimensions at both ends
        X = np.random.rand(2, 3, 4, 5).astype(np.float32)
        Y = np.random.rand(1, 4, 1).astype(np.float32)
        op = core.CreateOperator("Mul", ["X", "Y"], "out", broadcast=1, axis=1)
        workspace.FeedBlob("X", X)
        workspace.FeedBlob("Y", Y)
        workspace.RunOperatorOnce(op)
        out = workspace.FetchBlob("out")
        np.testing.assert_array_almost_equal(out, X * Y)
        self.assertDeviceChecks(dc, op, [X, Y], [0])
        self.assertGradientChecks(gc, op, [X, Y], 1, [0])

    @given(**hu.gcs)
    def test_broadcast_Sub(self, gc, dc):
        # Set broadcast and no axis, i.e. broadcasting last dimensions.
        X = np.random.rand(2, 3, 4, 5).astype(np.float32)
        Y = np.random.rand(4, 5).astype(np.float32)
        op = core.CreateOperator("Sub", ["X", "Y"], "out", broadcast=1)
        workspace.FeedBlob("X", X)
        workspace.FeedBlob("Y", Y)
        workspace.RunOperatorOnce(op)
        out = workspace.FetchBlob("out")
        np.testing.assert_array_almost_equal(out, X - Y)
        self.assertDeviceChecks(dc, op, [X, Y], [0])
        self.assertGradientChecks(gc, op, [X, Y], 1, [0])

        # broadcasting intermediate dimensions
        X = np.random.rand(2, 3, 4, 5).astype(np.float32)
        Y = np.random.rand(3, 4).astype(np.float32)
        op = core.CreateOperator("Sub", ["X", "Y"], "out", broadcast=1, axis=1)
        workspace.FeedBlob("X", X)
        workspace.FeedBlob("Y", Y)
        workspace.RunOperatorOnce(op)
        out = workspace.FetchBlob("out")
        np.testing.assert_array_almost_equal(out, X - Y[:, :, np.newaxis])
        self.assertGradientChecks(gc, op, [X, Y], 1, [0])
        self.assertDeviceChecks(dc, op, [X, Y], [0])

        # broadcasting the first dimension
        X = np.random.rand(2, 3, 4, 5).astype(np.float32)
        Y = np.random.rand(2).astype(np.float32)
        op = core.CreateOperator("Sub", ["X", "Y"], "out", broadcast=1, axis=0)
        workspace.FeedBlob("X", X)
        workspace.FeedBlob("Y", Y)
        workspace.RunOperatorOnce(op)
        out = workspace.FetchBlob("out")
        np.testing.assert_array_almost_equal(
            out, X - Y[:, np.newaxis, np.newaxis, np.newaxis])
        self.assertGradientChecks(gc, op, [X, Y], 1, [0])
        self.assertDeviceChecks(dc, op, [X, Y], [0])

        # broadcasting with single elem dimensions at both ends
        X = np.random.rand(2, 3, 4, 5).astype(np.float32)
        Y = np.random.rand(1, 4, 1).astype(np.float32)
        op = core.CreateOperator("Sub", ["X", "Y"], "out", broadcast=1, axis=1)
        workspace.FeedBlob("X", X)
        workspace.FeedBlob("Y", Y)
        workspace.RunOperatorOnce(op)
        out = workspace.FetchBlob("out")
        np.testing.assert_array_almost_equal(out, X - Y)
        self.assertDeviceChecks(dc, op, [X, Y], [0])
        self.assertGradientChecks(gc, op, [X, Y], 1, [0])

    @serial.given(**hu.gcs)
    def test_broadcast_powt(self, gc, dc):
        np.random.seed(101)

        #operator
        def powt_op(X, Y):
            return [np.power(X, Y)]

        #two gradients Y*X^(Y-1) and X^Y * ln(X)
        def powt_grad(g_out, outputs, fwd_inputs):
            [X, Y] = fwd_inputs
            Z = outputs[0]
            return ([Y * np.power(X, Y - 1), Z * np.log(X)] * g_out)

        #1. Set broadcast and no axis, i.e. broadcasting last dimensions.
        X = np.random.rand(2, 3, 4, 5).astype(np.float32) + 1.0
        Y = np.random.rand(4, 5).astype(np.float32) + 2.0

        #two gradients Y*X^(Y-1) and X^Y * ln(X)
        #latter gradient is sumed over 1 and 0 dims to account for broadcast
        def powt_grad_broadcast(g_out, outputs, fwd_inputs):
            [GX, GY] = powt_grad(g_out, outputs, fwd_inputs)
            return ([GX, np.sum(np.sum(GY, 1), 0)])

        op = core.CreateOperator("Pow", ["X", "Y"], "Z", broadcast=1)
        self.assertReferenceChecks(device_option=gc,
                                   op=op,
                                   inputs=[X, Y],
                                   reference=powt_op,
                                   output_to_grad="Z",
                                   grad_reference=powt_grad_broadcast)

        #2. broadcasting intermediate dimensions
        X = np.random.rand(2, 3, 4, 5).astype(np.float32) + 1.0
        Y = np.random.rand(3, 4).astype(np.float32) + 2.0

        #pow op with the latter array increased by one dim
        def powt_op_axis1(X, Y):
            return powt_op(X, Y[:, :, np.newaxis])

        #two gradients Y*X^(Y-1) and X^Y * ln(X)
        #latter gradient is sumed over 3 and 0 dims to account for broadcast
        def powt_grad_axis1(g_out, outputs, fwd_inputs):
            [X, Y] = fwd_inputs
            [GX, GY] = powt_grad(g_out, outputs, [X, Y[:, :, np.newaxis]])
            return ([GX, np.sum(np.sum(GY, 3), 0)])

        op = core.CreateOperator("Pow", ["X", "Y"], "Z", broadcast=1, axis=1)
        self.assertReferenceChecks(device_option=gc,
                                   op=op,
                                   inputs=[X, Y],
                                   reference=powt_op_axis1,
                                   output_to_grad="Z",
                                   grad_reference=powt_grad_axis1)

        #3. broadcasting the first dimension
        X = np.random.rand(2, 3, 4, 5).astype(np.float32) + 1.0
        Y = np.random.rand(2).astype(np.float32) + 2.0

        #pow op with the latter array increased by one dim
        def powt_op_axis0(X, Y):
            return powt_op(X, Y[:, np.newaxis, np.newaxis, np.newaxis])

        #two gradients Y*X^(Y-1) and X^Y * ln(X)
        #latter gradient is sumed over 3, 2 and 1 dims to account for broadcast
        def powt_grad_axis0(g_out, outputs, fwd_inputs):
            [X, Y] = fwd_inputs
            [GX, GY] = powt_grad(g_out,
                                 outputs,
                                 [X, Y[:, np.newaxis, np.newaxis, np.newaxis]])
            return ([GX, np.sum(np.sum(np.sum(GY, 3), 2), 1)])

        op = core.CreateOperator("Pow", ["X", "Y"], "Z", broadcast=1, axis=0)
        self.assertReferenceChecks(device_option=gc,
                                   op=op,
                                   inputs=[X, Y],
                                   reference=powt_op_axis0,
                                   output_to_grad="Z",
                                   grad_reference=powt_grad_axis0)

        #4. broadcasting with single elem dimensions at both ends
        X = np.random.rand(2, 3, 4, 5).astype(np.float32) + 1.0
        Y = np.random.rand(1, 4, 1).astype(np.float32) + 2.0

        #pow op with the latter array increased by one dim
        def powt_op_mixed(X, Y):
            return powt_op(X, Y[np.newaxis, :, :, :])

        #two gradients Y*X^(Y-1) and X^Y * ln(X)
        #latter gradient is sumed over 0 and 1 dims to account for broadcast
        def powt_grad_mixed(g_out, outputs, fwd_inputs):
            [X, Y] = fwd_inputs
            [GX, GY] = powt_grad(g_out, outputs, [X, Y[np.newaxis, :, :, :]])
            return ([GX, np.reshape(np.sum(np.sum(np.sum(GY, 3), 1), 0),
                                    (1, 4, 1))])

        op = core.CreateOperator("Pow", ["X", "Y"], "Z", broadcast=1, axis=1)
        self.assertReferenceChecks(device_option=gc,
                                   op=op,
                                   inputs=[X, Y],
                                   reference=powt_op_mixed,
                                   output_to_grad="Z",
                                   grad_reference=powt_grad_mixed)

    @given(**hu.gcs)
    def test_broadcast_scalar(self, gc, dc):
        # broadcasting constant
        X = np.random.rand(2, 3, 4, 5).astype(np.float32)
        Y = np.random.rand(1).astype(np.float32)
        op = core.CreateOperator("Add", ["X", "Y"], "out", broadcast=1)
        workspace.FeedBlob("X", X)
        workspace.FeedBlob("Y", Y)
        workspace.RunOperatorOnce(op)
        out = workspace.FetchBlob("out")
        np.testing.assert_array_almost_equal(
            out, X + Y)
        self.assertDeviceChecks(dc, op, [X, Y], [0])

        # broadcasting scalar
        X = np.random.rand(1).astype(np.float32)
        Y = np.random.rand(1).astype(np.float32).reshape([])
        op = core.CreateOperator("Add", ["X", "Y"], "out", broadcast=1)
        workspace.FeedBlob("X", X)
        workspace.FeedBlob("Y", Y)
        workspace.RunOperatorOnce(op)
        out = workspace.FetchBlob("out")
        np.testing.assert_array_almost_equal(
            out, X + Y)
        self.assertDeviceChecks(dc, op, [X, Y], [0])

    @given(**hu.gcs)
    def test_semantic_broadcast(self, gc, dc):
        # NCHW as default
        X = np.random.rand(2, 3, 4, 5).astype(np.float32)
        Y = np.random.rand(3).astype(np.float32)
        op = core.CreateOperator(
            "Add", ["X", "Y"], "out", broadcast=1, axis_str="C")
        workspace.FeedBlob("X", X)
        workspace.FeedBlob("Y", Y)
        workspace.RunOperatorOnce(op)
        out = workspace.FetchBlob("out")
        np.testing.assert_array_almost_equal(
            out, X + Y[:, np.newaxis, np.newaxis])
        self.assertDeviceChecks(dc, op, [X, Y], [0])

        # NHWC
        X = np.random.rand(2, 3, 4, 5).astype(np.float32)
        Y = np.random.rand(5).astype(np.float32)
        op = core.CreateOperator(
            "Add", ["X", "Y"], "out", broadcast=1, axis_str="C", order="NHWC")
        workspace.FeedBlob("X", X)
        workspace.FeedBlob("Y", Y)
        workspace.RunOperatorOnce(op)
        out = workspace.FetchBlob("out")
        np.testing.assert_array_almost_equal(out, X + Y)
        self.assertDeviceChecks(dc, op, [X, Y], [0])

    @given(**hu.gcs)
    def test_sum_reduce_empty_blob(self, gc, dc):
        net = core.Net('test')

        with core.DeviceScope(gc):
            net.GivenTensorFill([], ["X"], values=[], shape=[2, 0, 5])
            net.GivenTensorFill([], ["Y"], values=[], shape=[2, 0])
            net.SumReduceLike(["X", "Y"], "out", axis=0)
            workspace.RunNetOnce(net)

    @given(**hu.gcs)
    def test_sum_reduce(self, gc, dc):
        # Set broadcast and no axis, i.e. broadcasting last dimensions.
        X = np.random.rand(2, 3, 4, 5).astype(np.float32)
        Y = np.random.rand(4, 5).astype(np.float32)
        op = core.CreateOperator(
            "SumReduceLike", ["X", "Y"], "out", broadcast=1)
        workspace.FeedBlob("X", X)
        workspace.FeedBlob("Y", Y)
        workspace.RunOperatorOnce(op)
        out = workspace.FetchBlob("out")
        res = np.sum(X, axis=0)
        res = np.sum(res, axis=0)
        np.testing.assert_array_almost_equal(out, res)
        self.assertDeviceChecks(dc, op, [X, Y], [0])

        # Set broadcast and no axis, i.e. broadcasting last dimensions.
        X = np.random.rand(2, 3, 4, 5).astype(np.float32)
        Y = np.random.rand(2, 3).astype(np.float32)
        op = core.CreateOperator(
            "SumReduceLike", ["X", "Y"], "out", broadcast=1, axis=0)
        workspace.FeedBlob("X", X)
        workspace.FeedBlob("Y", Y)
        workspace.RunOperatorOnce(op)
        out = workspace.FetchBlob("out")
        res = np.sum(X, axis=3)
        res = np.sum(res, axis=2)
        np.testing.assert_array_almost_equal(out, res, decimal=3)
        self.assertDeviceChecks(dc, op, [X, Y], [0])

        # broadcasting intermediate dimensions
        X = np.random.rand(2, 3, 4, 5).astype(np.float32)
        Y = np.random.rand(3, 4).astype(np.float32)
        op = core.CreateOperator(
            "SumReduceLike", ["X", "Y"], "out", broadcast=1, axis=1)
        workspace.FeedBlob("X", X)
        workspace.FeedBlob("Y", Y)
        workspace.RunOperatorOnce(op)
        out = workspace.FetchBlob("out")
        res = np.sum(X, axis=0)
        res = np.sum(res, axis=2)
        np.testing.assert_array_almost_equal(out, res)
        self.assertDeviceChecks(dc, op, [X, Y], [0])

        # broadcasting intermediate dimensions
        X = np.random.rand(2, 3, 4, 500).astype(np.float64)
        Y = np.random.rand(1).astype(np.float64)
        op = core.CreateOperator(
            "SumReduceLike", ["X", "Y"], "out", broadcast=1)
        workspace.FeedBlob("X", X)
        workspace.FeedBlob("Y", Y)
        workspace.RunOperatorOnce(op)
        out = workspace.FetchBlob("out")
        res = np.array(np.sum(X))
        np.testing.assert_array_almost_equal(out, res, decimal=0)

        # broadcasting with single elem dimensions at both ends
        X = np.random.rand(2, 3, 4, 5).astype(np.float32)
        Y = np.random.rand(1, 3, 4, 1).astype(np.float32)
        op = core.CreateOperator(
            "SumReduceLike", ["X", "Y"], "out", broadcast=1)
        workspace.FeedBlob("X", X)
        workspace.FeedBlob("Y", Y)
        workspace.RunOperatorOnce(op)
        out = workspace.FetchBlob("out")
        res = np.sum(X, axis=0)
        res = np.sum(res, axis=2).reshape(Y.shape)
        np.testing.assert_array_almost_equal(out, res)
        self.assertDeviceChecks(dc, op, [X, Y], [0])

        # fp64 is not supported with the CUDA op
        dc_cpu_only = [d for d in dc if d.device_type != caffe2_pb2.CUDA]
        self.assertDeviceChecks(dc_cpu_only, op, [X, Y], [0])

    @unittest.skipIf(not workspace.has_gpu_support, "No gpu support")
    @given(**hu.gcs_gpu_only)
    def test_sum_reduce_fp16(self, gc, dc):
        # Set broadcast and no axis, i.e. broadcasting last dimensions.
        X = np.random.rand(2, 3, 4, 5).astype(np.float16)
        Y = np.random.rand(4, 5).astype(np.float16)
        op = core.CreateOperator(
            "SumReduceLike", ["X", "Y"], "out", broadcast=1, device_option=gc)

        def ref_op(X, Y):
            res = np.sum(X, axis=0)
            res = np.sum(res, axis=0)
            return [res]

        self.assertReferenceChecks(
            device_option=gc,
            op=op,
            inputs=[X, Y],
            reference=ref_op,
            threshold=1e-3)

        # Set broadcast and no axis, i.e. broadcasting last dimensions.
        X = np.random.rand(2, 3, 4, 5).astype(np.float16)
        Y = np.random.rand(2, 3).astype(np.float16)
        op = core.CreateOperator(
            "SumReduceLike", ["X", "Y"], "out", broadcast=1, axis=0)

        def ref_op(X, Y):
            res = np.sum(X, axis=3)
            res = np.sum(res, axis=2)
            return [res]

        self.assertReferenceChecks(
            device_option=gc,
            op=op,
            inputs=[X, Y],
            reference=ref_op,
            threshold=1e-3)

        # broadcasting intermediate dimensions
        X = np.random.rand(2, 3, 4, 5).astype(np.float16)
        Y = np.random.rand(3, 4).astype(np.float16)
        op = core.CreateOperator(
            "SumReduceLike", ["X", "Y"], "out", broadcast=1, axis=1)

        def ref_op(X, Y):
            res = np.sum(X, axis=0)
            res = np.sum(res, axis=2)
            return [res]

        self.assertReferenceChecks(
            device_option=gc,
            op=op,
            inputs=[X, Y],
            reference=ref_op,
            threshold=1e-3)

        # broadcasting with single elem dimensions at both ends
        X = np.random.rand(2, 3, 4, 5).astype(np.float16)
        Y = np.random.rand(1, 3, 4, 1).astype(np.float16)
        op = core.CreateOperator(
            "SumReduceLike", ["X", "Y"], "out", broadcast=1)

        def ref_op(X, Y):
            res = np.sum(X, axis=0)
            res = np.sum(res, axis=2)
            return [res.reshape(Y.shape)]

        self.assertReferenceChecks(
            device_option=gc,
            op=op,
            inputs=[X, Y],
            reference=ref_op,
            threshold=1e-3)

if __name__ == "__main__":
    unittest.main()

[((539, 554), 'hypothesis.given', 'given', ([], {}), '(**hu.gcs)\n', (544, 554), False, 'from hypothesis import given\n'), ((2922, 2937), 'hypothesis.given', 'given', ([], {}), '(**hu.gcs)\n', (2927, 2937), False, 'from hypothesis import given\n'), ((5305, 5320), 'hypothesis.given', 'given', ([], {}), '(**hu.gcs)\n', (5310, 5320), False, 'from hypothesis import given\n'), ((7688, 7710), 'caffe2.python.serialized_test.serialized_test_util.given', 'serial.given', ([], {}), '(**hu.gcs)\n', (7700, 7710), True, 'import caffe2.python.serialized_test.serialized_test_util as serial\n'), ((12399, 12414), 'hypothesis.given', 'given', ([], {}), '(**hu.gcs)\n', (12404, 12414), False, 'from hypothesis import given\n'), ((13434, 13449), 'hypothesis.given', 'given', ([], {}), '(**hu.gcs)\n', (13439, 13449), False, 'from hypothesis import given\n'), ((14529, 14544), 'hypothesis.given', 'given', ([], {}), '(**hu.gcs)\n', (14534, 14544), False, 'from hypothesis import given\n'), ((14902, 14917), 'hypothesis.given', 'given', ([], {}), '(**hu.gcs)\n', (14907, 14917), False, 'from hypothesis import given\n'), ((18070, 18134), 'unittest.skipIf', 'unittest.skipIf', (['(not workspace.has_gpu_support)', '"""No gpu support"""'], {}), "(not workspace.has_gpu_support, 'No gpu support')\n", (18085, 18134), False, 'import unittest\n'), ((18140, 18164), 'hypothesis.given', 'given', ([], {}), '(**hu.gcs_gpu_only)\n', (18145, 18164), False, 'from hypothesis import given\n'), ((20564, 20579), 'unittest.main', 'unittest.main', ([], {}), '()\n', (20577, 20579), False, 'import unittest\n'), ((792, 850), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""Add"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)'}), "('Add', ['X', 'Y'], 'out', broadcast=1)\n", (811, 850), False, 'from caffe2.python import core, workspace\n'), ((859, 885), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""X"""', 'X'], {}), "('X', X)\n", (877, 885), False, 'from caffe2.python import core, workspace\n'), ((894, 920), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""Y"""', 'Y'], {}), "('Y', Y)\n", (912, 920), False, 'from caffe2.python import core, workspace\n'), ((929, 958), 'caffe2.python.workspace.RunOperatorOnce', 'workspace.RunOperatorOnce', (['op'], {}), '(op)\n', (954, 958), False, 'from caffe2.python import core, workspace\n'), ((973, 999), 'caffe2.python.workspace.FetchBlob', 'workspace.FetchBlob', (['"""out"""'], {}), "('out')\n", (992, 999), False, 'from caffe2.python import core, workspace\n'), ((1008, 1056), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['out', '(X + Y)'], {}), '(out, X + Y)\n', (1044, 1056), True, 'import numpy as np\n'), ((1339, 1405), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""Add"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)', 'axis': '(1)'}), "('Add', ['X', 'Y'], 'out', broadcast=1, axis=1)\n", (1358, 1405), False, 'from caffe2.python import core, workspace\n'), ((1414, 1440), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""X"""', 'X'], {}), "('X', X)\n", (1432, 1440), False, 'from caffe2.python import core, workspace\n'), ((1449, 1475), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""Y"""', 'Y'], {}), "('Y', Y)\n", (1467, 1475), False, 'from caffe2.python import core, workspace\n'), ((1484, 1513), 'caffe2.python.workspace.RunOperatorOnce', 'workspace.RunOperatorOnce', (['op'], {}), '(op)\n', (1509, 1513), False, 'from caffe2.python import core, workspace\n'), ((1528, 1554), 'caffe2.python.workspace.FetchBlob', 'workspace.FetchBlob', (['"""out"""'], {}), "('out')\n", (1547, 1554), False, 'from caffe2.python import core, workspace\n'), ((1563, 1631), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['out', '(X + Y[:, :, (np.newaxis)])'], {}), '(out, X + Y[:, :, (np.newaxis)])\n', (1599, 1631), True, 'import numpy as np\n'), ((1905, 1971), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""Add"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)', 'axis': '(0)'}), "('Add', ['X', 'Y'], 'out', broadcast=1, axis=0)\n", (1924, 1971), False, 'from caffe2.python import core, workspace\n'), ((1980, 2006), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""X"""', 'X'], {}), "('X', X)\n", (1998, 2006), False, 'from caffe2.python import core, workspace\n'), ((2015, 2041), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""Y"""', 'Y'], {}), "('Y', Y)\n", (2033, 2041), False, 'from caffe2.python import core, workspace\n'), ((2050, 2079), 'caffe2.python.workspace.RunOperatorOnce', 'workspace.RunOperatorOnce', (['op'], {}), '(op)\n', (2075, 2079), False, 'from caffe2.python import core, workspace\n'), ((2094, 2120), 'caffe2.python.workspace.FetchBlob', 'workspace.FetchBlob', (['"""out"""'], {}), "('out')\n", (2113, 2120), False, 'from caffe2.python import core, workspace\n'), ((2129, 2227), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['out', '(X + Y[:, (np.newaxis), (np.newaxis), (np.newaxis)])'], {}), '(out, X + Y[:, (np.newaxis), (np.\n    newaxis), (np.newaxis)])\n', (2165, 2227), True, 'import numpy as np\n'), ((2532, 2598), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""Add"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)', 'axis': '(1)'}), "('Add', ['X', 'Y'], 'out', broadcast=1, axis=1)\n", (2551, 2598), False, 'from caffe2.python import core, workspace\n'), ((2607, 2633), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""X"""', 'X'], {}), "('X', X)\n", (2625, 2633), False, 'from caffe2.python import core, workspace\n'), ((2642, 2668), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""Y"""', 'Y'], {}), "('Y', Y)\n", (2660, 2668), False, 'from caffe2.python import core, workspace\n'), ((2677, 2706), 'caffe2.python.workspace.RunOperatorOnce', 'workspace.RunOperatorOnce', (['op'], {}), '(op)\n', (2702, 2706), False, 'from caffe2.python import core, workspace\n'), ((2721, 2747), 'caffe2.python.workspace.FetchBlob', 'workspace.FetchBlob', (['"""out"""'], {}), "('out')\n", (2740, 2747), False, 'from caffe2.python import core, workspace\n'), ((2756, 2804), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['out', '(X + Y)'], {}), '(out, X + Y)\n', (2792, 2804), True, 'import numpy as np\n'), ((3175, 3233), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""Mul"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)'}), "('Mul', ['X', 'Y'], 'out', broadcast=1)\n", (3194, 3233), False, 'from caffe2.python import core, workspace\n'), ((3242, 3268), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""X"""', 'X'], {}), "('X', X)\n", (3260, 3268), False, 'from caffe2.python import core, workspace\n'), ((3277, 3303), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""Y"""', 'Y'], {}), "('Y', Y)\n", (3295, 3303), False, 'from caffe2.python import core, workspace\n'), ((3312, 3341), 'caffe2.python.workspace.RunOperatorOnce', 'workspace.RunOperatorOnce', (['op'], {}), '(op)\n', (3337, 3341), False, 'from caffe2.python import core, workspace\n'), ((3356, 3382), 'caffe2.python.workspace.FetchBlob', 'workspace.FetchBlob', (['"""out"""'], {}), "('out')\n", (3375, 3382), False, 'from caffe2.python import core, workspace\n'), ((3391, 3439), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['out', '(X * Y)'], {}), '(out, X * Y)\n', (3427, 3439), True, 'import numpy as np\n'), ((3722, 3788), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""Mul"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)', 'axis': '(1)'}), "('Mul', ['X', 'Y'], 'out', broadcast=1, axis=1)\n", (3741, 3788), False, 'from caffe2.python import core, workspace\n'), ((3797, 3823), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""X"""', 'X'], {}), "('X', X)\n", (3815, 3823), False, 'from caffe2.python import core, workspace\n'), ((3832, 3858), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""Y"""', 'Y'], {}), "('Y', Y)\n", (3850, 3858), False, 'from caffe2.python import core, workspace\n'), ((3867, 3896), 'caffe2.python.workspace.RunOperatorOnce', 'workspace.RunOperatorOnce', (['op'], {}), '(op)\n', (3892, 3896), False, 'from caffe2.python import core, workspace\n'), ((3911, 3937), 'caffe2.python.workspace.FetchBlob', 'workspace.FetchBlob', (['"""out"""'], {}), "('out')\n", (3930, 3937), False, 'from caffe2.python import core, workspace\n'), ((3946, 4014), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['out', '(X * Y[:, :, (np.newaxis)])'], {}), '(out, X * Y[:, :, (np.newaxis)])\n', (3982, 4014), True, 'import numpy as np\n'), ((4288, 4354), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""Mul"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)', 'axis': '(0)'}), "('Mul', ['X', 'Y'], 'out', broadcast=1, axis=0)\n", (4307, 4354), False, 'from caffe2.python import core, workspace\n'), ((4363, 4389), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""X"""', 'X'], {}), "('X', X)\n", (4381, 4389), False, 'from caffe2.python import core, workspace\n'), ((4398, 4424), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""Y"""', 'Y'], {}), "('Y', Y)\n", (4416, 4424), False, 'from caffe2.python import core, workspace\n'), ((4433, 4462), 'caffe2.python.workspace.RunOperatorOnce', 'workspace.RunOperatorOnce', (['op'], {}), '(op)\n', (4458, 4462), False, 'from caffe2.python import core, workspace\n'), ((4477, 4503), 'caffe2.python.workspace.FetchBlob', 'workspace.FetchBlob', (['"""out"""'], {}), "('out')\n", (4496, 4503), False, 'from caffe2.python import core, workspace\n'), ((4512, 4610), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['out', '(X * Y[:, (np.newaxis), (np.newaxis), (np.newaxis)])'], {}), '(out, X * Y[:, (np.newaxis), (np.\n    newaxis), (np.newaxis)])\n', (4548, 4610), True, 'import numpy as np\n'), ((4915, 4981), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""Mul"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)', 'axis': '(1)'}), "('Mul', ['X', 'Y'], 'out', broadcast=1, axis=1)\n", (4934, 4981), False, 'from caffe2.python import core, workspace\n'), ((4990, 5016), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""X"""', 'X'], {}), "('X', X)\n", (5008, 5016), False, 'from caffe2.python import core, workspace\n'), ((5025, 5051), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""Y"""', 'Y'], {}), "('Y', Y)\n", (5043, 5051), False, 'from caffe2.python import core, workspace\n'), ((5060, 5089), 'caffe2.python.workspace.RunOperatorOnce', 'workspace.RunOperatorOnce', (['op'], {}), '(op)\n', (5085, 5089), False, 'from caffe2.python import core, workspace\n'), ((5104, 5130), 'caffe2.python.workspace.FetchBlob', 'workspace.FetchBlob', (['"""out"""'], {}), "('out')\n", (5123, 5130), False, 'from caffe2.python import core, workspace\n'), ((5139, 5187), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['out', '(X * Y)'], {}), '(out, X * Y)\n', (5175, 5187), True, 'import numpy as np\n'), ((5558, 5616), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""Sub"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)'}), "('Sub', ['X', 'Y'], 'out', broadcast=1)\n", (5577, 5616), False, 'from caffe2.python import core, workspace\n'), ((5625, 5651), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""X"""', 'X'], {}), "('X', X)\n", (5643, 5651), False, 'from caffe2.python import core, workspace\n'), ((5660, 5686), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""Y"""', 'Y'], {}), "('Y', Y)\n", (5678, 5686), False, 'from caffe2.python import core, workspace\n'), ((5695, 5724), 'caffe2.python.workspace.RunOperatorOnce', 'workspace.RunOperatorOnce', (['op'], {}), '(op)\n', (5720, 5724), False, 'from caffe2.python import core, workspace\n'), ((5739, 5765), 'caffe2.python.workspace.FetchBlob', 'workspace.FetchBlob', (['"""out"""'], {}), "('out')\n", (5758, 5765), False, 'from caffe2.python import core, workspace\n'), ((5774, 5822), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['out', '(X - Y)'], {}), '(out, X - Y)\n', (5810, 5822), True, 'import numpy as np\n'), ((6105, 6171), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""Sub"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)', 'axis': '(1)'}), "('Sub', ['X', 'Y'], 'out', broadcast=1, axis=1)\n", (6124, 6171), False, 'from caffe2.python import core, workspace\n'), ((6180, 6206), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""X"""', 'X'], {}), "('X', X)\n", (6198, 6206), False, 'from caffe2.python import core, workspace\n'), ((6215, 6241), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""Y"""', 'Y'], {}), "('Y', Y)\n", (6233, 6241), False, 'from caffe2.python import core, workspace\n'), ((6250, 6279), 'caffe2.python.workspace.RunOperatorOnce', 'workspace.RunOperatorOnce', (['op'], {}), '(op)\n', (6275, 6279), False, 'from caffe2.python import core, workspace\n'), ((6294, 6320), 'caffe2.python.workspace.FetchBlob', 'workspace.FetchBlob', (['"""out"""'], {}), "('out')\n", (6313, 6320), False, 'from caffe2.python import core, workspace\n'), ((6329, 6397), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['out', '(X - Y[:, :, (np.newaxis)])'], {}), '(out, X - Y[:, :, (np.newaxis)])\n', (6365, 6397), True, 'import numpy as np\n'), ((6671, 6737), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""Sub"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)', 'axis': '(0)'}), "('Sub', ['X', 'Y'], 'out', broadcast=1, axis=0)\n", (6690, 6737), False, 'from caffe2.python import core, workspace\n'), ((6746, 6772), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""X"""', 'X'], {}), "('X', X)\n", (6764, 6772), False, 'from caffe2.python import core, workspace\n'), ((6781, 6807), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""Y"""', 'Y'], {}), "('Y', Y)\n", (6799, 6807), False, 'from caffe2.python import core, workspace\n'), ((6816, 6845), 'caffe2.python.workspace.RunOperatorOnce', 'workspace.RunOperatorOnce', (['op'], {}), '(op)\n', (6841, 6845), False, 'from caffe2.python import core, workspace\n'), ((6860, 6886), 'caffe2.python.workspace.FetchBlob', 'workspace.FetchBlob', (['"""out"""'], {}), "('out')\n", (6879, 6886), False, 'from caffe2.python import core, workspace\n'), ((6895, 6993), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['out', '(X - Y[:, (np.newaxis), (np.newaxis), (np.newaxis)])'], {}), '(out, X - Y[:, (np.newaxis), (np.\n    newaxis), (np.newaxis)])\n', (6931, 6993), True, 'import numpy as np\n'), ((7298, 7364), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""Sub"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)', 'axis': '(1)'}), "('Sub', ['X', 'Y'], 'out', broadcast=1, axis=1)\n", (7317, 7364), False, 'from caffe2.python import core, workspace\n'), ((7373, 7399), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""X"""', 'X'], {}), "('X', X)\n", (7391, 7399), False, 'from caffe2.python import core, workspace\n'), ((7408, 7434), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""Y"""', 'Y'], {}), "('Y', Y)\n", (7426, 7434), False, 'from caffe2.python import core, workspace\n'), ((7443, 7472), 'caffe2.python.workspace.RunOperatorOnce', 'workspace.RunOperatorOnce', (['op'], {}), '(op)\n', (7468, 7472), False, 'from caffe2.python import core, workspace\n'), ((7487, 7513), 'caffe2.python.workspace.FetchBlob', 'workspace.FetchBlob', (['"""out"""'], {}), "('out')\n", (7506, 7513), False, 'from caffe2.python import core, workspace\n'), ((7522, 7570), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['out', '(X - Y)'], {}), '(out, X - Y)\n', (7558, 7570), True, 'import numpy as np\n'), ((7762, 7781), 'numpy.random.seed', 'np.random.seed', (['(101)'], {}), '(101)\n', (7776, 7781), True, 'import numpy as np\n'), ((8605, 8661), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""Pow"""', "['X', 'Y']", '"""Z"""'], {'broadcast': '(1)'}), "('Pow', ['X', 'Y'], 'Z', broadcast=1)\n", (8624, 8661), False, 'from caffe2.python import core, workspace\n'), ((9660, 9724), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""Pow"""', "['X', 'Y']", '"""Z"""'], {'broadcast': '(1)', 'axis': '(1)'}), "('Pow', ['X', 'Y'], 'Z', broadcast=1, axis=1)\n", (9679, 9724), False, 'from caffe2.python import core, workspace\n'), ((10840, 10904), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""Pow"""', "['X', 'Y']", '"""Z"""'], {'broadcast': '(1)', 'axis': '(0)'}), "('Pow', ['X', 'Y'], 'Z', broadcast=1, axis=0)\n", (10859, 10904), False, 'from caffe2.python import core, workspace\n'), ((12001, 12065), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""Pow"""', "['X', 'Y']", '"""Z"""'], {'broadcast': '(1)', 'axis': '(1)'}), "('Pow', ['X', 'Y'], 'Z', broadcast=1, axis=1)\n", (12020, 12065), False, 'from caffe2.python import core, workspace\n'), ((12612, 12670), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""Add"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)'}), "('Add', ['X', 'Y'], 'out', broadcast=1)\n", (12631, 12670), False, 'from caffe2.python import core, workspace\n'), ((12679, 12705), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""X"""', 'X'], {}), "('X', X)\n", (12697, 12705), False, 'from caffe2.python import core, workspace\n'), ((12714, 12740), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""Y"""', 'Y'], {}), "('Y', Y)\n", (12732, 12740), False, 'from caffe2.python import core, workspace\n'), ((12749, 12778), 'caffe2.python.workspace.RunOperatorOnce', 'workspace.RunOperatorOnce', (['op'], {}), '(op)\n', (12774, 12778), False, 'from caffe2.python import core, workspace\n'), ((12793, 12819), 'caffe2.python.workspace.FetchBlob', 'workspace.FetchBlob', (['"""out"""'], {}), "('out')\n", (12812, 12819), False, 'from caffe2.python import core, workspace\n'), ((12828, 12876), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['out', '(X + Y)'], {}), '(out, X + Y)\n', (12864, 12876), True, 'import numpy as np\n'), ((13097, 13155), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""Add"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)'}), "('Add', ['X', 'Y'], 'out', broadcast=1)\n", (13116, 13155), False, 'from caffe2.python import core, workspace\n'), ((13164, 13190), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""X"""', 'X'], {}), "('X', X)\n", (13182, 13190), False, 'from caffe2.python import core, workspace\n'), ((13199, 13225), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""Y"""', 'Y'], {}), "('Y', Y)\n", (13217, 13225), False, 'from caffe2.python import core, workspace\n'), ((13234, 13263), 'caffe2.python.workspace.RunOperatorOnce', 'workspace.RunOperatorOnce', (['op'], {}), '(op)\n', (13259, 13263), False, 'from caffe2.python import core, workspace\n'), ((13278, 13304), 'caffe2.python.workspace.FetchBlob', 'workspace.FetchBlob', (['"""out"""'], {}), "('out')\n", (13297, 13304), False, 'from caffe2.python import core, workspace\n'), ((13313, 13361), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['out', '(X + Y)'], {}), '(out, X + Y)\n', (13349, 13361), True, 'import numpy as np\n'), ((13643, 13715), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""Add"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)', 'axis_str': '"""C"""'}), "('Add', ['X', 'Y'], 'out', broadcast=1, axis_str='C')\n", (13662, 13715), False, 'from caffe2.python import core, workspace\n'), ((13737, 13763), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""X"""', 'X'], {}), "('X', X)\n", (13755, 13763), False, 'from caffe2.python import core, workspace\n'), ((13772, 13798), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""Y"""', 'Y'], {}), "('Y', Y)\n", (13790, 13798), False, 'from caffe2.python import core, workspace\n'), ((13807, 13836), 'caffe2.python.workspace.RunOperatorOnce', 'workspace.RunOperatorOnce', (['op'], {}), '(op)\n', (13832, 13836), False, 'from caffe2.python import core, workspace\n'), ((13851, 13877), 'caffe2.python.workspace.FetchBlob', 'workspace.FetchBlob', (['"""out"""'], {}), "('out')\n", (13870, 13877), False, 'from caffe2.python import core, workspace\n'), ((13886, 13965), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['out', '(X + Y[:, (np.newaxis), (np.newaxis)])'], {}), '(out, X + Y[:, (np.newaxis), (np.newaxis)])\n', (13922, 13965), True, 'import numpy as np\n'), ((14164, 14254), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""Add"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)', 'axis_str': '"""C"""', 'order': '"""NHWC"""'}), "('Add', ['X', 'Y'], 'out', broadcast=1, axis_str='C',\n    order='NHWC')\n", (14183, 14254), False, 'from caffe2.python import core, workspace\n'), ((14272, 14298), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""X"""', 'X'], {}), "('X', X)\n", (14290, 14298), False, 'from caffe2.python import core, workspace\n'), ((14307, 14333), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""Y"""', 'Y'], {}), "('Y', Y)\n", (14325, 14333), False, 'from caffe2.python import core, workspace\n'), ((14342, 14371), 'caffe2.python.workspace.RunOperatorOnce', 'workspace.RunOperatorOnce', (['op'], {}), '(op)\n', (14367, 14371), False, 'from caffe2.python import core, workspace\n'), ((14386, 14412), 'caffe2.python.workspace.FetchBlob', 'workspace.FetchBlob', (['"""out"""'], {}), "('out')\n", (14405, 14412), False, 'from caffe2.python import core, workspace\n'), ((14421, 14469), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['out', '(X + Y)'], {}), '(out, X + Y)\n', (14457, 14469), True, 'import numpy as np\n'), ((14609, 14625), 'caffe2.python.core.Net', 'core.Net', (['"""test"""'], {}), "('test')\n", (14617, 14625), False, 'from caffe2.python import core, workspace\n'), ((15152, 15220), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""SumReduceLike"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)'}), "('SumReduceLike', ['X', 'Y'], 'out', broadcast=1)\n", (15171, 15220), False, 'from caffe2.python import core, workspace\n'), ((15242, 15268), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""X"""', 'X'], {}), "('X', X)\n", (15260, 15268), False, 'from caffe2.python import core, workspace\n'), ((15277, 15303), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""Y"""', 'Y'], {}), "('Y', Y)\n", (15295, 15303), False, 'from caffe2.python import core, workspace\n'), ((15312, 15341), 'caffe2.python.workspace.RunOperatorOnce', 'workspace.RunOperatorOnce', (['op'], {}), '(op)\n', (15337, 15341), False, 'from caffe2.python import core, workspace\n'), ((15356, 15382), 'caffe2.python.workspace.FetchBlob', 'workspace.FetchBlob', (['"""out"""'], {}), "('out')\n", (15375, 15382), False, 'from caffe2.python import core, workspace\n'), ((15397, 15414), 'numpy.sum', 'np.sum', (['X'], {'axis': '(0)'}), '(X, axis=0)\n', (15403, 15414), True, 'import numpy as np\n'), ((15429, 15448), 'numpy.sum', 'np.sum', (['res'], {'axis': '(0)'}), '(res, axis=0)\n', (15435, 15448), True, 'import numpy as np\n'), ((15457, 15503), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['out', 'res'], {}), '(out, res)\n', (15493, 15503), True, 'import numpy as np\n'), ((15753, 15829), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""SumReduceLike"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)', 'axis': '(0)'}), "('SumReduceLike', ['X', 'Y'], 'out', broadcast=1, axis=0)\n", (15772, 15829), False, 'from caffe2.python import core, workspace\n'), ((15851, 15877), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""X"""', 'X'], {}), "('X', X)\n", (15869, 15877), False, 'from caffe2.python import core, workspace\n'), ((15886, 15912), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""Y"""', 'Y'], {}), "('Y', Y)\n", (15904, 15912), False, 'from caffe2.python import core, workspace\n'), ((15921, 15950), 'caffe2.python.workspace.RunOperatorOnce', 'workspace.RunOperatorOnce', (['op'], {}), '(op)\n', (15946, 15950), False, 'from caffe2.python import core, workspace\n'), ((15965, 15991), 'caffe2.python.workspace.FetchBlob', 'workspace.FetchBlob', (['"""out"""'], {}), "('out')\n", (15984, 15991), False, 'from caffe2.python import core, workspace\n'), ((16006, 16023), 'numpy.sum', 'np.sum', (['X'], {'axis': '(3)'}), '(X, axis=3)\n', (16012, 16023), True, 'import numpy as np\n'), ((16038, 16057), 'numpy.sum', 'np.sum', (['res'], {'axis': '(2)'}), '(res, axis=2)\n', (16044, 16057), True, 'import numpy as np\n'), ((16066, 16123), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['out', 'res'], {'decimal': '(3)'}), '(out, res, decimal=3)\n', (16102, 16123), True, 'import numpy as np\n'), ((16348, 16424), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""SumReduceLike"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)', 'axis': '(1)'}), "('SumReduceLike', ['X', 'Y'], 'out', broadcast=1, axis=1)\n", (16367, 16424), False, 'from caffe2.python import core, workspace\n'), ((16446, 16472), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""X"""', 'X'], {}), "('X', X)\n", (16464, 16472), False, 'from caffe2.python import core, workspace\n'), ((16481, 16507), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""Y"""', 'Y'], {}), "('Y', Y)\n", (16499, 16507), False, 'from caffe2.python import core, workspace\n'), ((16516, 16545), 'caffe2.python.workspace.RunOperatorOnce', 'workspace.RunOperatorOnce', (['op'], {}), '(op)\n', (16541, 16545), False, 'from caffe2.python import core, workspace\n'), ((16560, 16586), 'caffe2.python.workspace.FetchBlob', 'workspace.FetchBlob', (['"""out"""'], {}), "('out')\n", (16579, 16586), False, 'from caffe2.python import core, workspace\n'), ((16601, 16618), 'numpy.sum', 'np.sum', (['X'], {'axis': '(0)'}), '(X, axis=0)\n', (16607, 16618), True, 'import numpy as np\n'), ((16633, 16652), 'numpy.sum', 'np.sum', (['res'], {'axis': '(2)'}), '(res, axis=2)\n', (16639, 16652), True, 'import numpy as np\n'), ((16661, 16707), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['out', 'res'], {}), '(out, res)\n', (16697, 16707), True, 'import numpy as np\n'), ((16931, 16999), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""SumReduceLike"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)'}), "('SumReduceLike', ['X', 'Y'], 'out', broadcast=1)\n", (16950, 16999), False, 'from caffe2.python import core, workspace\n'), ((17021, 17047), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""X"""', 'X'], {}), "('X', X)\n", (17039, 17047), False, 'from caffe2.python import core, workspace\n'), ((17056, 17082), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""Y"""', 'Y'], {}), "('Y', Y)\n", (17074, 17082), False, 'from caffe2.python import core, workspace\n'), ((17091, 17120), 'caffe2.python.workspace.RunOperatorOnce', 'workspace.RunOperatorOnce', (['op'], {}), '(op)\n', (17116, 17120), False, 'from caffe2.python import core, workspace\n'), ((17135, 17161), 'caffe2.python.workspace.FetchBlob', 'workspace.FetchBlob', (['"""out"""'], {}), "('out')\n", (17154, 17161), False, 'from caffe2.python import core, workspace\n'), ((17204, 17261), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['out', 'res'], {'decimal': '(0)'}), '(out, res, decimal=0)\n', (17240, 17261), True, 'import numpy as np\n'), ((17456, 17524), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""SumReduceLike"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)'}), "('SumReduceLike', ['X', 'Y'], 'out', broadcast=1)\n", (17475, 17524), False, 'from caffe2.python import core, workspace\n'), ((17546, 17572), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""X"""', 'X'], {}), "('X', X)\n", (17564, 17572), False, 'from caffe2.python import core, workspace\n'), ((17581, 17607), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""Y"""', 'Y'], {}), "('Y', Y)\n", (17599, 17607), False, 'from caffe2.python import core, workspace\n'), ((17616, 17645), 'caffe2.python.workspace.RunOperatorOnce', 'workspace.RunOperatorOnce', (['op'], {}), '(op)\n', (17641, 17645), False, 'from caffe2.python import core, workspace\n'), ((17660, 17686), 'caffe2.python.workspace.FetchBlob', 'workspace.FetchBlob', (['"""out"""'], {}), "('out')\n", (17679, 17686), False, 'from caffe2.python import core, workspace\n'), ((17701, 17718), 'numpy.sum', 'np.sum', (['X'], {'axis': '(0)'}), '(X, axis=0)\n', (17707, 17718), True, 'import numpy as np\n'), ((17778, 17824), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['out', 'res'], {}), '(out, res)\n', (17814, 17824), True, 'import numpy as np\n'), ((18404, 18494), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""SumReduceLike"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)', 'device_option': 'gc'}), "('SumReduceLike', ['X', 'Y'], 'out', broadcast=1,\n    device_option=gc)\n", (18423, 18494), False, 'from caffe2.python import core, workspace\n'), ((18997, 19073), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""SumReduceLike"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)', 'axis': '(0)'}), "('SumReduceLike', ['X', 'Y'], 'out', broadcast=1, axis=0)\n", (19016, 19073), False, 'from caffe2.python import core, workspace\n'), ((19555, 19631), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""SumReduceLike"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)', 'axis': '(1)'}), "('SumReduceLike', ['X', 'Y'], 'out', broadcast=1, axis=1)\n", (19574, 19631), False, 'from caffe2.python import core, workspace\n'), ((20136, 20204), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""SumReduceLike"""', "['X', 'Y']", '"""out"""'], {'broadcast': '(1)'}), "('SumReduceLike', ['X', 'Y'], 'out', broadcast=1)\n", (20155, 20204), False, 'from caffe2.python import core, workspace\n'), ((14640, 14660), 'caffe2.python.core.DeviceScope', 'core.DeviceScope', (['gc'], {}), '(gc)\n', (14656, 14660), False, 'from caffe2.python import core, workspace\n'), ((14870, 14895), 'caffe2.python.workspace.RunNetOnce', 'workspace.RunNetOnce', (['net'], {}), '(net)\n', (14890, 14895), False, 'from caffe2.python import core, workspace\n'), ((17185, 17194), 'numpy.sum', 'np.sum', (['X'], {}), '(X)\n', (17191, 17194), True, 'import numpy as np\n'), ((18549, 18566), 'numpy.sum', 'np.sum', (['X'], {'axis': '(0)'}), '(X, axis=0)\n', (18555, 18566), True, 'import numpy as np\n'), ((18585, 18604), 'numpy.sum', 'np.sum', (['res'], {'axis': '(0)'}), '(res, axis=0)\n', (18591, 18604), True, 'import numpy as np\n'), ((19132, 19149), 'numpy.sum', 'np.sum', (['X'], {'axis': '(3)'}), '(X, axis=3)\n', (19138, 19149), True, 'import numpy as np\n'), ((19168, 19187), 'numpy.sum', 'np.sum', (['res'], {'axis': '(2)'}), '(res, axis=2)\n', (19174, 19187), True, 'import numpy as np\n'), ((19690, 19707), 'numpy.sum', 'np.sum', (['X'], {'axis': '(0)'}), '(X, axis=0)\n', (19696, 19707), True, 'import numpy as np\n'), ((19726, 19745), 'numpy.sum', 'np.sum', (['res'], {'axis': '(2)'}), '(res, axis=2)\n', (19732, 19745), True, 'import numpy as np\n'), ((20263, 20280), 'numpy.sum', 'np.sum', (['X'], {'axis': '(0)'}), '(X, axis=0)\n', (20269, 20280), True, 'import numpy as np\n'), ((20299, 20318), 'numpy.sum', 'np.sum', (['res'], {'axis': '(2)'}), '(res, axis=2)\n', (20305, 20318), True, 'import numpy as np\n'), ((681, 707), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (695, 707), True, 'import numpy as np\n'), ((739, 759), 'numpy.random.rand', 'np.random.rand', (['(4)', '(5)'], {}), '(4, 5)\n', (753, 759), True, 'import numpy as np\n'), ((1228, 1254), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (1242, 1254), True, 'import numpy as np\n'), ((1286, 1306), 'numpy.random.rand', 'np.random.rand', (['(3)', '(4)'], {}), '(3, 4)\n', (1300, 1306), True, 'import numpy as np\n'), ((1797, 1823), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (1811, 1823), True, 'import numpy as np\n'), ((1855, 1872), 'numpy.random.rand', 'np.random.rand', (['(2)'], {}), '(2)\n', (1869, 1872), True, 'import numpy as np\n'), ((2418, 2444), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (2432, 2444), True, 'import numpy as np\n'), ((2476, 2499), 'numpy.random.rand', 'np.random.rand', (['(1)', '(4)', '(1)'], {}), '(1, 4, 1)\n', (2490, 2499), True, 'import numpy as np\n'), ((3064, 3090), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (3078, 3090), True, 'import numpy as np\n'), ((3122, 3142), 'numpy.random.rand', 'np.random.rand', (['(4)', '(5)'], {}), '(4, 5)\n', (3136, 3142), True, 'import numpy as np\n'), ((3611, 3637), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (3625, 3637), True, 'import numpy as np\n'), ((3669, 3689), 'numpy.random.rand', 'np.random.rand', (['(3)', '(4)'], {}), '(3, 4)\n', (3683, 3689), True, 'import numpy as np\n'), ((4180, 4206), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (4194, 4206), True, 'import numpy as np\n'), ((4238, 4255), 'numpy.random.rand', 'np.random.rand', (['(2)'], {}), '(2)\n', (4252, 4255), True, 'import numpy as np\n'), ((4801, 4827), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (4815, 4827), True, 'import numpy as np\n'), ((4859, 4882), 'numpy.random.rand', 'np.random.rand', (['(1)', '(4)', '(1)'], {}), '(1, 4, 1)\n', (4873, 4882), True, 'import numpy as np\n'), ((5447, 5473), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (5461, 5473), True, 'import numpy as np\n'), ((5505, 5525), 'numpy.random.rand', 'np.random.rand', (['(4)', '(5)'], {}), '(4, 5)\n', (5519, 5525), True, 'import numpy as np\n'), ((5994, 6020), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (6008, 6020), True, 'import numpy as np\n'), ((6052, 6072), 'numpy.random.rand', 'np.random.rand', (['(3)', '(4)'], {}), '(3, 4)\n', (6066, 6072), True, 'import numpy as np\n'), ((6563, 6589), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (6577, 6589), True, 'import numpy as np\n'), ((6621, 6638), 'numpy.random.rand', 'np.random.rand', (['(2)'], {}), '(2)\n', (6635, 6638), True, 'import numpy as np\n'), ((7184, 7210), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (7198, 7210), True, 'import numpy as np\n'), ((7242, 7265), 'numpy.random.rand', 'np.random.rand', (['(1)', '(4)', '(1)'], {}), '(1, 4, 1)\n', (7256, 7265), True, 'import numpy as np\n'), ((7848, 7862), 'numpy.power', 'np.power', (['X', 'Y'], {}), '(X, Y)\n', (7856, 7862), True, 'import numpy as np\n'), ((12504, 12530), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (12518, 12530), True, 'import numpy as np\n'), ((12562, 12579), 'numpy.random.rand', 'np.random.rand', (['(1)'], {}), '(1)\n', (12576, 12579), True, 'import numpy as np\n'), ((12986, 13003), 'numpy.random.rand', 'np.random.rand', (['(1)'], {}), '(1)\n', (13000, 13003), True, 'import numpy as np\n'), ((13535, 13561), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (13549, 13561), True, 'import numpy as np\n'), ((13593, 13610), 'numpy.random.rand', 'np.random.rand', (['(3)'], {}), '(3)\n', (13607, 13610), True, 'import numpy as np\n'), ((14056, 14082), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (14070, 14082), True, 'import numpy as np\n'), ((14114, 14131), 'numpy.random.rand', 'np.random.rand', (['(5)'], {}), '(5)\n', (14128, 14131), True, 'import numpy as np\n'), ((15041, 15067), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (15055, 15067), True, 'import numpy as np\n'), ((15099, 15119), 'numpy.random.rand', 'np.random.rand', (['(4)', '(5)'], {}), '(4, 5)\n', (15113, 15119), True, 'import numpy as np\n'), ((15642, 15668), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (15656, 15668), True, 'import numpy as np\n'), ((15700, 15720), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)'], {}), '(2, 3)\n', (15714, 15720), True, 'import numpy as np\n'), ((16237, 16263), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (16251, 16263), True, 'import numpy as np\n'), ((16295, 16315), 'numpy.random.rand', 'np.random.rand', (['(3)', '(4)'], {}), '(3, 4)\n', (16309, 16315), True, 'import numpy as np\n'), ((16821, 16849), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(500)'], {}), '(2, 3, 4, 500)\n', (16835, 16849), True, 'import numpy as np\n'), ((16881, 16898), 'numpy.random.rand', 'np.random.rand', (['(1)'], {}), '(1)\n', (16895, 16898), True, 'import numpy as np\n'), ((17339, 17365), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (17353, 17365), True, 'import numpy as np\n'), ((17397, 17423), 'numpy.random.rand', 'np.random.rand', (['(1)', '(3)', '(4)', '(1)'], {}), '(1, 3, 4, 1)\n', (17411, 17423), True, 'import numpy as np\n'), ((17733, 17752), 'numpy.sum', 'np.sum', (['res'], {'axis': '(2)'}), '(res, axis=2)\n', (17739, 17752), True, 'import numpy as np\n'), ((18293, 18319), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (18307, 18319), True, 'import numpy as np\n'), ((18351, 18371), 'numpy.random.rand', 'np.random.rand', (['(4)', '(5)'], {}), '(4, 5)\n', (18365, 18371), True, 'import numpy as np\n'), ((18886, 18912), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (18900, 18912), True, 'import numpy as np\n'), ((18944, 18964), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)'], {}), '(2, 3)\n', (18958, 18964), True, 'import numpy as np\n'), ((19444, 19470), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (19458, 19470), True, 'import numpy as np\n'), ((19502, 19522), 'numpy.random.rand', 'np.random.rand', (['(3)', '(4)'], {}), '(3, 4)\n', (19516, 19522), True, 'import numpy as np\n'), ((20019, 20045), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (20033, 20045), True, 'import numpy as np\n'), ((20077, 20103), 'numpy.random.rand', 'np.random.rand', (['(1)', '(3)', '(4)', '(1)'], {}), '(1, 3, 4, 1)\n', (20091, 20103), True, 'import numpy as np\n'), ((8180, 8206), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (8194, 8206), True, 'import numpy as np\n'), ((8244, 8264), 'numpy.random.rand', 'np.random.rand', (['(4)', '(5)'], {}), '(4, 5)\n', (8258, 8264), True, 'import numpy as np\n'), ((8571, 8584), 'numpy.sum', 'np.sum', (['GY', '(1)'], {}), '(GY, 1)\n', (8577, 8584), True, 'import numpy as np\n'), ((9049, 9075), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (9063, 9075), True, 'import numpy as np\n'), ((9113, 9133), 'numpy.random.rand', 'np.random.rand', (['(3)', '(4)'], {}), '(3, 4)\n', (9127, 9133), True, 'import numpy as np\n'), ((9626, 9639), 'numpy.sum', 'np.sum', (['GY', '(3)'], {}), '(GY, 3)\n', (9632, 9639), True, 'import numpy as np\n'), ((10110, 10136), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (10124, 10136), True, 'import numpy as np\n'), ((10174, 10191), 'numpy.random.rand', 'np.random.rand', (['(2)'], {}), '(2)\n', (10188, 10191), True, 'import numpy as np\n'), ((11311, 11337), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (11325, 11337), True, 'import numpy as np\n'), ((11375, 11398), 'numpy.random.rand', 'np.random.rand', (['(1)', '(4)', '(1)'], {}), '(1, 4, 1)\n', (11389, 11398), True, 'import numpy as np\n'), ((8049, 8067), 'numpy.power', 'np.power', (['X', '(Y - 1)'], {}), '(X, Y - 1)\n', (8057, 8067), True, 'import numpy as np\n'), ((8073, 8082), 'numpy.log', 'np.log', (['X'], {}), '(X)\n', (8079, 8082), True, 'import numpy as np\n'), ((10802, 10815), 'numpy.sum', 'np.sum', (['GY', '(3)'], {}), '(GY, 3)\n', (10808, 10815), True, 'import numpy as np\n'), ((13035, 13052), 'numpy.random.rand', 'np.random.rand', (['(1)'], {}), '(1)\n', (13049, 13052), True, 'import numpy as np\n'), ((11915, 11928), 'numpy.sum', 'np.sum', (['GY', '(3)'], {}), '(GY, 3)\n', (11921, 11928), True, 'import numpy as np\n')]