from tensorflow.compat.v1 import ConfigProto
from tensorflow.compat.v1 import InteractiveSession
config = ConfigProto()
config.gpu_options.per_process_gpu_memory_fraction = 0.8
session = InteractiveSession(config=config)
2020년 10월 20일 화요일
To set gpu memory rate manually when using keras
tensorflow.python.framework.errors_impl.UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize
add this code below on the top of the source code
gpus = tf.config.experimental.list_physical_devices('GPU')
if gpus:
try:
# Currently, memory growth needs to be the same across GPUs
for gpu in gpus:
tf.config.experimental.set_memory_growth(gpu, True)
logical_gpus = tf.config.experimental.list_logical_devices('GPU')
print(len(gpus), "Physical GPUs,", len(logical_gpus), "Logical GPUs")
except RuntimeError as e:
# Memory growth must be set before GPUs have been initialized
print(e)
2020년 10월 16일 금요일
After removing storyboard, app appears black in iOS with Objective-c.
1. set iOS version over 13 and make "Main Interface" is empty
2. add a ViewController
3. nd code below in the SceneDelegate.m
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
self.window = [[UIWindow alloc] initWithWindowScene:(UIWindowScene*)scene];
MainViewController *controller = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil];
self.window.backgroundColor = [UIColor redColor];
self.window.rootViewController = controller;
[self.window makeKeyAndVisible];
}