Пример #1
0
THCudaStorage* THCudaStorage_newWithSize2(float data0, float data1)
{
  THCudaStorage *self = THCudaStorage_newWithSize(2);
  THCudaStorage_set(self, 0, data0);
  THCudaStorage_set(self, 1, data1);
  return self;
}
Пример #2
0
THCudaStorage* THCudaStorage_newWithSize4(float data0, float data1, float data2, float data3)
{
  THCudaStorage *self = THCudaStorage_newWithSize(4);
  THCudaStorage_set(self, 0, data0);
  THCudaStorage_set(self, 1, data1);
  THCudaStorage_set(self, 2, data2);
  THCudaStorage_set(self, 3, data3);
  return self;
}
Пример #3
0
THCudaStorage* THCudaStorage_newWithSize1(float data0)
{
  THCudaStorage *self = THCudaStorage_newWithSize(1);
  THCudaStorage_set(self, 0, data0);
  return self;
}
Пример #4
0
void THCudaTensor_set4d(THCState *state, THCudaTensor *tensor, long x0, long x1, long x2, long x3, float value)
{
  THArgCheck(tensor->nDimension == 4, 1, "tensor must have four dimensions");
  THArgCheck((x0 >= 0) && (x0 < tensor->size[0]) && (x1 >= 0) && (x1 < tensor->size[1]) && (x2 >= 0) && (x2 < tensor->size[2]) && (x3 >= 0) && (x3 < tensor->size[3]), 2, "out of range");
  THCudaStorage_set(state, tensor->storage, tensor->storageOffset+x0*tensor->stride[0]+x1*tensor->stride[1]+x2*tensor->stride[2]+x3*tensor->stride[3], value);
}
Пример #5
0
void THCudaTensor_set2d(THCState *state, THCudaTensor *tensor, long x0, long x1, float value)
{
  THArgCheck(tensor->nDimension == 2, 1, "tensor must have two dimensions");
  THArgCheck((x0 >= 0) && (x0 < tensor->size[0]) && (x1 >= 0) && (x1 < tensor->size[1]), 2, "out of range");
  THCudaStorage_set(state, tensor->storage, tensor->storageOffset+x0*tensor->stride[0]+x1*tensor->stride[1], value);
}
Пример #6
0
void THCudaTensor_set1d(THCState *state, THCudaTensor *tensor, long x0, float value)
{
  THArgCheck(tensor->nDimension == 1, 1, "tensor must have one dimension");
  THArgCheck( (x0 >= 0) && (x0 < tensor->size[0]), 2, "out of range");
  THCudaStorage_set(state, tensor->storage, tensor->storageOffset+x0*tensor->stride[0], value);
}