                         if (numImages % 128 == 0) {
                           cudaTextureObject_t texFilters = THCudaTensor_getTextureObject(filters);
                           cudaTextureObject_t texHidActs = THCudaTensor_getTextureObject(hidActs);
-                            cudaFuncSetCacheConfig(conv_img_acts_manycolor_preloadfh_ty_8_tx_32_c_8_ff_32_fh_16< 8, 32, 4, 8, 32, 16, true, false, false >, cudaFuncCachePreferShared);
-                            conv_img_acts_manycolor_preloadfh_ty_8_tx_32_c_8_ff_32_fh_16< 8, 32, 4, 8, 32, 16, true, false, false ><<<blocks, threads, 0>>>(texHidActs, texFilters, THCudaTensor_data(targets), numModulesY, numModulesX, numImages, numFilters, filterSize, imgSizeY, imgSizeX, paddingStart, moduleStride, numImgColors, numGroups, scaleTargets, scaleOutput);
+                            cudaFuncSetCacheConfig(conv_img_acts_manycolor_preloadfh_ty_8_tx_32_c_8_ff_32_fh_16_tex< 8, 32, 4, 8, 32, 16, true, false, false >, cudaFuncCachePreferShared);
+                            conv_img_acts_manycolor_preloadfh_ty_8_tx_32_c_8_ff_32_fh_16_tex< 8, 32, 4, 8, 32, 16, true, false, false ><<<blocks, threads, 0>>>(texHidActs, texFilters, THCudaTensor_data(targets), numModulesY, numModulesX, numImages, numFilters, filterSize, imgSizeY, imgSizeX, paddingStart, moduleStride, numImgColors, numGroups, scaleTargets, scaleOutput);
                       checkCudaErrors(cudaDestroyTextureObject(texFilters));
                       checkCudaErrors(cudaDestroyTextureObject(texHidActs));
                         }

                        if (numImages % 128 == 0) {
                          cudaTextureObject_t texFilters = THCudaTensor_getTextureObject(filters);
                          cudaTextureObject_t texHidActs = THCudaTensor_getTextureObject(hidActs);
                            cudaFuncSetCacheConfig(conv_img_acts_manycolor_preloadfh_ty_8_tx_32_c_8_ff_32_fh_16< 8, 32, 4, 8, 32, 16, false, false, false >, cudaFuncCachePreferShared);
                            conv_img_acts_manycolor_preloadfh_ty_8_tx_32_c_8_ff_32_fh_16< 8, 32, 4, 8, 32, 16, false, false, false ><<<blocks, threads, 0>>>(texHidActs, texFilters, THCudaTensor_data(targets), numModulesY, numModulesX, numImages, numFilters, filterSize, imgSizeY, imgSizeX, paddingStart, moduleStride, numImgColors, numGroups, scaleTargets, scaleOutput);
                      checkCudaErrors(cudaDestroyTextureObject(texFilters));
                      checkCudaErrors(cudaDestroyTextureObject(texHidActs));
                        }


template <int B_Y, int B_X, int imgsPerThread, int colorsPerThread, int filterCacheF, int filterCacheH, bool scale, bool checkCaseBounds, bool conv>
__global__ void
__launch_bounds__(256, 2)   // 256 threads per block, 2 blocks per multiprocessor
                            // These launch bounds ensure 25% occupancy (128 registers used)
                            // as oppposed to 13% (130 registers) achieved by defaults.
conv_img_acts_manycolor_preloadfh_ty_8_tx_32_c_8_ff_32_fh_16_tex(cudaTextureObject_t hidActs, cudaTextureObject_t filters, float* targets,
                                          const int numModulesY, const int numModulesX, const int numImages, const int numFilters,
                                          const int filterSize, const int imgSizeY, const int imgSizeX, const int paddingStart, const int moduleStride,
                                          const int numImgColors, const int numGroups,
