 The main purpose of this study is to evaluate the safety, tolerability, and efficacy of the study drug known as galunisertib in combination with nivolumab in participants with advanced refractory solid tumors and in recurrent or refractory non-small cell lung cancer NSCLC or hepatocellular carcinoma HCC. 