+
/*
- Example of FFI extension I started from:
+ flatland is a simple 2d physical simulator
- https://github.com/pytorch/extension-ffi.git
+ Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/
+ Written by Francois Fleuret <francois.fleuret@idiap.ch>
- There is this tutorial
+ This file is part of flatland
- https://github.com/pytorch/tutorials/blob/master/Creating%20Extensions%20using%20FFI.md
+ flatland is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 3 as
+ published by the Free Software Foundation.
- And TH's Tensor definition are here in my install:
+ flatland is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
- anaconda3/lib/python3.5/site-packages/torch/lib/include/TH/generic/THTensor.h
+ You should have received a copy of the GNU General Public License
+ along with flatland. If not, see <http://www.gnu.org/licenses/>.
- */
+*/
#include <TH/TH.h>
#include "sequence_generator.h"
-THByteTensor *generate_sequence(long nb_sequences,
+THByteTensor *generate_sequence(int pulling,
+ long nb_sequences,
long nb_images,
long image_height, long image_width,
+ long nb_shapes,
int random_shape_size, int random_colors) {
long nb_channels = 3;
for(s = 0; s < nb_sequences; s++) {
a = THByteTensor_storage(result)->data + THByteTensor_storageOffset(result) + s * st0;
- fl_generate_sequence(nb_images, image_width, image_height,
+ fl_generate_sequence(nb_images, image_width, image_height, nb_shapes,
random_shape_size, random_colors,
+ pulling,
tmp_buffer);
unsigned char *r = tmp_buffer;
for(k = 0; k < nb_images; k++) {