Exemple #1
0
        public IntTensor Create(int[] _shape,
                                int[] _data = null,
                                ComputeBuffer _dataBuffer  = null,
                                ComputeBuffer _shapeBuffer = null,
                                ComputeShader _shader      = null,
                                bool _copyData             = true,
                                bool _dataOnGpu            = false,
                                bool _autograd             = false,
                                bool _keepgrads            = false,
                                string _creation_op        = null)
        {
            IntTensor tensor = new IntTensor();

            tensor.init(this,
                        _shape,
                        _data,
                        _dataBuffer,
                        _shapeBuffer,
                        _shader,
                        _copyData,
                        _dataOnGpu,
                        _autograd,
                        _keepgrads,
                        _creation_op);

            tensors.Add(tensor.Id, tensor);


            return(tensor);
        }
Exemple #2
0
        public IntTensor Create(int[] _shape,
                                int[] _data = null,
                                ComputeBuffer _dataBuffer  = null,
                                ComputeBuffer _shapeBuffer = null,
                                ComputeShader _shader      = null,
                                bool _copyData             = true,
                                bool _dataOnGpu            = false,
                                bool _autograd             = false,
                                bool _keepgrads            = false,
                                string _creation_op        = null)
        {
            if (ctrl.allow_new_tensors)
            {
                IntTensor tensor = new IntTensor();

                tensor.init(this,
                            _shape,
                            _data,
                            _dataBuffer,
                            _shapeBuffer,
                            shader,
                            _copyData,
                            _dataOnGpu,
                            _autograd,
                            _keepgrads,
                            _creation_op);

                tensors.Add(tensor.Id, tensor);

                return(tensor);
            }
            else
            {
                throw new Exception("Attempted to Create a new IntTensor");
            }
        }