Ejemplo n.º 1
0
void print_2D_view(tensor<T, M>& a) {
	for (unsigned int i = 0; i<a.shape(0); i++){
		for (unsigned int j = 0; j<a.shape(1); j++)
			cout<<a(i, j)<<" ";
		cout<<endl;
	}
}
Ejemplo n.º 2
0
void print_3D_view(tensor<T, M>& a) {
	for (unsigned int k = 0; k<a.shape(0); k++) {
		cout<<"dimension 0: "<<k<<endl;
		for (unsigned int i = 0; i<a.shape(1); i++){
			for (unsigned int j = 0; j<a.shape(2); j++)
				cout<<a(k, i, j)<<" ";
			cout<<endl;
		}
	}
}
Ejemplo n.º 3
0
void rand_init(tensor<T, M>& a){
	for (unsigned int i=0; i<a.shape(0);i++)
		a[i] = drand48();
}