Skip to content

Instantly share code, notes, and snippets.

View nakosung's full-sized avatar

Nako Sung nakosung

  • NAVER, CLOVA AI
  • Seoul, Korea
View GitHub Profile
# Borrowed from NAF. Might be plugged into DeepSets.
class SigmoidFlow(nn.Module):
def __init__(self,K):
super().__init__()
self.W = nn.Parameter(torch.FloatTensor(K,1))
self.b = nn.Parameter(torch.FloatTensor(1,K))
self.alpha = nn.Linear(1,K)
def forward(self,x):
/// <reference path="typings/ue.d.ts">/>
let _ = require('lodash')
function maybe_create_ai() {
let controller = GWorld.GetAllActorsOfClass(AIController).OutActors[0]
if (!controller) {
let BP = Blueprint.Load('/Game/TopDownBP/Blueprints/TopDownCharacter.TopDownCharacter')
let old = GWorld.GetAllActorsOfClass(Character).OutActors[0]
let pos = old.GetActorLocation()
let character = new BP.GeneratedClass(GWorld,{X:pos.X + 100,Y:pos.Y + 100,Z:pos.Z})
function maybe_create_ai() {
let controller = GWorld.GetAllActorsOfClass(AIController).OutActors[0]
if (!controller) {
let BP = Blueprint.Load('/Game/TopDownBP/Blueprints/TopDownCharacter.TopDownCharacter')
let old = GWorld.GetAllActorsOfClass(Character).OutActors[0]
let pos = old.GetActorLocation()
let character = new BP.GeneratedClass(GWorld,{X:pos.X,Y:pos.Y + 200,Z:pos.Z})
controller = new AIController(GWorld)
controller.Possess(character)
}
function createAvatar() {
let character = new Character(GWorld)
let controller = new AIController(GWorld)
controller.Possess(character)
let callback = null
controller.OnMoveCompleted = (req, result) => {
if (callback) {
callback(result)
callback = null
}
This file has been truncated, but you can view the full file.
init_all_tables: /job:worker/replica:0/task:0/gpu:0
init_2: /job:worker/replica:0/task:0/gpu:0
group_deps: /job:worker/replica:0/task:0/gpu:0
Const: /job:worker/replica:0/task:0/cpu:0
report_uninitialized_variables/Shape: /job:worker/replica:0/task:0/cpu:0
report_uninitialized_variables/strided_slice: /job:worker/replica:0/task:0/gpu:0
report_uninitialized_variables/concat: /job:worker/replica:0/task:0/gpu:0
report_uninitialized_variables/Reshape: /job:worker/replica:0/task:0/cpu:0
save/Const: /job:worker/replica:0/task:0/cpu:0
save/restore_slice_404: /job:worker/replica:0/task:0/cpu:0
@nakosung
nakosung / rotating-box.js
Last active August 10, 2016 13:10
unreal.js rotating box
GWorld.GetAllActorsOfClass(Light).OutActors.map(l => l.DestroyActor())
function light(color) {
let actor = new PointLight(GWorld)
actor.LightComponent.SetMobility('Movable')
actor.LightComponent.Intensity = 1000
actor.LightComponent.SetLightColor(color)
return actor
}
console.log("Hello Github Gist")
let actor = null
function write(something) {
if (actor == null) {
actor = new TextRenderActor(GWorld, { X: 800, Z: 100 }, { Yaw: 180 })
actor.TextRender.SetHorizontalAlignment('EHTA_Center')
}
actor.TextRender.K2_SetText(something)
}
Context.RunFile('aliases.js')
Context.RunFile('polyfill/unrealengine.js')
Context.RunFile('polyfill/timers.js')
function client() {
class MyTextRenderActor extends TextRenderActor {
ctor() {
this.AppComponent = ApplicationLifecycleComponent.CreateDefaultSubobject("Lifecycle")
this.AppComponent.ApplicationHasEnteredForegroundDelegate.Add(() => {
this.TextRender.SetText("App foreground")
UObject.prototype.ClearTimerbyFunctionName = UObject.prototype.K2_ClearTimer;
UObject.prototype.GetTimerElapsedTimebyFunctionName = UObject.prototype.K2_GetTimerElapsedTime;
UObject.prototype.GetTimerRemainingTimebyFunctionName = UObject.prototype.K2_GetTimerRemainingTime;
UObject.prototype.IsTimerActivebyFunctionName = UObject.prototype.K2_IsTimerActive;
UObject.prototype.IsTimerPausedbyFunctionName = UObject.prototype.K2_IsTimerPaused;
UObject.prototype.PauseTimerbyFunctionName = UObject.prototype.K2_PauseTimer;
UObject.prototype.SetTimerbyFunctionName = UObject.prototype.K2_SetTimer;
UObject.prototype.DoesTimerExistbyFunctionName = UObject.prototype.K2_TimerExists;
UObject.prototype.UnpauseTimerbyFunctionName = UObject.prototype.K2_UnPauseTimer;
UObject.prototype.ToString = UObject.prototype.Conv_ObjectToString;